목록React (4)
은학의 코딩 일기장
MVC, MVVM, MVI 아키텍쳐가 어쩌고 저쩌고... 소프트웨어를 공부하다 보면 한번쯤은 MV~로 시작되는 무슨 무슨 아키텍쳐라는 말을 들어본 적이 있을 겁니다. 실제로 프로그래밍을 할 때에는 중요하지 않아 보이는데 이따금씩 눈에 밟혀 왠지 알고 가야할 것 같은 개념인 아키텍쳐와 MVC에 대해 웹 프론트엔드 개발자 관점에서 알아야 할 내용들을 정리해보았습니다. 1. 아키텍쳐란 무엇일까요? 아키텍처란 구조화 된 옷장과 비슷한 겁니다. 처음 개발 할 때에는 규칙없이 그냥 코드를 만들다 보면 덩치가 커지는 순간 불편함이 생기고 정리가 안 되는 시점이 생깁니다. 그러니 처음부터 특정한 규칙을 만들어서 개발을 하는게 좋다는 것을 알게 되고 규칙을 하나씩 만들어가며 개발을 하다보면 이것이 반복이 되어 하나의 특..
테스트코드란? 테스트코드란 내가 작성한 메서드가 실제로 재대로 동작하는지 테스트 하는 코드이다. 기능을 개발한 후 잘 구현되었는지 테스트 코드를 작성하고 리팩토링을 통해 향상시킬 수 있다. 의도된 대로 정확히 작동하는지 검증하는 절차이다. 테스트 코드…왜 써야되죠? 테스트 코드를 작성하는 이유는 크게 세 가지로 요약할 수 있습니다. 소프트웨어의 품질 향상: 테스트 코드를 작성하면 소프트웨어가 예상대로 동작하는지 여부를 확인할 수 있습니다. 이를 통해 버그를 발견하고 수정할 수 있으며, 이는 소프트웨어의 품질을 향상시키는 데 큰 역할을 합니다. 코드 유지 보수 용이성: 테스트 코드를 작성하면 소프트웨어의 코드를 변경할 때마다 기존 코드의 기능이 올바르게 동작하는지 확인할 수 있습니다. 이는 코드를 유지 보..
비지니스로직 프론트엔드 비지니스 로직은 프론트엔드 개발자가 구현하는 애플리케이션의 핵심 비즈니스 로직입니다. 이것은 애플리케이션의 사용자 인터페이스와 관련된 로직을 포함합니다. 프론트엔드 비즈니스 로직은 일반적으로 사용자 입력을 처리하고 유효성 검사를 수행하며 데이터를 검색하고 저장하는 등의 작업을 수행합니다. 예를 들어, 사용자가 폼을 작성하고 제출하면 프론트엔드 비즈니스 로직은 해당 폼의 데이터를 검증하고 서버에 전송하는 등의 작업을 수행합니다. 뷰 반면에 뷰는 프론트엔드에서 사용자에게 보여지는 UI를 구성하는 요소입니다. 뷰는 일반적으로 HTML, CSS, JavaScript와 같은 프론트엔드 기술을 사용하여 개발됩니다. 뷰는 사용자가 인터랙션 할 수 있는 요소를 포함하여 애플리케이션의 모든 UI를..
논리 && 연산자로 If를 인라인으로 표현하기 JavaScript에서 true && expression은 항상 expression으로 평가되고 false && expression은 항상 false로 평가됩니다. 따라서 && 뒤의 엘리먼트는 조건이 true일때 출력이 됩니다. 조건이 false라면 React는 무시하고 건너뜁니다. falsy 표현식을 반환하면 여전히 && 뒤에 있는 표현식은 건너뛰지만 falsy 표현식이 반환된다는 것에 주의해주세요. 아래 예시에서, 0이 render 메서드에서 반환됩니다. 조건부 연산자로 If-Else구문 인라인으로 표현하기 엘리먼트를 조건부로 렌더링하는 다른 방법은 조건부 연산자인 condition ? true: false 를 사용하는 것입니다. 아래의 예시에서는 짧은 ..