This is a presentation that I made in Servabit (a Bologna based friend's company) about the topic "SQL vs Code" in the sense of different approaches from a developer perspective to code a (simple to complex) application.
Boost Fertility New Invention Ups Success Rates.pdf
SQL vs Code
1. SQL vs Code
Nicola Junior Vitto
Servabit, Bologna, 25/01/2010
2. Bottom up
Presentation layer code
Business layer code
Business Database schema
request
Nicola Junior Vitto 2 SQL vs Code
3. Bottom up
Presentation layer coding
Business layer coding
Business Think about
Database schema
request the data model
Nicola Junior Vitto 3 SQL vs Code
4. Bottom up
Presentation layer coding
Start coding
Business layer coding
anything
Business
Database schema
request
Nicola Junior Vitto 4 SQL vs Code
5. Bottom up
Design the
Presentation layer coding look & feel
of your app
Business layer coding
Business Database schema
request
Nicola Junior Vitto 5 SQL vs Code
6. Top Down
Setup of all stack
(business, pres., db)
Business
request Business & DB
refinements
Presentation
refinements
Nicola Junior Vitto 6 SQL vs Code
7. Top Down
Think about
Setup of all stack
a complete
(business, pres., db)
feature
Business
request Business & DB
refinements
Presentation
refinements
Nicola Junior Vitto 7 SQL vs Code
8. Top Down
Setup of all stack
(business, pres., db)
Business Refine all
request Business & DB
business
refinements
stack
Presentation
refinements
Nicola Junior Vitto 8 SQL vs Code
9. Top Down
Setup of all stack
(business, pres., db)
Business
request Business & DB
refinements
Presentation Design/Refine
refinements interface
Nicola Junior Vitto 9 SQL vs Code
10. Top Down
Setup of all stack
(business, pres., db)
Business
request Business & DB
refinements
Often
parallelisable
Presentation
refinements
Nicola Junior Vitto 10 SQL vs Code
11. Bottom Up vs Top Down
Setup of all stack
Presentation layer coding
(business, presentation, db)
Business layer coding Business & DB refinements
Database schema Presentation refinements
Nicola Junior Vitto 11 SQL vs Code
12. Bottom Up vs Top Down
Setup of all stack
Database schema
(business, presentation, db)
Horizontal process Vertical process
Presentation
Business Feature Feature Feature
A B C
Data
Design application data
&
SQL coding Release one feature at a time
Nicola Junior Vitto 12 SQL vs Code
13. Bottom Up vs Top Down
Setup of all stack
Presentation layer coding
(business, presentation, db)
Business layer coding Business & DB refinements
Database schema Presentation refinements
Nicola Junior Vitto 13 SQL vs Code
14. Bottom Up vs Top Down
Business layer coding Business & DB refinements
Nicola Junior Vitto 14 SQL vs Code
15. Bottom Up vs Top Down
Setup of all stack
Presentation layer coding
(business, presentation, db)
Business layer coding Business & DB refinements
Database schema Presentation refinements
Nicola Junior Vitto 15 SQL vs Code
16. Bottom Up vs Top Down
Presentation layer coding Presentation refinements
Nicola Junior Vitto 16 SQL vs Code
17. Bottom Up vs Top Down
Bottom Up Top Down
One piece
Focus All stack
at a time
On single One feature
Commitment
“tech” part at a time
Hope in Good
Maintainability TDD/BDD
Coding ;)
Agile No Yes
Nicola Junior Vitto 17 SQL vs Code
18. Agile Manifesto
Individuals and interactions over processes and tools
Working software over comprehensive documentation
Customer collaboration over contract negotiation
Responding to change over following a plan
More info on: http://agilemanifesto.org/
Nicola Junior Vitto 18 SQL vs Code
19. (Some) Agile Methods
• Extreme Programming (XP): is a software
development methodology which is intended to improve software
quality and responsiveness to changing customer requirements.
• Scrum: is an iterative incremental framework for managing
complex work (such as new product development) commonly used
with agile software development.
• Getting Real: Getting Real (by 37signals) eschews formal
programming methodology and focuses on creating useful alpha
software with small teams, then iterating to a simple useful application
based, in part, on real-world customer feedback.
More info on: http://en.wikipedia.org/wiki/Agile_software_development
Nicola Junior Vitto 19 SQL vs Code
20. (Some) Agile Practices
• Test-driven Development (TDD)
Repetition of a very short development cycle: First the developer
writes a failing automated test case that defines a desired
improvement or new function, then produces code to pass that test
and finally refactors the new code to acceptable standards.
• Behavior Driven Development (BDD)
Behavior-driven developers use their native language in combination
with the ubiquitous language of Domain Driven Design to describe the
purpose and benefit of their code. This allows the developers to focus
on why the code should be created, rather than the technical details,
and minimizes translation between the technical language in which
the code is written and the domain language spoken by the business,
users, stakeholders, project management etc.
More info on: http://en.wikipedia.org/wiki/Agile_software_development
Nicola Junior Vitto 20 SQL vs Code
21. (Some) Agile Practices
• Continuous integration :
The principle is to replace
the old practice of applying quality control after all development has
been completed by continuous processes, as small pieces of effort,
applied frequently.
• Pair programming :
two programmers work together at
one work station. One types in code while the other reviews each line
of code as it is typed in. The person typing is called the driver. The
person reviewing the code is called the observer or navigator. The
two programmers switch roles frequently (possibly every 30 minutes
or less).
More info on: http://en.wikipedia.org/wiki/Agile_software_development
Nicola Junior Vitto 21 SQL vs Code
22. TDD
Write a test
Nicola Junior Vitto 22 SQL vs Code
23. TDD
Write a test
Check if the test fails
Nicola Junior Vitto 23 SQL vs Code
24. TDD
Write a test
Check if the test fails
Write business code
Nicola Junior Vitto 24 SQL vs Code
25. TDD
Write a test
Check if the test fails
Write business code
Run all tests
Nicola Junior Vitto 25 SQL vs Code
26. TDD
Write a test
Check if the test fails
Write business code
Run all tests
Refactor Code
Nicola Junior Vitto 26 SQL vs Code
27. TDD
How can you test
bottom-up apps?
Nicola Junior Vitto 27 SQL vs Code
28. TDD
How can you test
bottom-up apps?
Using your app
Nicola Junior Vitto 28 SQL vs Code
29. TDD
How can you test
bottom-up apps?
Writing tests
after coding
Using your app
Nicola Junior Vitto 29 SQL vs Code
30. TDD
How can you test
bottom-up apps?
Writing tests
after coding
Ok but can do better
Using your app
Nicola Junior Vitto 30 SQL vs Code
31. TDD
How can you test
bottom-up apps?
Writing tests
after coding
Ok but can do better
Not 100% code tested
Using your app
Nicola Junior Vitto 31 SQL vs Code
32. A bottom up approach
Collect requirements
Nicola Junior Vitto 32 SQL vs Code
33. A bottom up approach
Data design (all app.)
Nicola Junior Vitto 33 SQL vs Code
34. A bottom up approach
SQL coding a/o stored procedures
Nicola Junior Vitto 34 SQL vs Code
35. A bottom up approach
Business logic (all app.)
Nicola Junior Vitto 35 SQL vs Code
36. A bottom up approach
Presentation logic (all app.)
Nicola Junior Vitto 36 SQL vs Code
37. A bottom up approach
• When the application can be viewed by the
customer?
• What about features?
• What about testing?
• What if you have to change something?
• What if you have to re-design the entire
core / data model?
Nicola Junior Vitto 37 SQL vs Code
38. A top down approach
Collect requirements
Nicola Junior Vitto 38 SQL vs Code
39. A top down approach
Apply an Agile methodology and
one or more Agile practices
Methodologies XP Scrum
Practices TDD BDD Pair Programming
Nicola Junior Vitto 39 SQL vs Code
40. A top down approach
Tipically divide all requirements into single
features with a real business value
Nicola Junior Vitto 40 SQL vs Code
41. A top down approach
Code every single feature
from start to end...
Presentation layer
Business layer
Data Model
Nicola Junior Vitto 41 SQL vs Code
42. A top down approach
Code every single feature
from start to end...
Presentation layer
Business layer
Data Model
Can start from tests
before coding
Nicola Junior Vitto 42 SQL vs Code
43. A top down approach
...also the data model that solves
the actual “problem”
Nicola Junior Vitto 43 SQL vs Code
44. Grazie
Nicola Junior Vitto
njvitto@njvitto.com
http://www.njvitto.com
http://twitter.com/njvitto
http://friendfeed.com/njvitto
http://it.linkedin.com/in/nicolajuniorvitto
Nicola Junior Vitto 44 SQL vs Code