5. The Humble Programmer
“we shall be able to design and implement the
kind of systems that are now straining our
programming ability, at the expense of only a few
percent in man-years of what they cost us now,
and that besides that, these systems will be
virtually free of bugs”
by Edsger W. Dijkstra, 1972, http://bit.ly/2pHGbhF
6. The Humble Programmer
● intellectually manageable programs
● proof of correctness
● the amount of intellectual effort depends on
the program length
● the influence of the tool we are trying to use
upon our own thinking habits
● hierarchy
7. The Humble Programmer
“In computer programming our basic building
block has an associated time grain of less than a
microsecond, but our program may take hours of
computation time. I do not know of any other
technology covering a ratio of 1010
or more”
8. Two values of software
The secondary value of software is its behavior.
1
Defined by Uncle Bob Martin in episode 9 (‘The Single Responsibility
Principle’) of his CleanCoders video series
9. The primary value of
software is that it’s soft.
The ability of software to tolerate and facilitate such ongoing change is
the primary value of software.
2
10. Conclusions
● Programming is complicated
● Programming is risky
● Programming is expensive
That’s why we should care about what we write.
11. Symptoms of Rotting Design
◉ Rigidity - the tendency for software to be difficult to change
◉ Fragility - the tendency of the software to break in many places every
time it is changed
◉ Immobility - the inability to reuse software from other projects or from
parts of the same project
◉ Viscosity - two forms: viscosity of the design, and viscosity of the
environment
http://bit.ly/2rawutr
13. Every technique has own advantages and
overhead. Sometimes, a technique doesn’t fit.
You’re the one who is solely responsible for
the code quality of your project.
Disclaimer:
14. “
The main enemy of software is
complexity. To remain
maintainable, software should be
simple.
17. Analyze of Sorting algorithms
Bubble sort = O(N2
)
When N = 60, N2
= 3600
If we divide an array into two halves
we’ll have 2 * (N/2)2
= 2 * (302
) = 1800
20. Single Responsibility Principle
● Definition of responsibility
○ Should have only one reason to change file
● Works on class level as well as on module level
● + Decreases rigidity
● + Necessary step for modularity
32. IoC
1 ● Separates the application from the main.
● Fixes dependencies order.
● Decouples modules and classes.
● Decreases rigidity of the application.
39. First-class tests
● Tests are proof of correctness
● They make you feel safe while refactoring
● Tests drive better design
● Tests should be trustful
● Tests should be fast
40. Test-driven development
1. You are not allowed to write any production
code unless it is to make a failing unit test pass.
2. You are not allowed to write any more of a
unit test than is sufficient to fail; and
compilation failures are failures.
3. You are not allowed to write any more
production code than is sufficient to pass the
one failing unit test.
42. “
The only way to keep it simple is
to make composition of
abstractions
48. Infrastructure layer
1 ● Independent implementations of 3rd-party
services
● The easiest to extract to a gem
● Persistence is here
49. UI layer
1 ● An interface for interactive for the application
● HTTP delivery mechanism
● Validation is tied to an interface, not to an entity
● dry-validation