self reliant systems
DESCRIPTION
The code we produce in IT typically have the knowledge "up front", meaning that when the problems arise in production the original programmers aren't around anymore. In this session I propose an approach where we build more "business knowledge" into the code itself and not just settle for simplistic checks like "is there space on the hard disk".TRANSCRIPT
![Page 1: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/1.jpg)
JavaSelf Reliant Systems
Björn Granvik
![Page 2: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/2.jpg)
Self Reliant SystemsIn Code, In Process, In Moment
Björn GranvikCTO, Jayway
![Page 3: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/3.jpg)
Enclaimer
§ The information in this presentation has been painfully gathered through experience.
§ Events and characters are purely based on reality. However, names of the innocent and the guilty have been changed in order to be nice.
§ Programmers have been hurt during these experiments…
![Page 4: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/4.jpg)
Toyoda and His loom
30:1 - looms:personsStop the line!
![Page 5: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/5.jpg)
Our Reality?
Me
Project'sTest server
Test'sTest server
Stagingserver
Productionserver
Productionserver 2
Productionserver 3
LoadBalancing
Joe
Mr Smith
SAD
UCR
TES
GKW
Stop the line?
![Page 6: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/6.jpg)
Coding
Anything that changes the behavior of your system.
.properties"parameters"Admin console, tweaking the productionLoad balancers, pools, indexes, …
…programming
![Page 7: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/7.jpg)
The Problem
![Page 8: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/8.jpg)
The Guild
Stuck in craftsman mode Almost all parts are "made to order"
Impossible to replicate the systemImpossible to "know" the systemMonday morning – every morning, every dayIT medieval ages
![Page 9: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/9.jpg)
Symptom: Whazzup?
![Page 10: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/10.jpg)
Symptom: More Whazzup!
![Page 11: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/11.jpg)
Symptom: Running?
Q: How do you know if your system is working?
Surf to your web site/application.Try something. Does it work?Check memory/processes/portsCheck log filesCheck GKW
…now what? - Wake the programmer!
![Page 12: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/12.jpg)
Symptom: Compile?
BackupContinuous IntegrationContinuous Feature Creep…
Q: Five years on, does your code compile?
…now what?– Buy single malt, call the programmer!
![Page 13: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/13.jpg)
Symptom: Change Spec?
Search for keywords in codeCheck for unit tests…
Q: Changed specification – what do you do?
…now what? – Change and Pray.
![Page 14: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/14.jpg)
Why not analysis/reports?
Some are needed but...
Word etc cannot be verifiedAlmost all are wrongWe've tried that…
Exercise: Read any project document and see if it is correct.Conclusion: We cannot rely on them.
![Page 15: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/15.jpg)
Why not tools?
Only answers general questionsCatch 22The tooling industry Tool vs. product: 10x precision!
We – the IT Industry 2xs …Yeah right!
Exercise: Compile your colleagues project…Conclusion:
We must build our precision/knowledge into our components!
![Page 16: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/16.jpg)
Theory
![Page 17: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/17.jpg)
The Line …in theory
Any feedback oriented system will either adapt and succeed - or fail fast.
![Page 18: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/18.jpg)
The Component …in theory
![Page 19: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/19.jpg)
What to do …in theory
Build it inFeed it backPay it forward
![Page 20: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/20.jpg)
In Code
Word is Evil!“Coding" beyond developer's machine is Evil.
Put it all there into the componentSelf Testing Requirements Healing …
Component should adapt
![Page 21: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/21.jpg)
In Process
Not in process automatically forgottenAutomatic & repeatableFeedback Oriented
![Page 22: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/22.jpg)
In Moment
Do the job in the moment Where all knowledge is there All the developers are present
programmers, testers, business analysts, etc
Code like you will be gone after three iterations
![Page 23: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/23.jpg)
Examples
![Page 24: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/24.jpg)
NO!
Example -1: Where's that lib?
Yes
![Page 25: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/25.jpg)
Example 0: Logging
Trivial! But forgotten.Think "production and runtime", not just development
What to do: Use your favourite logging framework Log to correct level
Info – important info and state changes Debug – well, just debug info
Log appropriately per machine/situation/etc
![Page 26: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/26.jpg)
Example 1: Testing
Testing - from unit to acceptance level JUnit, TestNG DDSteps ...and many more
New: Deploy the code with this ability Self test in production
Use Case PingUCC – Use Case Coverage
![Page 27: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/27.jpg)
Example 2: Running?
Make it easy to decide if your system is up and runningNew: Is it installed properly? Is it up and running? Dead easy to spot a (non)working system! Easy to spot level of problem Less calls to second/third level of support
![Page 28: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/28.jpg)
Example 2: Running!
Use Case Ping
Process
Sockets
Memory
.
.
....
Dependent Systems
![Page 29: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/29.jpg)
Example 3: Dynamic Components
OSGi etcRuntime is conquered!Hot deploy in architecture, not just for monolithsEach module should contain: Function, i.e. Code (F) Logging (L) Health Check (HC) Tests (T)
From unit up to acceptance Use Case Ping and Use Case Coverage
Agile Requirements (AR) …
![Page 30: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/30.jpg)
Example 3: Dynamic Components "Screenshot"
A is-integration-tested with BA depends-on BA part-of B
foo
bar
My Phone
Gone
BigSystem
![Page 31: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/31.jpg)
Example 3: Dynamic Components cont'd
Metadata Runtime, test time, compile time dependencies Licenses Interface compatibility
Lots of it, but not usedCould be used for versioned build and development system meta info possibly machine searchable via POM, RDF etc Discovery mechanism for components ...
![Page 32: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/32.jpg)
Example 4: Agile Requirements
Nuked RequirementsImpossible to traceChanged req - Which code changed?
Do references Findable in code
Do 1:1 relationship Refactorable Codable/compilable Runtime support
![Page 33: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/33.jpg)
Example 4: AR Example
//REQ specB#123@requirement(uri="req:custA.prod3.specB#123")Still not in one place
Unit TestsRequirement, RequirementManager
![Page 34: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/34.jpg)
Example 4: AR Aspect
@Aspectpublic class ColorMustBe256Requirement {
@Around("execution(* se.jayway.color..foo(Color))")public Object invoke(ProceedingJoinPoint pjp)
throws Throwable{
// ...Do some check on Color
Object result = pjp.proceed();return result;
}}
![Page 35: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/35.jpg)
Self Reliant Systems
In CodeIn ProcessIn Moment
Build it inFeed it backDo it when you still can
![Page 36: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/36.jpg)
Self Reliant Systems
Q & A
![Page 37: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/37.jpg)
Remember! Enter the evaluation form and be a part of making Øredev even better.
You will automatically be part of the evening lottery
![Page 38: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/38.jpg)
![Page 39: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/39.jpg)
![Page 40: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/40.jpg)
![Page 41: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/41.jpg)
Self
//more
Based on the component, not on the tool
![Page 42: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/42.jpg)
Feedback speeds
Feedback Is crucial!
Fast Feedback Minutes Continuous integration
Furious Feedback Seconds Pair Programming Continuous Compilation (IDE)
The faster feedback, the faster success or failure
![Page 43: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/43.jpg)
Spot the Signs!
Java 6: Monitor and debug always "present" jhat – analyze heap jconsole …
Trifork P4, a profiler – use it in production//moreCustom monitoringSelf test
![Page 44: Self Reliant Systems](https://reader033.vdocuments.mx/reader033/viewer/2022052505/5560cb81d8b42a19088b4ba6/html5/thumbnails/44.jpg)
Codex Hammurabi
Hammurabi, King, Mesopotamia Circa 1700 BC
LawBoth law and houses still here