Federico Mengozzi

Introduction

Naming conventions

Just be consistent with the group coding style or just use tool to reformat

  • AStyle (C, Cpp, C#, Obj-C, Java)
  • Uncrustify (C/Cpp, C#, Obj-C, D, Java)
  • Universal Indent GUI
  • ClangFormat

Documentation tools

  • Doxygen (C, Cpp, Java) output in HTML, man, PDF, Latex
  • Javadoc (Java)

SOLID OOP Principle

  • S - Single Responsibility Principle (class should have a single responsibility)
  • O - Open/Close Principle (entities should be open for extension but closed for modification)
  • L - Liskov Substitution Principle (object should be replaceable with subtypes instances)
  • I - Interface Segregation Principle (many client-specific interface)
  • D - Dependency Inversion Principle (depend upon abstraction instead of concretions)

Version control system

Practice that tracks changes over source code and related files

Documentation (plain or in source code as comments)

  • addition are documented
  • deletion are just commented out
  • pros: simple and complete history
  • cons: no concurrency, no brunching, require effort from devs

Source duplication

  • pros: simple, maintains complete history, allow branches with subdirectories (hard to manage)
  • cons: no concurrency, many near identical copies of code

Revision control software

  • backup and restore
  • synchronization
  • short and long term undos
  • track chages
  • sandboxing (on your local system)
  • branching and merging

Test drive design

  • Write specification first (what the program is supposed to do)
  • Write the actual test for the program

How to operate

  1. Write or rewrite test
  2. check if tests fail (if so move to 3 else 1)
  3. write code
  4. check if all test pass
  5. if 4 pass then refactor, otherwise correct and refactor

Testing methods

Manual testing

  • Pro
    • specifically tailor the test procedure
    • doesn’t rely on external frameworks
  • Cons
    • time consuming
    • manually run program

Testing framework

  • Pro
    • already written and tested
    • easy and automated
    • integrated with compilation
    • continue event if some tests fails
  • Cons
    • external library dependency (but is fine)
    • not support cross languages
  • Examples
    • Googletest for C++
    • xUnit (JUnit, NUnit, OCUnit)

Mock frameworks

Dependency Injection and Inversion of Control

  • Pro
    • control behaviors of mocked obj
    • automated unit testing
  • Cons
    • may require additional abstracion layer
  • Examples
    • Googlemock
    • JMock
    • moQ

Continuos Integration Software

CI allows to

  • Automate build process
  • Run tests during build
  • Make build fast

Jenkins-Hudson

  • multiple build systems (CMake, Gradel, SCons)
  • multiple RCS systems (Github, Bitbucket)
  • multiple IDE (EClipse, NetBeans)

AppVeyor

  • supports multiple build systems
  • supports multiples RCS systems
Go to top