빠른 Android 개발과 쉬운 유지보수를 위한 오픈소스 프레임워크 AndroidAnnotations.
AndroidAnnotations에 대해서 알고 함께 사용해 봅시다^_^!
오늘은 JuranoSaurus의 첫 번째 강의인 AndroidAnnotations 시작하기 입니다.
JuranoSaurus Project Team. 김성근 김태희 서주리
✔ 세미나 커리큘럼 확인하기: http://www.hanbit.co.kr/store/education/edu_view.html?p_code=S9897423756
안드로이드 빌드 시스템, 그레이들 실무를 위하여 필요한, 빌드 타입과 제품 특성에 대하여 알아본다.
[주요 내용]
1 빌드 타입 이해하기
2 제품 특성과 빌드 변형
3 제품 특성에 따라 리소스 병합하기
4 자바 소스 코드 병합하기
[목표]
- 빌드 타입과 제품 특성을 구별할 수 있다.
- 내 프로젝트에 제품 변형(빌드 타입 + 제품 특성)을 적용해볼 수 있다.
- 제품 변형을 활용하여 고객 요구 사항에 맞게 이미지 등의 리소스를 다르게 할 수 있다.
- 제품 변형을 활용하여 고객 요구 사항에 맞게 소스 코드의 일부를 다르게 할 수 있다.
갑을병정 산업구조에서 갑돌이의 잦은 요구사항 변경 통보를 받아보셨을 겁니다. 사람들에게 받은 스트레스를 풀려고 '그래! 난 개발자닌깐' 하고 자리에 앉아서 코드를 짜는데 반복적인 작업을 하다보면 ‘내가 이걸 왜 하고 있나’ 라는 생각까지 들기도 합니다.
안드로이드 작업을 하다보면 다음과 같은 반복적인 작업을 하는 것을 느꼈을 겁니다.
반복적인 보일러(Boiler)코드를 줄일 수 있는 오픈소스를 소개하고자 합니다.
빠른 Android 개발과 쉬운 유지보수를 위한 오픈소스 프레임워크 AndroidAnnotations.
AndroidAnnotations에 대해서 알고 함께 사용해 봅시다^_^!
오늘은 JuranoSaurus의 첫 번째 강의인 AndroidAnnotations 시작하기 입니다.
JuranoSaurus Project Team. 김성근 김태희 서주리
✔ 세미나 커리큘럼 확인하기: http://www.hanbit.co.kr/store/education/edu_view.html?p_code=S9897423756
안드로이드 빌드 시스템, 그레이들 실무를 위하여 필요한, 빌드 타입과 제품 특성에 대하여 알아본다.
[주요 내용]
1 빌드 타입 이해하기
2 제품 특성과 빌드 변형
3 제품 특성에 따라 리소스 병합하기
4 자바 소스 코드 병합하기
[목표]
- 빌드 타입과 제품 특성을 구별할 수 있다.
- 내 프로젝트에 제품 변형(빌드 타입 + 제품 특성)을 적용해볼 수 있다.
- 제품 변형을 활용하여 고객 요구 사항에 맞게 이미지 등의 리소스를 다르게 할 수 있다.
- 제품 변형을 활용하여 고객 요구 사항에 맞게 소스 코드의 일부를 다르게 할 수 있다.
갑을병정 산업구조에서 갑돌이의 잦은 요구사항 변경 통보를 받아보셨을 겁니다. 사람들에게 받은 스트레스를 풀려고 '그래! 난 개발자닌깐' 하고 자리에 앉아서 코드를 짜는데 반복적인 작업을 하다보면 ‘내가 이걸 왜 하고 있나’ 라는 생각까지 들기도 합니다.
안드로이드 작업을 하다보면 다음과 같은 반복적인 작업을 하는 것을 느꼈을 겁니다.
반복적인 보일러(Boiler)코드를 줄일 수 있는 오픈소스를 소개하고자 합니다.
Антон Минашкин
Android разработчик с 5-летним стажем. Сейчас занимает должность Android Developer в GlobalLogic . Выступал на UA Mobile'14 , конференции "IT- ПЕРСПЕКТИВА" , Kyiv Android gathering , Android Dev Club и др . Cоорганизатор сообществ GDG Kremenchuk и IT Kremenchuk .
Dagger 2 analyzes dependencies and generates code to wire them together without manual work. It uses annotations like @Inject, @Module and @Provides to associate classes and provide dependencies. Objects are injected by calling inject() on a Component, which locates dependencies by type. Scopes like @Singleton control the lifetime of objects. Modules define how to provide dependencies, and Components bring Modules together to inject objects.
Dependency Injection with Dagger 2 presentationJT Liew
The document discusses Dagger 2, a dependency injection framework developed and maintained by Google. It provides an overview of dependency injection and how Dagger 2 implements it through modules, components, and annotations. Modules define how dependencies are provided, components bring modules together and expose entry points, and annotations like @Inject and @Component are used to inject dependencies. The document uses an example of injecting dependencies for a car engine to demonstrate Dagger 2 concepts like modules that provide fuel injectors and engines, and components that inject dependencies into classes. It also discusses how Dagger 2 works with Android applications through components, subcomponents, and annotations like @ActivityScope.
Dependency injection is a technique where objects receive their dependencies from external sources rather than creating them themselves. It decouples classes from their dependencies and allows dependencies to be replaced without modifying the dependent class. A dependency injection container creates and maps dependencies, providing them to classes through constructor or property injection according to how they are configured in the container.
Антон Минашкин
Android разработчик с 5-летним стажем. Сейчас занимает должность Android Developer в GlobalLogic . Выступал на UA Mobile'14 , конференции "IT- ПЕРСПЕКТИВА" , Kyiv Android gathering , Android Dev Club и др . Cоорганизатор сообществ GDG Kremenchuk и IT Kremenchuk .
Dagger 2 analyzes dependencies and generates code to wire them together without manual work. It uses annotations like @Inject, @Module and @Provides to associate classes and provide dependencies. Objects are injected by calling inject() on a Component, which locates dependencies by type. Scopes like @Singleton control the lifetime of objects. Modules define how to provide dependencies, and Components bring Modules together to inject objects.
Dependency Injection with Dagger 2 presentationJT Liew
The document discusses Dagger 2, a dependency injection framework developed and maintained by Google. It provides an overview of dependency injection and how Dagger 2 implements it through modules, components, and annotations. Modules define how dependencies are provided, components bring modules together and expose entry points, and annotations like @Inject and @Component are used to inject dependencies. The document uses an example of injecting dependencies for a car engine to demonstrate Dagger 2 concepts like modules that provide fuel injectors and engines, and components that inject dependencies into classes. It also discusses how Dagger 2 works with Android applications through components, subcomponents, and annotations like @ActivityScope.
Dependency injection is a technique where objects receive their dependencies from external sources rather than creating them themselves. It decouples classes from their dependencies and allows dependencies to be replaced without modifying the dependent class. A dependency injection container creates and maps dependencies, providing them to classes through constructor or property injection according to how they are configured in the container.
주니어 개발자도 이해 할 수 있는 아름다운 JVM 세상Darion Kim
The document discusses the Java Virtual Machine (JVM) in 3 paragraphs:
1) It defines the JVM as a process that runs Java programs and handles memory and resource management similarly to an operating system. The JVM executes Java bytecode through an abstraction layer separating programs from hardware.
2) It explains how the JVM loads classes through classloaders and instantiates objects, allocating memory for each object. Garbage collection reclaims memory from objects no longer in use.
3) Web application servers like WAS are built on the JVM to run servlets and JSPs, allowing dynamic web content through Java code executed similarly to desktop programs on the JVM. The JVM provides a stable,
파울러는 2004년의 글에서 제어의 어떤 측면이 역행되는 것인지에 대한 의문을 제기하고 의존하는 객체를 역행적으로 취득하는 것이라는 결론을 내렸다. 그는 그와 같은 정의에 기초하여 제어 역행이라는 용어에 좀 더 참신한 ‘의존성주입(DI,dependency injection)’이라는 이름을 지어줬다.
모든 어플리케이션은 비즈니스 로직을 수행하기 위해 서로 협업하는 둘 또는 그 이상의 클래스들로 이뤄진다. 전통적으로 각 객체는 협업 할 객체의 참조를 취득해야 하는 책임이 있다.
이것이 의존성이다. 이는 결합도가 높으며 테스트하기 어려운 코드를 만들어낸다.
IoC를 적용함으로써 객체들은 시스템 내의 각 객체를 조정하는 어떤 외부의 존재에 의해 생성시점에서 의존성을 부여 받는데, 의존성이 객체로 주입(inject)된다는 말이다. 따라서 IoC는 한 객체가 협업해야 하는 다른 객체의 참조를 취득하는 방법에 대한 제어의 역행이라는 의미를 갖는다.
일반적으로 IoC는 의존성주입(DI), 의존성룩업(DL) 두 개의 하위부류로 나눌 수 있으며, 일반적으로 DI를 이야기 할 때는 IoC를 가리키지만 IoC를 이야기할 때는 DI를 가리키는 것은아니다. DI도 여러 종류 (세터주입,생성자주입,메소드주입)가 있지만 DL의 경우도 의존성 풀과 컨텍스트화된 의존성룩업(CDL) 두 종류가 있다.
11. Dagger 2
• 컴파일 타임 체크 가능
• 디버깅과 추적이 가능함
• Dagger 1보다 13% 성능 향상
• 의존성에 대한 범위 제한이 가능함
12. Android에서 어떻게 활용할 것인가?
• Context가 필요한 클래스
• Application 생명주기와 밀접한 클래스
(DB Manager, System Services, Analytics tracker)
• 핵심 비즈니스 로직
13. Android에서 어떻게 활용할 것인가?
• Context가 필요한 클래스
• Application 생명주기와 밀접한 클래스
(DB Manager, System Services, Analytics tracker)
• 핵심 비즈니스 로직
ButterKnife의 Object 버전이라 생각하면 이해하기 편할
듯
14. Dagger 2 API
• @Inject : 의존성을 요청
• @Module : 의존성을 제공하는 메서드들을 가진 클래스
• @Provide : 모듈 내에서 언급된 의존성들을 어떻게 구성하
고 제공하는지 알려주는 메서드
• @Component : @Module들과 @Inject사이의 다리 역할
15. Dagger 2 API
Dagger 2는 모듈(@Module) 에서 제공(@Provide)하는
요소들을 브릿지(@Component)에서 연결시켜준 클래스
내에서 요청
(@Inject)하는 의존 요소나 다른 @Provide에서 요청하
는 인자들에 주입 시켜준다.
16. Dagger 2 API
• @Scope : 의존성 관련 객체의 범위를 지정함
• @Qualifier : 같은 클래스의 종속성을 식별하는 식별자
17. Dagger 2 API
• @Inject : 의존성을 요청
• @Module : 의존성을 제공하는 메서드들을 가진 클래스
• @Provide : 모듈 내에서 언급된 의존성들을 어떻게 구성하
고 제공하는지 알려주는 메서드
• @Component : @Module들과 @Inject사이의 다리 역할
• @Scope : 의존성 관련 객체의 범위를 지정함
• @Qualifier : 같은 클래스의 종속성을 식별하는 식별자
19. Method Injection
• 메서드에 @Inject 어노테이션
• 메서드 인자가 의존 요소
• 객체가 생성된 후 주입이 발생
• 의존요소에 this 를 전달할 경우에만 사용하는 것을 권장함
20. Field Injection
• 필드(멤버변수)에 @Inject 어노테이션
• 필드는 private final이 될 수 없다
• 객체가 생성된 후 주입이 발생
• 자체적으로 주입에 대한 처리가 필요함
• Constructor Injection을 사용하지 못하는 경우 사용 가능
(e.g. Activity)
21. Scope Annotations
• 단 하나만의 인스턴스를 생성한다
• @Singleton은 제일 큰 범위의 어노테이션이다
• 아래와 같은 코드로 Custom 스코프 어노테이션을 지정할
수 있다
23. 결론
• Android 프레임워크 특성상의 Boilerplate 코드들을 줄일 수 있음
• 객체간의 결합도를 느슨하게 만들어 테스트나 유지보수가 편리함
• MVP 패턴의 아키텍쳐를 고려해봤을 때, Presenter 요소를 매
Activity마다 쉽게 주입할 수 있게 됨.
• 다만, 개념이 어렵고 의존관계에 대한 코드상의 트래킹이 어려울 가
능성이 있기 때문에, 프로젝트 내 모든 의존성을 Dagger로 대체하는
것은 오버 엔지니어링이라는 판단.
• Test가 반드시 필요한 핵심 비즈니스 모델과 Boilerplate코드가 난무
하는 Application, Activity, Fragment 요소들에만 우선적으로 적용하
는 것을 목표.