How to decouple, how to develop, how to choose the correct technology, few DDD concepts, and why BDD is so important.
How to Think...
http://rome.codemotionworld.com/2014/wp-content/themes/codemotion/detail-talk.php?detail=75
5. think too much…
… at the same technology
@bit_shark @liuggio#codemotion
What’s wrong here?
I’m developing a tech-centric application
I’m fitting business requirements with technical boundaries
6. rethink to
the origin
@bit_shark @liuggio#codemotion
But what about our preferred technology?
Was it the coolest? The most requested for working? Or trivially the simplest?
9. think with ease
@bit_shark @liuggio#codemotion
The success of a language is it’s distributability
(cheap, easy, zero-conf)?
10. a thought for thought
@bit_shark @liuggio#codemotion
There are successful application written in lacking languages
The success of the business make the success of the application
12. think to aim
the success
@bit_shark @liuggio#codemotion
nosql
Using the right technology in some
cases could lead to a wrong choice
13. Shaggio theorem
@bit_shark @liuggio#codemotion
Hypothesis: supposing a developer knows every technology
and make a good choice for a complex application
Thesis: whatever will be the choice could be the wrong choice
…we are thinking to the app
as a one big global ‘entity'
15. think…
@bit_shark @liuggio#codemotion
• Split the business needs in subsets… a subset could be composed by services...
• Spit and conquer and Object Oriented Design
• If you have to implement a complex system, don’t implement a complex
system, implement a lot of simple systems
17. think WTF!
@bit_shark @liuggio#codemotion
• How many times you will modify the application, did you think about Maintenance costs?
• Procedural is when you create a fast program (at the beginning) but difficult to maintain.
“Tragically, the very same forces that make it so easy
to add new features to a brand new Rails
application are the ones that start to hold you back
as the number of features grows.” cit. Matt Wynne
20. think “Operation”
@bit_shark @liuggio#codemotion
All the programs are difficult to maintain, but decoupled software is easier
How to understand if my code is decoupled?
If you modify here and you don’t break over there.
22. Time
Feature
think maintainability
@bit_shark @liuggio#codemotion
TDD
• Modularity is the main concept of Object Oriented Design
• The trend has changed (90 years ago), now we have to focus on maintainability
• The overhead of testing before code is smaller than you think and the real adding
value is the way you develop better your application
23. Think back to ‘89
@bit_shark @liuggio#codemotion
responsability driven approach!
SOLID principles
• R. Wirfs-Brock, B. Wilkerson, “Object-Oriented Design: A Responsibility-Driven Approach”
• Single responsibility principle Uncle Bob
• Create a module coupling things that changes together?
• Modules that communicates, but how?
24. think tell don’t ask
Matt Wayne, Uncle Bob, Alec Sharp and Martin Fowler
@bit_shark @liuggio#codemotion
25. think behaviour
@bit_shark @liuggio#codemotion
dependency injection
• Modules that communicate via protocols
• Modules that exhibit a behavior not their data
• Data are the guts of the module, they must not be exposed
• All the public functions are API, let's take care and give them a meaning.
• Each module should have its own explicit dependencies
26. think and code
@bit_shark @liuggio#codemotion
1. An employee has always a name and a salary!
2. The salary is always greater than zero!
3. A company could add an employee
27. think and code
@bit_shark @liuggio#codemotion
1. An employee has always a name and a salary!
2. The salary is always greater than zero!
3. A company could add an employee
30. @bit_shark @liuggio#codemotion
think business language
3. A company could hire an employee
1. An employee has always a name and a salary!
2. The salary is always greater than zero!
3. A company could add an employee
35. think to clean the Architecture
Application goal: separation of concerns
Easy substitution of obsolete elements without affecting others components of the architecture