Clean Code & Code Design

Kort om undervisningen

Code is read more often than it is written, that’s why keeping the code clean is very important part of creating maintainable and long living system. Consistency, naming rules, commenting habits, function organization, exception handling – all contribute to code readability and quality. Developers face code design and micro-architecture challenges during every coding day. Every programmer is a designer. Design patterns, code organization principles, dos and don’ts are covered in this intensive 2-day course.

Indhold

Understanding the impact of bad code

What does quality mean?

Read your code: names are everywhere

  • How to name variables, functions, classes

Code aesthetics

  • Be consistent
  • Formatting for readability
  • Break code into “paragraph”
  • Code organization

Comments

  • What NOT to comment
  • Show your intent
  • Put yourself in the reader’s shoes

Functions

  • One word: short!
  • Arguments and parameters
  • One level of abstraction
  • Don’t repeat yourself (DRY principle)
  • Dealing with exceptions

*Checked vs. Unchecked
*Why exception hierarchies matters
*Add content to your exceptions
*Centralize catching and logging

  • Execution flow (switch, conditions, nesting, variable scope)

Logging

Code design

  • Understand the problem first
  • Number one rule: simplicity
  • Data vs. Object
  • Law of Demeter
  • Design patterns: use and misuse
  • Classes

*Best practices for class design
*Be SOLID! The SOLID principles matters
*Cohesion and changeability

  • Design anti-patterns: stuff you’ll regret later
  • Use the right tool for the job: Functional vs. Procedural

Testing your code

  • Unreadable tests stink
  • Choosing good test input
  • Making error message readable
  • TDD actually works
  • Using mocks
  • Introducing BDD
  • Unit test automation and test coverage

Developer team communication & productivity

Forudsætninger

Students must have at least a few years of software development experience matching the level of

 

Målgruppe

Junior or senior developers looking to improve their code organization skills.

Efter kurset kan deltageren

  • Understand main principles behind clean code
  • Leverage knowledge of good design principles
  • Design system components and interactions for testability

Kontakt gerne Lund&Bendsen ved hjælp af vores kontaktformular eller ring til telefon (+45) 33 861 861 for at høre nærmere.