본문 바로가기
[Kotlin] Kotlin 의 숨겨진 비용 #1 [Kotlin] Kotlin 의 숨겨진 비용 #1 https://medium.com/@BladeCoder/exploring-kotlins-hidden-costs-part-1-fbb9935d9b62 -“With great power comes great responsibility” 를 기억해야 한다.( 간단한 코드를 짜는 대신 대가가 있다는 얘기다 ) -Kotlin bytecode inspector 를 사용하면 Kotlin 코드가 어떻게 bytecode 로 변환되는지 볼 수 있다.Android studio plugin 으로 접할 수 있다.이를 보면 primitive type 의 boxing, code 에서 보이지 않는 기타 object 들의 instantiation, 그리고 각종 추가 method 들의 추.. 2018. 1. 16.
[iOS] Swift 는 어떻게 Objective-C 보다 훨씬 빠른가? [iOS] Swift 는 어떻게 Objective-C 보다 훨씬 빠른가? http://programmers.stackexchange.com/questions/242816/how-can-swift-be-so-much-faster-than-objective-c-in-these-comparisons -Objective-C 자체가 매우 느린 언어이다.C part 는 빠르지만, Objective-C 파트는 그렇게 빠르지는 않다.Objective-C 는 Object 화 시켜 native C 보다는 성능문제가 있다. -Objective-C 는 모든 method 가 dynamic 하게 dispatch 된다.static dispatch 는 없다. 이것이 큰 단점이다. Swift 는 static diaptch 부분을 많이.. 2017. 9. 14.
[Kotlin Tutorial] DSL construction - Chap 11. [Kotlin Tutorial] DSL construction - Chap 11. 참조 : Kotlin in action 11.1. From APIs to DSLs -DSL 을 작성하기 전에 생각해봐야 할 것이 있다. 우리의 (Kotlin?) 궁극적 목표는 가독성과 유지보수성을 최대로 늘리는 것.그것은 곧 좋은 API 를 설계하는 것으로 이어진다. 그렇다면 API 가 clean 하다는 것은 무슨 의미일까?1. 사용자가 읽기 좋은 것. 그것은 name 과 concept 을 잘 잡는 것이다.2. 의미없는 syntax 는 빼고, 최소한의 코드로 code 가 읽기 좋은 것. -Kotlin 에서는 clean API 를 위해서 extension function, infix calls, lambda syntax sh.. 2017. 9. 14.
[Kotlin Tutorial] Annotation 과 Reflection #2 [Kotlin Tutorial] Annotation 과 Reflection #2 참조 : Kotlin in action 10.2. Reflection: introspecting Kotlin objects at runtime -Kotlin 에서의 reflection 은 java.lang.reflect package 의 API 들과 kotlin.reflect package 의 API 들을 사용한다.Kotlin 의 reflection 은 Java 에 없는 nullable type 이나 properties 들의 접근을 가능하게 한다. -runtime lib 의 size 를 줄이기 위해, kotlin 의 reflection API 는 kotlin-reflect.jar 라는 별개의 jar 로 pakcage 되어 있.. 2017. 9. 12.
[Kotlin Tutorial] 람다로 프로그래밍 하기 - Chap5. Programming with Lambdas [Kotlin Tutorial] 람다로 프로그래밍 하기 - Chap5. Programming with Lambdas 참조 : Kotlin in Action 5.1. Lambda expressions and member references 5.1.1. Introduction to lambdas : blocks of code as function parameters 5.1.2. Lambdas and collections -val people = listOf(Person(“Alice”, 29), Person(“Bob”, 31))println( people.maxBy{ it.age } ) // function 을 argument 로 받는다. { } 는 lambda syntax lambda 가 단순 functio.. 2017. 8. 16.
[Effective Objective-C] #13 불투명 메서드를 디버깅할 때 메서드 스위즐링을 사용하라 [Effective Objective-C] #13 불투명 메서드를 디버깅할 때 메서드 스위즐링을 사용하라 출처 : Effective Objective-C -Opaque Method ( 불투명 메소드 ) : 소스 코드를 볼 수 없는 메소드 -동적 바인딩은 호출될 메서드가 실행 시간에 바뀔 수 있다는 것을 뜻한다.이 능력은 굉장한 유연성을 제공하는데, 소스 코드가 없는 클래스 ( 즉 바이너리 파일만 있는 경우 ) 라도 하위 클래스를 만들거나 메서드를 재정의하지 않고도 기능을 변경할 수 있다.그래서 하위 클래스에서 메서드를 재정의하는 방법은 하위 클래스의 인스턴스만 변경한 기능을 사용할 수 있는 것에 반해, 이 방법은 해당 클래스(기본 클래스와 모든 하위 클래스)의 모든 인스턴스에서 새로운 기능을 사용할 수 .. 2017. 8. 15.
[Kotlin Tutorial] 클래스, objects, 그리고 인터페이스 #2 [Kotlin Tutorial] 클래스, objects, 그리고 인터페이스 #2 참조 : Kotlin in Action 4.3. Compiler-generated methods: Data classes and Class delegation 4.3.1. Universal object methods -Java 에서 == 는 primitive 나 object 의 reference 를 비교하는 것.Kotlin 에서는 == 가 기본비교이다. equals 를 호출해서 비교한다.그럼 Java 에서의 == 는? === 로 대체된다. 4.3.2. Data classes: autogenerated implementations of universal methods -data class Client(val name: Stri.. 2017. 8. 14.
[android] 추가된 유용한 annotations [android] 추가된 유용한 annotations http://tools.android.com/tech-docs/support-annotationshttps://developer.android.com/reference/android/support/annotation/package-summary.html -Android support library 19.1 version 에서 annotation 들을 추가했다. -이 녀석을 사용하려면 gradle 에 다음을 추가해야 한다. compile ‘com.android.support:support-annotations:20.0.0’ 여기서는 크게 3가지 형태의 annotation 을 제공한다. 1. Nullness annotattions2. Resource ty.. 2017. 8. 2.
[android] Annotation Processing 에 대한 이야기 [android] Annotation Processing 에 대한 이야기 http://hannesdorfmann.com/annotation-processing/annotationprocessing101 The Basics -annotation processing 은 compile time 에 annotation 을 확인하여 어떤 action 을 하는 것을 이야기한다. -annotation processing 은 Java 5 부터 가능하다.그러나 사용할만한 API 는 Java 6 에 release 되었다. -annotation processor 는 java code 나 byte code 를 input 으로 받아서 java 파일로 output 을 생성한다.이 생성된 output 은 compile time 에.. 2017. 7. 31.
반응형