메서드에서 무언가 검증하는 기능을 만들때 validate 를 쓸지 verify를 쓸지 헷갈렸다.
사실 한국어로 생각했을때 두 의미는 비슷비슷 해보여서 그때 그때 맘에드는걸 골라서 썼었는데 확실히 정리하는게 좋을 것 같다.
validation
사용자가 입력한 값이 맞는지 검증할때 사용한다.
사용자가 서버로 값을 보낼때 맞춰야하는 조건들을 확인할때 사용 ( ex 이메일 서식, 6~10자리 이하의 수를 입력해주세요, 비밀번호에는 영소문자가 포함되어야합니다 이런거 체크할때)
verification
개발자가 만든 로직이 맞는지 검증할때 사용한다.
ex) 아이디 중복 검증, 토큰 검증 등등 개발자가 사용자로 부터 넘어온 값을 확인해줘야하는 부분
GPT 형님 답변~ 틀릴 수도 있음~
Validate vs. Verify
- Validate: Validation is the process of checking if something meets a set of criteria or standards. It's about ensuring the data or system input conforms to the rules and requirements set before processing. Validation typically happens before any processing takes place.
- Example: When a user enters their email address during registration, the system checks if the format of the email is correct (e.g., contains an "@" symbol and a domain). This is a validation check.
- Verify: Verification is the process of checking if something is true, accurate, or consistent. It's about confirming that the results meet the expected outcomes, often after some processing has taken place.
- Example: After sending a confirmation email to the address provided during registration, the system waits for the user to click on a verification link. This action verifies that the email address actually belongs to the user and is functional.
- Validation: Ensures data meets certain criteria before processing (e.g., format, length).
- Verification: Confirms data's accuracy or uniqueness, often after some initial processing (e.g., checking database for duplicates).
'프로젝트 활동 > 궁금한 것 or 공부한 내용 정리' 카테고리의 다른 글
get과 post 방식의 차이 (0) | 2024.07.21 |
---|