SlideShare a Scribd company logo
1 of 10
Download to read offline
Developer Job in Practice
Clean code rules • Code review • Refactoring
Kamil Kowalski
kamil.kowalski@blstream.com
2	
  
Being a developer
!  You	
  need	
  to	
  follow	
  the	
  rules,	
  wheter	
  
they	
  are	
  
!  You should ask the questions –
especially in case of doubts
!  You should learn new things: all
the time, always and also from
others
!  ... till end (of time)
Developer’s job is not only about
developing the code
!  It	
  would	
  be	
  great	
  to	
  have	
  a	
  leader:	
  	
  
!  to	
  learn	
  from	
  
!  to	
  follow 	
  	
  
!  You	
  are	
  the	
  team	
  player	
  	
  
!  You	
  work	
  with	
  legacy	
  systems	
  
3	
  
Typical project setup
!  Waterfall,	
  Agile,	
  ...	
  
!  How project is run:
!  Scrum
!  Kanban
!  Programin Mother*ker
!  Developing the code
!  Code first
!  TDD
!  „Who needs unit tests” / „We don’t
test our code” ☺
There is no one!
Each single project has its own setup!
!  Tools:	
  	
  
!  IDE	
  –	
  Xcode,	
  VS,	
  IntelliJ,	
  ...	
  
!  Repository:	
  SVN,	
  Git,	
  ...	
  
!  CI	
  environment:	
  Hudson,	
  	
  Jenkins,	
  
CC.NET,...	
  
!  Scripts:	
  Python,	
  MsBuild,	
  ANT,	
  
NANT,	
  ...	
  
!  SupporQng	
  tools:	
  R#,	
  StyleCop 	
  	
  
!  Review	
  Tool	
  
!  Project	
  board,	
  back	
  trucking:	
  JIRA	
  
!  Code	
  guide	
  
!  DefiniQon	
  of	
  Done	
  /	
  DefiniQon	
  of	
  
Ready	
  
!  Build	
  in	
  one	
  step	
  &	
  daily	
  builds	
  
4	
  
Definition of Done / Definition of Ready
!  DoD / DoR says about the rules
you need to follow during daily
work
!  Each developer in team need to
follow DoD – no exceptions!
!  Each team member need to
follow DoR – no exceptions!
!  Each single project has its own
DoD / DoR
DoD / DoR is our contract! !  Sample DoD:
!  All unit tests passed
!  All integration tests passed
!  No warnings in code (also warnings
from StyleCop)
!  Code coverage over 91%
!  Max cyclomatic complexity below 12
!  Build passed on CI server
!  Sample DoR:
!  Functionality working (all AC’s met)
!  Unit test written
!  Code approved by 2 other developers
!  QA accepted
!  Functionality available on CI staging
environment
!  Documentation updated
5	
  
Code smells
!  Duplicated Code
!  Long Method
!  Large Class
!  Long Parameter List / too many
of them
!  Switch Statement
!  Temporary Field
!  Magic numbers
!  Naming
!  Complex Conditionals
!  Dead code
If it stinks, change it! !  High quality code is:
!  Easy	
  to	
  read	
  and	
  understand	
  
!  Impossible	
  to	
  hide	
  bugs	
  
!  Easy	
  to	
  extend	
  
!  Easy	
  to	
  change	
  
!  Has	
  unit	
  tests	
  
	
  
!  Always code as if the guy who
ends up maintaining your code
will be a violent psychopath who
knows where you live.
public	
  class	
  Record_Base	
  
{	
  
	
  	
  	
  	
  public	
  DateTime	
  RecordDateTime	
  
	
  	
  	
  	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  get	
  {	
  return	
  _recordDateTime;	
  }	
  
	
  	
  	
  	
  	
  	
  	
  	
  set	
  	
  	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  {	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  if	
  (this.GetType().Name	
  ==	
  "Record_PartRegister") 	
  	
  _recordDateTime	
  =	
  value;	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  else	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  throw	
  new	
  ExcepQon("Cannot	
  call	
  set	
  on	
  RecordDateTime	
  for	
  table	
  "	
  +	
  this.GetType().Name);	
  
	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  	
  	
  	
  }	
  
}	
  
hp://thedailyw].com/ArQcles/Making-­‐Off-­‐With-­‐Your-­‐Inheritance.aspx	
  
This is not OOP!
KISS my DRY and SOLID code
7	
  
Simple rules for
developers – how to
write the code
!  Keep It Simple -
Stupid
!  Don’t Repeat
Yorself
!  Uncle Bob Clean
Code(r)
!  SOLID	
  principles:	
  	
  
!  Single	
  Responsibility	
  
Every	
  object	
  should	
  have	
  a	
  single	
  responsibility,	
  and	
  that	
  
responsibility	
  should	
  be	
  en7rely	
  encapsulated	
  by	
  the	
  class.	
  
!  Open	
  /	
  Closed	
  principle	
  
So:ware	
  en77es	
  (classes,	
  modules,	
  func7ons,	
  etc.)	
  should	
  be	
  open	
  
for	
  extension,	
  but	
  closed	
  for	
  modifica7on.	
  
!  Liskov	
  SubsQtuQon	
  
Objects	
  in	
  a	
  program	
  should	
  be	
  replaceable	
  with	
  instances	
  of	
  their	
  
subtypes	
  without	
  altering	
  the	
  correctness	
  of	
  that	
  program.	
  	
  
!  Interface	
  SegragaQon	
  
Clients	
  should	
  not	
  be	
  forced	
  to	
  depend	
  on	
  methods	
  they	
  do	
  not	
  use.	
  
!  Dependency	
  Inversion	
  
Abstrac7ons	
  should	
  not	
  depend	
  on	
  details.	
  	
  Details	
  should	
  depend	
  on	
  
abstrac7ons.	
  
8	
  
Code reviews
!  Can	
  catch	
  up	
  to	
  60%	
  of	
  defects	
  
!  EffecQve	
  code	
  reviews	
  are:	
  
!  Short	
  –	
  don’t	
  waste	
  Qme	
  
!  ConstrucQve	
  
!  Avoid	
  emoQonally	
  draining	
  arguments	
  	
  
!  Code	
  review	
  rules	
  depend	
  on	
  project	
  
you’re	
  working	
  on	
  -­‐	
  samples:	
  
!  Banking	
  system	
  	
  -­‐	
  SOLID,	
  security	
  	
  
!  NASA	
  	
  
!  Games	
  -­‐	
  opQmizaQon	
  ,	
  code	
  efficiency,	
  don’t	
  
care	
  about	
  excepQons	
  	
  
!  Mobile	
  applicaQon	
  –	
  SOLID,	
  but	
  efficiency	
  
	
  
Everybody reviews and everybody is
reviewed.
!  Rules:	
  
!  Syntax	
  !	
  
!  Code	
  Style	
  –	
  be	
  project	
  StyleCop	
  
(naming)	
  
!  Simplicity	
  
!  DRY	
  violaQons	
  
!  SOLID	
  violaQons	
  
!  Security	
  –	
  buffers,	
  stack	
  overflow,	
  input	
  
dfata	
  sanity	
  (trust	
  no	
  one),	
  cross	
  
boarders	
  (SQL	
  injecQon,	
  XSS)	
  
!  Memory	
  leaks	
  
!  OpQmizaQon	
  -­‐	
  code	
  efficiency	
  
!  Strings	
  !	
  
	
  
9	
  
Why should I refactor?
!  Technical	
  what?!	
  -­‐	
  is	
  a	
  metaphor:	
  
	
  
!  doing	
  things	
  the	
  quick	
  and	
  dirty	
  way	
  sets	
  us	
  up	
  
with	
  a	
  technical	
  debt,	
  which	
  is	
  similar	
  to	
  a	
  
financial	
  debt	
  
!  incurs	
  interest	
  payments,	
  which	
  come	
  in	
  the	
  
form	
  of	
  the	
  extra	
  effort	
  that	
  we	
  have	
  to	
  do	
  in	
  
future	
  development.	
  
!  Refactoring	
  is	
  changing	
  the	
  structure,	
  but	
  not	
  
the	
  funcQonality	
  of	
  your	
  applicaQon.	
  
	
  
Refactoring is our way of paying off
our “Technical Debt”
!  How	
  Should	
  I	
  Refactor:	
  
!  Ask	
  yourself	
  the	
  following	
  quesQons:	
  
!  Is	
  my	
  code	
  readable?	
  
!  Is	
  my	
  code	
  abstract?	
  
	
  
!  Anything	
  more	
  is	
  rearranging	
  the	
  deck	
  
chairs	
  on	
  the	
  Titanic:	
  
!  It	
  gives	
  you	
  a	
  sense	
  of	
  doing	
  something	
  
!  But	
  ulQmately	
  it’s	
  pointless	
  	
  #	
  
!  Follow	
  the	
  rules:	
  	
  
!  KISS	
  /	
  DRY	
  /	
  SOLID	
  
!  Clean	
  code	
  
!  Code	
  review	
  rules!	
  
	
  
•  Refactoring	
  catalogs:	
  
hp://www.refactoring.com/catalog/index.html	
  	
  
•  Refactoring	
  (book)	
  
hp://www.amazon.co.uk/Refactoring-­‐Improving-­‐Design-­‐
ExisQng-­‐Technology/dp/0201485672/ref=sr_1_1?
ie=UTF8&s=books&qid=1246371771&sr=8-­‐1	
  	
  
Resources

More Related Content

What's hot

Behaviour Driven Development Hands-on
Behaviour Driven Development Hands-onBehaviour Driven Development Hands-on
Behaviour Driven Development Hands-onHemmerling
 
A walkthrough of JavaScript ES6 features
A walkthrough of JavaScript ES6 featuresA walkthrough of JavaScript ES6 features
A walkthrough of JavaScript ES6 featuresMichal Juhas
 
Test Driven Development (TDD) with Windows PowerShell
Test Driven Development (TDD) with Windows PowerShellTest Driven Development (TDD) with Windows PowerShell
Test Driven Development (TDD) with Windows PowerShellHemmerling
 
Vagrant and Docker
Vagrant and DockerVagrant and Docker
Vagrant and DockerNascenia IT
 
Test your user interface using BDD (Swedish)
Test your user interface using BDD (Swedish)Test your user interface using BDD (Swedish)
Test your user interface using BDD (Swedish)Evolve
 
TDC2016POA | Trilha DevOps - DevOps Anti-Patterns
TDC2016POA | Trilha DevOps - DevOps Anti-PatternsTDC2016POA | Trilha DevOps - DevOps Anti-Patterns
TDC2016POA | Trilha DevOps - DevOps Anti-Patternstdc-globalcode
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplateStanislav Petrov
 
Gozengo sauce presentation
Gozengo sauce presentationGozengo sauce presentation
Gozengo sauce presentationDaniel Straus
 
Lighning Talk: PHP build process
Lighning Talk: PHP build processLighning Talk: PHP build process
Lighning Talk: PHP build processBryan Agee
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous IntegrationJoseph Wang
 
Advantages and disadvantages of a monorepo
Advantages and disadvantages of a monorepoAdvantages and disadvantages of a monorepo
Advantages and disadvantages of a monorepoIanDavidson56
 
Pipeline as code for your infrastructure as Code
Pipeline as code for your infrastructure as CodePipeline as code for your infrastructure as Code
Pipeline as code for your infrastructure as CodeKris Buytaert
 
INTEGRATING DIFFERENT IDE’S WITH A COMMON SET OF DEVELOPER SERVICES WITH A C...
INTEGRATING DIFFERENT IDE’S WITH A COMMON SET OF DEVELOPER SERVICES  WITH A C...INTEGRATING DIFFERENT IDE’S WITH A COMMON SET OF DEVELOPER SERVICES  WITH A C...
INTEGRATING DIFFERENT IDE’S WITH A COMMON SET OF DEVELOPER SERVICES WITH A C...Willy Marroquin (WillyDevNET)
 

What's hot (20)

Behaviour Driven Development Hands-on
Behaviour Driven Development Hands-onBehaviour Driven Development Hands-on
Behaviour Driven Development Hands-on
 
A walkthrough of JavaScript ES6 features
A walkthrough of JavaScript ES6 featuresA walkthrough of JavaScript ES6 features
A walkthrough of JavaScript ES6 features
 
Test Driven Development (TDD) with Windows PowerShell
Test Driven Development (TDD) with Windows PowerShellTest Driven Development (TDD) with Windows PowerShell
Test Driven Development (TDD) with Windows PowerShell
 
Vagrant and Docker
Vagrant and DockerVagrant and Docker
Vagrant and Docker
 
Sonarqube + Docker
Sonarqube + DockerSonarqube + Docker
Sonarqube + Docker
 
Test your user interface using BDD (Swedish)
Test your user interface using BDD (Swedish)Test your user interface using BDD (Swedish)
Test your user interface using BDD (Swedish)
 
TDC2016POA | Trilha DevOps - DevOps Anti-Patterns
TDC2016POA | Trilha DevOps - DevOps Anti-PatternsTDC2016POA | Trilha DevOps - DevOps Anti-Patterns
TDC2016POA | Trilha DevOps - DevOps Anti-Patterns
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
 
Gozengo sauce presentation
Gozengo sauce presentationGozengo sauce presentation
Gozengo sauce presentation
 
Continuous operations in AWS
Continuous operations in AWSContinuous operations in AWS
Continuous operations in AWS
 
Unit Testing TypeScript
Unit Testing TypeScriptUnit Testing TypeScript
Unit Testing TypeScript
 
Lighning Talk: PHP build process
Lighning Talk: PHP build processLighning Talk: PHP build process
Lighning Talk: PHP build process
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
 
Advantages and disadvantages of a monorepo
Advantages and disadvantages of a monorepoAdvantages and disadvantages of a monorepo
Advantages and disadvantages of a monorepo
 
Pipeline as code for your infrastructure as Code
Pipeline as code for your infrastructure as CodePipeline as code for your infrastructure as Code
Pipeline as code for your infrastructure as Code
 
TDD with Spock @xpdays_ua
TDD with Spock @xpdays_uaTDD with Spock @xpdays_ua
TDD with Spock @xpdays_ua
 
Mono Repo
Mono RepoMono Repo
Mono Repo
 
INTEGRATING DIFFERENT IDE’S WITH A COMMON SET OF DEVELOPER SERVICES WITH A C...
INTEGRATING DIFFERENT IDE’S WITH A COMMON SET OF DEVELOPER SERVICES  WITH A C...INTEGRATING DIFFERENT IDE’S WITH A COMMON SET OF DEVELOPER SERVICES  WITH A C...
INTEGRATING DIFFERENT IDE’S WITH A COMMON SET OF DEVELOPER SERVICES WITH A C...
 
Master the Monorepo
Master the MonorepoMaster the Monorepo
Master the Monorepo
 
Monorepo at Pinterest
Monorepo at PinterestMonorepo at Pinterest
Monorepo at Pinterest
 

Viewers also liked

Working effectively with user stories
Working effectively with user storiesWorking effectively with user stories
Working effectively with user storiesKen Power
 
Value Stream Manager concept applied to Software Product Development
Value Stream Manager concept applied to Software Product DevelopmentValue Stream Manager concept applied to Software Product Development
Value Stream Manager concept applied to Software Product DevelopmentKen Power
 
Definition of done training
Definition of done trainingDefinition of done training
Definition of done trainingMonica Yap
 
Lightening Talk: definition of ready
Lightening Talk: definition of readyLightening Talk: definition of ready
Lightening Talk: definition of readyAgileee
 
Db workshop - art of story splitting and writting
Db  workshop - art of story splitting and writtingDb  workshop - art of story splitting and writting
Db workshop - art of story splitting and writtingPhil van Dulm Consultancy
 
Jak technika user story & acceptance criteria pozwala definiować wymagania w ...
Jak technika user story & acceptance criteria pozwala definiować wymagania w ...Jak technika user story & acceptance criteria pozwala definiować wymagania w ...
Jak technika user story & acceptance criteria pozwala definiować wymagania w ...Rafal Stanczak »scrumdo(.)pl
 
Definition Of Done
Definition Of DoneDefinition Of Done
Definition Of DoneWei Zhu
 
Definition of Ready (XP2011)
Definition of Ready (XP2011)Definition of Ready (XP2011)
Definition of Ready (XP2011)Ken Power
 
Zoom sur le Métier de Développeur
Zoom sur le Métier de DéveloppeurZoom sur le Métier de Développeur
Zoom sur le Métier de DéveloppeurANAPEC
 
Métiers de l'informatique
Métiers de l'informatiqueMétiers de l'informatique
Métiers de l'informatiquehatimydriss
 

Viewers also liked (11)

Definition of ready
Definition of readyDefinition of ready
Definition of ready
 
Working effectively with user stories
Working effectively with user storiesWorking effectively with user stories
Working effectively with user stories
 
Value Stream Manager concept applied to Software Product Development
Value Stream Manager concept applied to Software Product DevelopmentValue Stream Manager concept applied to Software Product Development
Value Stream Manager concept applied to Software Product Development
 
Definition of done training
Definition of done trainingDefinition of done training
Definition of done training
 
Lightening Talk: definition of ready
Lightening Talk: definition of readyLightening Talk: definition of ready
Lightening Talk: definition of ready
 
Db workshop - art of story splitting and writting
Db  workshop - art of story splitting and writtingDb  workshop - art of story splitting and writting
Db workshop - art of story splitting and writting
 
Jak technika user story & acceptance criteria pozwala definiować wymagania w ...
Jak technika user story & acceptance criteria pozwala definiować wymagania w ...Jak technika user story & acceptance criteria pozwala definiować wymagania w ...
Jak technika user story & acceptance criteria pozwala definiować wymagania w ...
 
Definition Of Done
Definition Of DoneDefinition Of Done
Definition Of Done
 
Definition of Ready (XP2011)
Definition of Ready (XP2011)Definition of Ready (XP2011)
Definition of Ready (XP2011)
 
Zoom sur le Métier de Développeur
Zoom sur le Métier de DéveloppeurZoom sur le Métier de Développeur
Zoom sur le Métier de Développeur
 
Métiers de l'informatique
Métiers de l'informatiqueMétiers de l'informatique
Métiers de l'informatique
 

Similar to Developer Job in Practice

20191116 DevFest 2019 The Legacy Code came to stay (El legacy vino para queda...
20191116 DevFest 2019 The Legacy Code came to stay (El legacy vino para queda...20191116 DevFest 2019 The Legacy Code came to stay (El legacy vino para queda...
20191116 DevFest 2019 The Legacy Code came to stay (El legacy vino para queda...Antonio de la Torre Fernández
 
How to write good quality code
How to write good quality codeHow to write good quality code
How to write good quality codeHayden Bleasel
 
Code quality par Simone Civetta
Code quality par Simone CivettaCode quality par Simone Civetta
Code quality par Simone CivettaCocoaHeads France
 
Test Driven Development - Workshop
Test Driven Development - WorkshopTest Driven Development - Workshop
Test Driven Development - WorkshopAnjana Somathilake
 
Clean Code Part III - Craftsmanship at SoCal Code Camp
Clean Code Part III - Craftsmanship at SoCal Code CampClean Code Part III - Craftsmanship at SoCal Code Camp
Clean Code Part III - Craftsmanship at SoCal Code CampTheo Jungeblut
 
How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....Mike Harris
 
Test Essentials @mdevcon 2012
Test Essentials @mdevcon 2012Test Essentials @mdevcon 2012
Test Essentials @mdevcon 2012Maxim Zaks
 
Writing Good Code
Writing Good CodeWriting Good Code
Writing Good CodeLeo Liang
 
Writing clean code in C# and .NET
Writing clean code in C# and .NETWriting clean code in C# and .NET
Writing clean code in C# and .NETDror Helper
 
Coder sans peur du changement avec la meme pas mal hexagonal architecture
Coder sans peur du changement avec la meme pas mal hexagonal architectureCoder sans peur du changement avec la meme pas mal hexagonal architecture
Coder sans peur du changement avec la meme pas mal hexagonal architectureThomas Pierrain
 
Rapid Application Development with Docker
Rapid Application Development with DockerRapid Application Development with Docker
Rapid Application Development with DockerNiklas Heidloff
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agilityelliando dias
 
Letter to a Junior Developer: The Engineering Side of Programming
Letter to a Junior Developer: The Engineering Side of ProgrammingLetter to a Junior Developer: The Engineering Side of Programming
Letter to a Junior Developer: The Engineering Side of ProgrammingLazar Kovacevic
 
Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Hannes Lowette
 
Bootstrapping iPhone Development
Bootstrapping iPhone DevelopmentBootstrapping iPhone Development
Bootstrapping iPhone DevelopmentThoughtWorks
 
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018Mike Harris
 
Solvcon PyCon APAC 2014
Solvcon PyCon APAC 2014Solvcon PyCon APAC 2014
Solvcon PyCon APAC 2014weijr
 

Similar to Developer Job in Practice (20)

20191116 DevFest 2019 The Legacy Code came to stay (El legacy vino para queda...
20191116 DevFest 2019 The Legacy Code came to stay (El legacy vino para queda...20191116 DevFest 2019 The Legacy Code came to stay (El legacy vino para queda...
20191116 DevFest 2019 The Legacy Code came to stay (El legacy vino para queda...
 
Integreation
IntegreationIntegreation
Integreation
 
How to write good quality code
How to write good quality codeHow to write good quality code
How to write good quality code
 
Code quality par Simone Civetta
Code quality par Simone CivettaCode quality par Simone Civetta
Code quality par Simone Civetta
 
Test Driven Development - Workshop
Test Driven Development - WorkshopTest Driven Development - Workshop
Test Driven Development - Workshop
 
Clean Code Part III - Craftsmanship at SoCal Code Camp
Clean Code Part III - Craftsmanship at SoCal Code CampClean Code Part III - Craftsmanship at SoCal Code Camp
Clean Code Part III - Craftsmanship at SoCal Code Camp
 
How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....
 
Test Essentials @mdevcon 2012
Test Essentials @mdevcon 2012Test Essentials @mdevcon 2012
Test Essentials @mdevcon 2012
 
Writing Good Code
Writing Good CodeWriting Good Code
Writing Good Code
 
Developer Efficiency
Developer EfficiencyDeveloper Efficiency
Developer Efficiency
 
Writing clean code in C# and .NET
Writing clean code in C# and .NETWriting clean code in C# and .NET
Writing clean code in C# and .NET
 
Coder sans peur du changement avec la meme pas mal hexagonal architecture
Coder sans peur du changement avec la meme pas mal hexagonal architectureCoder sans peur du changement avec la meme pas mal hexagonal architecture
Coder sans peur du changement avec la meme pas mal hexagonal architecture
 
Rapid Application Development with Docker
Rapid Application Development with DockerRapid Application Development with Docker
Rapid Application Development with Docker
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
 
Letter to a Junior Developer: The Engineering Side of Programming
Letter to a Junior Developer: The Engineering Side of ProgrammingLetter to a Junior Developer: The Engineering Side of Programming
Letter to a Junior Developer: The Engineering Side of Programming
 
Code detox
Code detoxCode detox
Code detox
 
Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®
 
Bootstrapping iPhone Development
Bootstrapping iPhone DevelopmentBootstrapping iPhone Development
Bootstrapping iPhone Development
 
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
 
Solvcon PyCon APAC 2014
Solvcon PyCon APAC 2014Solvcon PyCon APAC 2014
Solvcon PyCon APAC 2014
 

More from intive

Rok z Android MVVM
Rok z Android MVVMRok z Android MVVM
Rok z Android MVVMintive
 
Don't Forget About the Layout
Don't Forget About the LayoutDon't Forget About the Layout
Don't Forget About the Layoutintive
 
You Don't Need Dependency Injection
You Don't Need Dependency InjectionYou Don't Need Dependency Injection
You Don't Need Dependency Injectionintive
 
OWASP Open SAMM
OWASP Open SAMMOWASP Open SAMM
OWASP Open SAMMintive
 
Porównanie architektur MVVM i MVC (iOS)
Porównanie architektur MVVM i MVC (iOS)Porównanie architektur MVVM i MVC (iOS)
Porównanie architektur MVVM i MVC (iOS)intive
 
Wprowadzenie do CoreBluetooth
Wprowadzenie do CoreBluetoothWprowadzenie do CoreBluetooth
Wprowadzenie do CoreBluetoothintive
 
.Net anywhere
.Net anywhere.Net anywhere
.Net anywhereintive
 
Front end - advanced development for beginners
Front end - advanced development for beginnersFront end - advanced development for beginners
Front end - advanced development for beginnersintive
 
Kotlin, Spek and tests
Kotlin, Spek and testsKotlin, Spek and tests
Kotlin, Spek and testsintive
 
Patronage 2016 Windows 10 Warsztaty
Patronage 2016 Windows 10 WarsztatyPatronage 2016 Windows 10 Warsztaty
Patronage 2016 Windows 10 Warsztatyintive
 
Techniczna organizacja zespołu cz 2
Techniczna organizacja zespołu cz 2Techniczna organizacja zespołu cz 2
Techniczna organizacja zespołu cz 2intive
 
Techniczna organizacja zespołu
Techniczna organizacja zespołuTechniczna organizacja zespołu
Techniczna organizacja zespołuintive
 
Organizacja zespołu
Organizacja zespołuOrganizacja zespołu
Organizacja zespołuintive
 
Nie tylko C# - Ekosystem Microsoft dla programistów
Nie tylko C# - Ekosystem Microsoft dla programistówNie tylko C# - Ekosystem Microsoft dla programistów
Nie tylko C# - Ekosystem Microsoft dla programistówintive
 
[PL] MVP do MVVM - separacja warstw w aplikacji androidowej
[PL] MVP do MVVM - separacja warstw w aplikacji androidowej[PL] MVP do MVVM - separacja warstw w aplikacji androidowej
[PL] MVP do MVVM - separacja warstw w aplikacji androidowejintive
 
Tips & Tricks Android
Tips & Tricks AndroidTips & Tricks Android
Tips & Tricks Androidintive
 
Apple Watch - Getting Started
Apple Watch - Getting StartedApple Watch - Getting Started
Apple Watch - Getting Startedintive
 
Clean architecture: Android
Clean architecture: AndroidClean architecture: Android
Clean architecture: Androidintive
 
CoreLocation (iOS) in details
CoreLocation (iOS) in detailsCoreLocation (iOS) in details
CoreLocation (iOS) in detailsintive
 
Java Script - Object-Oriented Programming
Java Script - Object-Oriented ProgrammingJava Script - Object-Oriented Programming
Java Script - Object-Oriented Programmingintive
 

More from intive (20)

Rok z Android MVVM
Rok z Android MVVMRok z Android MVVM
Rok z Android MVVM
 
Don't Forget About the Layout
Don't Forget About the LayoutDon't Forget About the Layout
Don't Forget About the Layout
 
You Don't Need Dependency Injection
You Don't Need Dependency InjectionYou Don't Need Dependency Injection
You Don't Need Dependency Injection
 
OWASP Open SAMM
OWASP Open SAMMOWASP Open SAMM
OWASP Open SAMM
 
Porównanie architektur MVVM i MVC (iOS)
Porównanie architektur MVVM i MVC (iOS)Porównanie architektur MVVM i MVC (iOS)
Porównanie architektur MVVM i MVC (iOS)
 
Wprowadzenie do CoreBluetooth
Wprowadzenie do CoreBluetoothWprowadzenie do CoreBluetooth
Wprowadzenie do CoreBluetooth
 
.Net anywhere
.Net anywhere.Net anywhere
.Net anywhere
 
Front end - advanced development for beginners
Front end - advanced development for beginnersFront end - advanced development for beginners
Front end - advanced development for beginners
 
Kotlin, Spek and tests
Kotlin, Spek and testsKotlin, Spek and tests
Kotlin, Spek and tests
 
Patronage 2016 Windows 10 Warsztaty
Patronage 2016 Windows 10 WarsztatyPatronage 2016 Windows 10 Warsztaty
Patronage 2016 Windows 10 Warsztaty
 
Techniczna organizacja zespołu cz 2
Techniczna organizacja zespołu cz 2Techniczna organizacja zespołu cz 2
Techniczna organizacja zespołu cz 2
 
Techniczna organizacja zespołu
Techniczna organizacja zespołuTechniczna organizacja zespołu
Techniczna organizacja zespołu
 
Organizacja zespołu
Organizacja zespołuOrganizacja zespołu
Organizacja zespołu
 
Nie tylko C# - Ekosystem Microsoft dla programistów
Nie tylko C# - Ekosystem Microsoft dla programistówNie tylko C# - Ekosystem Microsoft dla programistów
Nie tylko C# - Ekosystem Microsoft dla programistów
 
[PL] MVP do MVVM - separacja warstw w aplikacji androidowej
[PL] MVP do MVVM - separacja warstw w aplikacji androidowej[PL] MVP do MVVM - separacja warstw w aplikacji androidowej
[PL] MVP do MVVM - separacja warstw w aplikacji androidowej
 
Tips & Tricks Android
Tips & Tricks AndroidTips & Tricks Android
Tips & Tricks Android
 
Apple Watch - Getting Started
Apple Watch - Getting StartedApple Watch - Getting Started
Apple Watch - Getting Started
 
Clean architecture: Android
Clean architecture: AndroidClean architecture: Android
Clean architecture: Android
 
CoreLocation (iOS) in details
CoreLocation (iOS) in detailsCoreLocation (iOS) in details
CoreLocation (iOS) in details
 
Java Script - Object-Oriented Programming
Java Script - Object-Oriented ProgrammingJava Script - Object-Oriented Programming
Java Script - Object-Oriented Programming
 

Recently uploaded

Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 

Recently uploaded (20)

DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 

Developer Job in Practice

  • 1. Developer Job in Practice Clean code rules • Code review • Refactoring Kamil Kowalski kamil.kowalski@blstream.com
  • 2. 2   Being a developer !  You  need  to  follow  the  rules,  wheter   they  are   !  You should ask the questions – especially in case of doubts !  You should learn new things: all the time, always and also from others !  ... till end (of time) Developer’s job is not only about developing the code !  It  would  be  great  to  have  a  leader:     !  to  learn  from   !  to  follow     !  You  are  the  team  player     !  You  work  with  legacy  systems  
  • 3. 3   Typical project setup !  Waterfall,  Agile,  ...   !  How project is run: !  Scrum !  Kanban !  Programin Mother*ker !  Developing the code !  Code first !  TDD !  „Who needs unit tests” / „We don’t test our code” ☺ There is no one! Each single project has its own setup! !  Tools:     !  IDE  –  Xcode,  VS,  IntelliJ,  ...   !  Repository:  SVN,  Git,  ...   !  CI  environment:  Hudson,    Jenkins,   CC.NET,...   !  Scripts:  Python,  MsBuild,  ANT,   NANT,  ...   !  SupporQng  tools:  R#,  StyleCop     !  Review  Tool   !  Project  board,  back  trucking:  JIRA   !  Code  guide   !  DefiniQon  of  Done  /  DefiniQon  of   Ready   !  Build  in  one  step  &  daily  builds  
  • 4. 4   Definition of Done / Definition of Ready !  DoD / DoR says about the rules you need to follow during daily work !  Each developer in team need to follow DoD – no exceptions! !  Each team member need to follow DoR – no exceptions! !  Each single project has its own DoD / DoR DoD / DoR is our contract! !  Sample DoD: !  All unit tests passed !  All integration tests passed !  No warnings in code (also warnings from StyleCop) !  Code coverage over 91% !  Max cyclomatic complexity below 12 !  Build passed on CI server !  Sample DoR: !  Functionality working (all AC’s met) !  Unit test written !  Code approved by 2 other developers !  QA accepted !  Functionality available on CI staging environment !  Documentation updated
  • 5. 5   Code smells !  Duplicated Code !  Long Method !  Large Class !  Long Parameter List / too many of them !  Switch Statement !  Temporary Field !  Magic numbers !  Naming !  Complex Conditionals !  Dead code If it stinks, change it! !  High quality code is: !  Easy  to  read  and  understand   !  Impossible  to  hide  bugs   !  Easy  to  extend   !  Easy  to  change   !  Has  unit  tests     !  Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
  • 6. public  class  Record_Base   {          public  DateTime  RecordDateTime          {                  get  {  return  _recordDateTime;  }                  set                        {                            if  (this.GetType().Name  ==  "Record_PartRegister")    _recordDateTime  =  value;                        else                                      throw  new  ExcepQon("Cannot  call  set  on  RecordDateTime  for  table  "  +  this.GetType().Name);                  }          }   }   hp://thedailyw].com/ArQcles/Making-­‐Off-­‐With-­‐Your-­‐Inheritance.aspx   This is not OOP!
  • 7. KISS my DRY and SOLID code 7   Simple rules for developers – how to write the code !  Keep It Simple - Stupid !  Don’t Repeat Yorself !  Uncle Bob Clean Code(r) !  SOLID  principles:     !  Single  Responsibility   Every  object  should  have  a  single  responsibility,  and  that   responsibility  should  be  en7rely  encapsulated  by  the  class.   !  Open  /  Closed  principle   So:ware  en77es  (classes,  modules,  func7ons,  etc.)  should  be  open   for  extension,  but  closed  for  modifica7on.   !  Liskov  SubsQtuQon   Objects  in  a  program  should  be  replaceable  with  instances  of  their   subtypes  without  altering  the  correctness  of  that  program.     !  Interface  SegragaQon   Clients  should  not  be  forced  to  depend  on  methods  they  do  not  use.   !  Dependency  Inversion   Abstrac7ons  should  not  depend  on  details.    Details  should  depend  on   abstrac7ons.  
  • 8. 8   Code reviews !  Can  catch  up  to  60%  of  defects   !  EffecQve  code  reviews  are:   !  Short  –  don’t  waste  Qme   !  ConstrucQve   !  Avoid  emoQonally  draining  arguments     !  Code  review  rules  depend  on  project   you’re  working  on  -­‐  samples:   !  Banking  system    -­‐  SOLID,  security     !  NASA     !  Games  -­‐  opQmizaQon  ,  code  efficiency,  don’t   care  about  excepQons     !  Mobile  applicaQon  –  SOLID,  but  efficiency     Everybody reviews and everybody is reviewed. !  Rules:   !  Syntax  !   !  Code  Style  –  be  project  StyleCop   (naming)   !  Simplicity   !  DRY  violaQons   !  SOLID  violaQons   !  Security  –  buffers,  stack  overflow,  input   dfata  sanity  (trust  no  one),  cross   boarders  (SQL  injecQon,  XSS)   !  Memory  leaks   !  OpQmizaQon  -­‐  code  efficiency   !  Strings  !    
  • 9. 9   Why should I refactor? !  Technical  what?!  -­‐  is  a  metaphor:     !  doing  things  the  quick  and  dirty  way  sets  us  up   with  a  technical  debt,  which  is  similar  to  a   financial  debt   !  incurs  interest  payments,  which  come  in  the   form  of  the  extra  effort  that  we  have  to  do  in   future  development.   !  Refactoring  is  changing  the  structure,  but  not   the  funcQonality  of  your  applicaQon.     Refactoring is our way of paying off our “Technical Debt” !  How  Should  I  Refactor:   !  Ask  yourself  the  following  quesQons:   !  Is  my  code  readable?   !  Is  my  code  abstract?     !  Anything  more  is  rearranging  the  deck   chairs  on  the  Titanic:   !  It  gives  you  a  sense  of  doing  something   !  But  ulQmately  it’s  pointless    #   !  Follow  the  rules:     !  KISS  /  DRY  /  SOLID   !  Clean  code   !  Code  review  rules!    
  • 10. •  Refactoring  catalogs:   hp://www.refactoring.com/catalog/index.html     •  Refactoring  (book)   hp://www.amazon.co.uk/Refactoring-­‐Improving-­‐Design-­‐ ExisQng-­‐Technology/dp/0201485672/ref=sr_1_1? ie=UTF8&s=books&qid=1246371771&sr=8-­‐1     Resources