전체 글
-
4장 - 오류클린 코드(Clean Code)/좋은 코드, 나쁜 코드 요약 2023. 12. 13. 00:01
런타임은 불안정해 사용자가 잘못된 값 입력 외부 시스템 다운 내가 작성한 코드에서 버그 이런 점들을 고려했을 때 오류는 불가피합니다. 따라서 오류 사례에 대해서 잘 구분하여 잘 처리해야 신뢰성 높은 코드를 작성할 수 있습니다. 복구 가능한 오류 사용자가 값을 잘못 입력했는데 전체 시스템이 작동을 멈춘다면 어떨까요? 이는 바로 좋지 않은 사용자 경험으로 이어지게 됩니다. 그보다는 사용자가 유효하지 않은 입력을 수행하면 오류 메시지를 제공하고 올바른 번호를 입력받도록 요청할 수 있습니다. 이외에도 통계를 기록하는 부분과 같이 비즈니스에 중요하지 않은 부분이나, 몇 초 뒤에 다시 시도해서 해결되는 네트워크 오류 등은 복구 가능한 오류입니다. 이런 오류들은 일어날 가능성이 높다고 판단해야 하며 오류가 발생해도..
-
3장 - 다른 개발자와 코드 계약클린 코드(Clean Code)/좋은 코드, 나쁜 코드 요약 2023. 12. 12. 00:01
우리는 팀으로 일한다 정확한 숫자는 중요하지 않지만 일반적으로 우리는 두세 명으로 이루어진 팀에서 소프트웨어에 대한 작업을 수행합니다. 이때 내가 작성한 코드 위에 또 다른 추상화 계층이 쌓일 수 있으며 혹은 내가 작성한 코드를 기반으로 하위 문제를 해결하기 위해 재사용할 수도 있습니다. 결국 중요한 것은 내 코드가 다른 개발자에 의해 재사용된다는 것입니다. 또한 소프트웨어의 요구사항은 매번 바뀌고 다른 개발자들이 활발하게 코드를 변경하더라도 튼튼하고 사용하기 쉬어야 합니다. 따라서 세 가지를 고려하는 것이 좋습니다. 나에게 명백하다고 해서 다른 사람도 그럴 것이라 생각하면 안 된다. 다른 개발자가 무의식 중에 내 코드를 망가뜨릴 수 있다. 시간이 지나면 내가 작성했던 코드를 기억하지 못한다. 다른 사람..
-
2장 - 추상화 계층클린 코드(Clean Code)/좋은 코드, 나쁜 코드 요약 2023. 12. 11. 02:11
우리가 문제를 해결하는 방법 코드 작성의 목적은 문제 해결입니다. 예를 들어 "사용자가 1/N으로 정산할 수 있는 기능이 필요하다"와 같은 상위 문제부터 "계좌는 음수가 될 수 없으니 0 이하인 경우 예외가 발생한다라는 코드가 필요하다"와 같은 하위 수준의 문제까지 내려올 수 있습니다. 대게 코드를 잘 구성한다는 것은 간결한 추상화 계층을 만드는 것으로 귀결될 때가 많습니다. 추상화 계층을 만드는 이유 코드 작성은 복잡한 문제를 계속하여 더 작은 하위 문제로 세분화하는 과정이다. 서버에 메시지를 보내는 코드 작성하는 예제 HttpConnection connection = HttpConnection.connect("http://example.com/server"); connection.send("Hello..
-
React란?프로젝트/react 부시기 2023. 12. 10. 00:01
React란? React.js 또는 ReactJS라고도 알려진 React는 웹 애플리케이션용 사용자 인터페이스(UI) 또는 사용자 인터페이스 구성 요소를 구축하기 위한 오픈 소스 JavaScript 라이브러리입니다. Facebook에서 개발하고 오픈소스화 하여 대화형 및 동적 웹 애플리케이션을 만드는 데 널리 사용됩니다. 대규모의 활발한 개발자 커뮤니티를 가지고 있습니다. React의 등장배경 react를 사용하지 않더라도 html, css, javascript를 활용하여 DOM을 조작하여 콘텐츠를 변경하거나 사용자 작업에 응답할 수 있습니다. 하지만 Javascript를 활용하여 복잡한 UI를 관리하고 브라우저 간 호환성 문제를 처리하는 것이 점점 더 어려워지고 오류가 발생하기 쉽기 때문에 이 접근 방..
-
공식문서로 알아보는 Composing suspending functionsKotlin/코루틴 2023. 12. 9. 00:01
개요 Kotlin 공식문서를 보며 코루틴의 suspend function 작성방법에 대해 알아보면서 실습해보고자 합니다. 기본적으로 순차적으로 실행된다 val time = measureTimeMillis { val one = doSomethingUsefulOne() val two = doSomethingUsefulTwo() println("The answer is ${one + two}") } println("Completed in $time ms") suspend fun doSomethingUsefulOne(): Int { delay(1000L) // pretend we are doing something useful here return 13 } suspend fun doSomethingUsefulT..
-
1장 - 코드 품질클린 코드(Clean Code)/좋은 코드, 나쁜 코드 요약 2023. 12. 8. 00:01
우리가 고품질의 코드를 원하는 이유 요구 사항을 완전하게 충족한다. 요구 사항 변화에 대해 사소한 작업만 해도 유연하게 대응이 가능하다. 오류 발생 시 시스템이 복구되거나 부분적으로 작동한다. 예상되지 않은 상황도 처리한다. 시스템 공격에도 손상되지 않는다. 간단한 5줄이지만 사실 이것만 지키기에도 어려워 보입니다. 특히 예상하지 못한 오류 발생 시 데이터 정합성도 잘 지켜주어야 합니다. 우리가 작성한 코드가 소프트웨어가 되어가는 과정 개발자가 열심히 코드를 작성한다. 동료 개발자에게 코드 검토를 요청한다. 검토완료된 코드를 코드베이스로 병합한다. 프로덕션 서버에 배포한다. 테스트를 수행해 보고 문제가 발생하면 롤백하고, 그렇지 않으면 이제 코드가 소프트웨어가 된다. 코드를 작성할 때 네 가지 상위 수준..
-
React vs VueJS vs Angular 비교해보기프로젝트/react 부시기 2023. 12. 7. 00:01
개요 react에 대해서 본격적으로 알아보기에 앞서 유사한 기술스택에 대해서 어떤 차이점들이 있는지 비교해보고자 합니다. 주로 사용되는 유명한 프레임워크로는 reactJS, vueJs, Angular 등이 있습니다. "React vs VueJs vs Angular"에 대해 비교해 보는 시간을 가져보겠습니다. 공통점 - Single Page Application 세 가지 기술의 공통점은 모두 SPA라는 것입니다. SPA를 해석하자면 단일 페이지 애플리케이션이라는 의미로 웹 사이트의 전체 페이지를 하나의 페이지에 담아 동적으로 화면을 변경하는 기술입니다. 페이지 전환 시 페이지를 새로 요청하는 게 아니라 자바스크립트로 HTML을 갈아치우면서 부드럽게 구현하는 것인데 일일이 구현하려면 귀찮고 코드가 길어지게 ..
-
Outer Join 주의사항CS/데이터베이스 2023. 12. 6. 00:01
개요 bigQuery를 활용하여 두 테이블을 join 하다가 내 예상과 다른 결과가 나와서 당황했는데 근본적인 원인을 찾아 해결한 내용을 적어보고자 합니다. 시도했던 쿼리 -- 예상한대로 결과가 나오지 않는 쿼리 select * from `myTable1` as C LEFT OUTER JOIN `myTable2`as B on C.user_id = B.user_id WHERE C.partition_dates = '2023-11-20' AND C.탈퇴가_되지_않았으면_None인_필드 = 'None' AND B.user_id is null AND B.partition_dates = '2023-11-20'; B테이블과 C테이블을 비교하여 데이터 정합성을 맞추는 과정을 수행하고 있었습니다. 이때 LEFT OUTE..