SlideShare une entreprise Scribd logo
1  sur  10
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

Gozengo sauce presentation
Gozengo sauce presentationGozengo sauce presentation
Gozengo sauce presentation
Daniel Straus
 
Lighning Talk: PHP build process
Lighning Talk: PHP build processLighning Talk: PHP build process
Lighning Talk: PHP build process
Bryan Agee
 

Tendances (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
 

En vedette

Lightening Talk: definition of ready
Lightening Talk: definition of readyLightening Talk: definition of ready
Lightening Talk: definition of ready
Agileee
 
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
Phil van Dulm Consultancy
 
Definition Of Done
Definition Of DoneDefinition Of Done
Definition Of Done
Wei Zhu
 

En vedette (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
 

Similaire à 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
 
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
Theo 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 2012
Maxim Zaks
 
Writing Good Code
Writing Good CodeWriting Good Code
Writing Good Code
Leo Liang
 
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
elliando dias
 
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
 
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
Mike Harris
 
Solvcon PyCon APAC 2014
Solvcon PyCon APAC 2014Solvcon PyCon APAC 2014
Solvcon PyCon APAC 2014
weijr
 

Similaire à 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
 

Plus de intive

Clean architecture: Android
Clean architecture: AndroidClean architecture: Android
Clean architecture: Android
intive
 

Plus de 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
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Dernier (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

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