A software Orchestra
As a musician, developer, I often wonder if software development can be like an orchestra, with different parts working together seamlessly and harmoniusly. This has led me to always seeking for concepts and patterns that facilitate clean code and some of the interesting techniques discovered are:
- Dependency Injection
- Object Relational Mapping
- Databinding
1. Dependency Injection
Dependency Injection simplifies object construction, allowing developer worry less about object creation and focus on business logic. Code is written such that objects are not explicitly aware of how their dependencies are created, thereby fostering code reusability and loose coupling. This is the core concept of Spring framework which is a reason why Spring is heavily adopted and used for Enterprise Application Development.
A common challenge in enterprise application development is handling customizations for different clients, and solution is to abstract implementation till runtime. This is solved by coding to interfaces, then building with profiles containing actual implementation. At runtime, object implementations are created and supplied to object users simplifying code reusability.
2. Object Relational Mapping
Erstwhile, working with DB intensive applications can be a pain as database operations are manually written. DML operations are written in raw SQL, and mapping of domain objects to database tables are done manually. Worst nightmare comes when DBMS needs to be changed for some reason, and the whole application needs to be reworked.
ORM tools came to the rescue, providing ways to map domain models to database models seamlessly, and also interact with database operations programmatically, completing abstracting the actual DBMS. Hibernate is the foremost ORM tool for Java.
3. Databinding
Earstwhile, updating UI with result from asynchronouse calls was done using jQuery, and involved a lot of code, which made the task hedious. Then came javascript frameworks with databinding to the rescue.
My first experience with two way databinding magic was with AngularJS app.
Changes made on input fields reflect immediately on the code model, and updates to model also reflect immediately on the UI, making creation of Single Page Applications much more easier.
I'm continually in search of better techniques and patterns in creating a software orchestra, i.e. a codebase which works seamlessly and harmoniously, easy to extend, bug free and doing what customers want without hassle.