Dependency Injection Made Easy with Clojure
Dependency inversion is an architectural cornerstone of well implemented Clojure applications. However, many Clojure applications start out with an ad-hoc, poorly abstracted initialization model - since application initialization needs to include dependency inversion in most cases, the latter is often omitted or not given the due attention it deserves.
Not treating dependency inversion as a first class concern has devastating consequences on testability (hence robustness), comprehension and maintainability of code, and causes a vicious circle of broken-windows effect.
In this talk I will go into the details of why and how such things happen, and how one can avoid those. I will discuss dependency injection as a flavour of dependency inversion and as a practical solution to achieve cleaner application design. I will illustrate the use of dependency injection mechanism through code examples and will share my experience of using the mechanism in real world projects.
Outline/Structure of the Talk
The talk would be roughly structured as follows:
- Initialization as a first class concern
- Journey of a programmer: Hacker->Developer->Engineer
- Opportunity for composition/wiring
- Opportunity for instrumentation
- Opportunity for optimization
- Dependency injection as
- A means of composition
- One of the SOLID principles
- Layered design using Higher order Functions
- Organizing code by separating concerns
- Explicit dependencies as a first class concern
- Relevance with side effects (IO config params)
- Great for testing, for simulating scenarios
- Friction with Dependency injection mechanisms
- Dynamic binding
- World-passing anti pattern
- Protocol impedance mismatch
- Var dissociation
- Boilerplate and sync-on-refactor
- Incidental bootstrapping
- Global mutable dependencies: `alter-var-root`
- DIME, the namesake library
- Annotated vars
- Annotated dependencies
- Qualified names encouraged
- Post-inject for effect
- Dependency graph extraction (tooling/visualization)
- How it works
Attendees would learn about the following:
- Importance of Dependency-inversion in application design
- Why does dependency inversion often not receive proper attention
- Cleaner functional programming approach using dependency injection
- Dependency injection anti-patterns to avoid in Clojure
- An easy way to carry out clean dependency injection in Clojure
Intermediate Clojure programmers, or programmers experienced in other languages looking for Clojure best practices
schedule Submitted 3 years ago
People who liked this proposal, also liked:
Shantanu Kumar - Performance optimization with Code-as-data in ClojureShantanu KumarPrincipal EngineerConcur
schedule 3 years agoSold Out!
Homoiconicity (code as data, data as code) is one of the hallmarks of Lisp. Clojure, a Lisp-1 language, has this wonderful feature too. In this talk I will discuss about performance optimization techniques that leverage homoiconicity.
No discussion on performance optimization can happen without discussing performance benchmarking. In this talk I will show how to do comparative benchmarking while trying to find performance bottlenecks. I will then proceed to showing techniques on using Clojure's homoiconicity to optimize performance. I will also show how to discover latency breakup of any Clojure code in a waterfall-chart model using homoiconicity.
Rahul Muttineni - Bringing the Power of Haskell to the JVMRahul MuttineniCo-FounderTypeLead
schedule 3 years agoSold Out!
The JVM is a state-of-the-art, cross-platform virtual machine supported by the vast Java platform and ecosystem, but is cursed with an ancient and clumsy language that is slowly modernizing. Haskell is a state-of-the-art programming language with immature platform and tooling and no commercial development of its primary implementation. GHCVM's objective is to combine the best of both worlds and reap the benefits.
In this talk, I will share my journey of how I waded through the internals of GHC and got Haskell and Java to play nice with each other.