본문 바로가기

분류 전체보기

(299)
Effective Kotlin - Properties should represent state, not behavior 코틀린의 속성은 자바의 필드와 비슷해 보입니다. 그렇지만, 서로 다른 컨셉을 갖고 있습니다. //Kotlinproperty var name:String?=null //Javafield String name=null; 같은 방식으로 사용할지라도, 코틀린의 속성은 좀 더 많은 것을 할 수 있다. property 선언에 대한 전체 구문 var [: ] [= ] [] [] Custom Get, Set ( var ) var name: String? = null get() = field?.toUpperCase() set(value) { if(!value.isNullOrBlank()) { field = value } Custom Get ( val ) val fullName: String? get() = "$name ..
Effective Kotlin - 사용중인 리소스 닫기 use api 를 사용해서 사용이 완료된 resource 를 닫자. 우리가 사용하는 자원들 중에서는 사용완료 후 사용상태를 중지로 바꾸지 않는 자원들이 있습니다. 그리고 우리는 close method 등을 통해서 해당 자원의 상태를 사용하지 않는 상태로 바꾸어 줘야합니다. Kotlin/JVM 에서 사용하는 자바의 표준 라이브러리는 이런 자원들을 많이 포함하고 있습니다. 대표적으로 다음 리소스들의 경우 자동으로 자원의 반환이 이루어지지 않습니다. - InputStream and OutputStream - Java.sql.Connection - Java.io.Reader ( FileReader, BufferedReader, CSSParser ) - Java.new.Socket and java.util.Sca..
Effective Kotlin - 변수의 범위 최소화 변수의 범위를 최소화 하자 핵심포인트 property 대신 지역변수를 사용하자 가능한한 가장 작은 범위에서 변수를 사용하자 책에서말하는 근거 Scope 이 넓은 변수의 경우, 그 만큼의 코드를 다른 개발자들이 파악해야한다. 언제 정의되었고 초기화되는지. ( 일반적으로 우리는 정의를 함과 동시에 초기화를 진행하는 경우가 많다. 그렇지 않으면, 코드상에서 해당 변수가 언제 초기화되는지도 찾아봐야 하기 떄문이다. ) for 문을 마치고 나서, 변경된 값의 내용을 추리해야한다던지. Sequence 내부 로직 처리시, 의도치 않는 값이 나올 수 있다. 에라토스테네스 체 ( 소수 구하는 방법 중 하나 ) 동작하는 코드 ``` val primes: Sequence = sequence { var numbers = ge..
The Cap Theorem What is the CAP theorem? Before talk about CAP theroem. we need to know about distributed system. and why. As you know in the mobile era, the amount of request and data has increased exponentially. In accordance with this situation, in the database environment, there are also requirements that can be easily extended and data must be delivered quickly. A distributed system environment was devised..
Webflux exchange 와 retrieve 의 차이 Under what circumstances? I was using webflux with spring boot version 2.x.x When i was using Webclient in my codes. I was usually using exchange() after request. cause, api what i used. when failed. it response 200 HTTP Status with error body. At that time i had a big mistake. that I thought exchange() and retrieve() is same. If you think like that. you are wrong. they are different. then what ..
xcode swift print 디버그 모드일때만 동작하게 하기 Under what circumstances?Under Xcode 12.2With Swift5How to do?It's very simple way to be disable print function.If you are developing using Swift, it doesn't matter which swift file. Please insert the code below. In my case, I inserted it at the top of the AppDelegate.import UIKitimport CoreData...func print(_ items: Any...) { #if DEBUG Swift.print(items[0]) #endif}@UIApplicationMai..
package.json security issue Under what circumstances? I was using webpack 3.8.1 and run webpack build after build i got main.[chunkhash:8].js At that time my package.json data was included in main.xxxx.js file. That makes secure issue when i deployed that onto service. Actually i used private npm module own private npm repository. At this point, someone read my main.js file and got the package.json data. After that, he cre..
가상화폐 이건 확인해보고 투자하자 ! 블록체인을 알기전에 분산처리에 대해 알고 갑시다. 분산 시스템의 장점 ( 단일 컴퓨터와 비교했을때) 1. 계산 능력이 더 뛰어나다 2. 비용이 절감된다. 3. 더 안정적이다. 4. 자연스럽게 확장된다. 분산 시스템의 단점 1. 조정 오버헤드가 발생한다. ( 구성 요소들간의 상태 전파 ) 2. 통신 오버헤드가 발생한다. 3. 네트워크 의존도가 높다. 4. 프로그램이 복잡해진다. 5. 보안에 신경써야 한다. 블록체인을 알기전에 P2P 시스템에 대해서도 알고 갑시다. P2P 시스템 ? P2P 시스템의 장점은 중개자를 통해 간접적으로 상호작용하지 않고 거래 당사자끼리 직접 상호작용한다는 점이다. 따라서 처리 시간과 비용이 현저히 줄어든다. P2P 시스템의 추종자들은 디지털화와 P2P 네트워크의 등장으로 출생증명..