Search This Blog

Sunday, April 11, 2010

OSGi Evangelism and OO Design Principles

OSGi adds a higher layer of granularity to OO abstraction, information hiding, design by contract, etc. I like this quote  from Modular Mind: "Software development has advanced in large part by increasing the granularity of the aggregations that we have to work with.". In this presentation, Module Systems and Architectures, on OSGI, Martin Lippert also shows another evolution that can be seen in OSGi:


Good Old Design Principles
DIP SOC LSP ADP TDA DRY AIP
ISP SCP OCP IHP SRP SDP

New Design Principles
Use services ---> Separate between interface and implementation
Use extensions ---> working but extensible

Here's a breakdown of Martin's shortlist of "good old design principles":

Class Design Principle
  • Separation Of Concerns (SoC)
  • Tell, Don't Ask (TDA)
  • Don't Repeat Yourself (DRY)
  • Dependency Injection Principle (DIP)
  • Liskov Substitution Principle (LSP)
  • Open Closed Principle (OCP)
  • Single Responsibility Principle (SRP)
  • Interface Segregation Principle (ISP)

Package Design Principles
Cohesion Principles
  • Reuse/Release Equivalency Principle (REP)
  • Common Reuse Principle (CRP) 
  • Common Closure Principle (CCP)

Coupling Principles:
  • Acyclic Dependencies Principle (ADP)
  • Stable Dependencies Principle (SDP)
  • Stable Abstractions Principle (SAP)
  Object-Oriented Reengineering - Principles of OOD - Radu Marinescu,
  OO Design Principles - Stefan Kluth,

Tuesday, April 6, 2010

Emergent Design

TODO:

  • Tracer Bullet Development (see Ship It, ch. 4)
  • do light-weight, up front design, create a system of mock objects, and add appropriate automated tests
  • System Objects: Encapsulate and Separate 
  • incrementally add functionality to the system  
  • Incremental Improvements: Iterations
  • benefits: scalability, encapsulation, decoupled code, parallel code development, flexible to requirements creep

Monday, April 5, 2010

Static Code Analysis, Defect Detection, Code Smells, Architecture Smells, Dependency Analysis

FindBugs Descriptions
  • Bad Practice
  • Correctness
  • Experimental
  • Malicious Code Vulnerability
  • Multithreaded Correctness
  • Performance
  • Security
  • Dodgy Practices
PMD Rulesets

Lint4J checks for
JLint Program Checker
    Coverity Static Analysis, Dynamic Analysis , Architectural Analysis

    NASA's JPF (Java Path Finder)
    Which defects can be found by JPF? Out of the box, JPF can search for deadlocks and unhandled exceptions (e.g. NullPointerExceptions and AssertionErrors), but the user can provide own property classes, or write listener-extensions to implement other property checks. A number of such extensions, like race condition and heap bounds checks are included in the JPF distribution 

    Hammurabi Hammurapi is a code quality governance platform to mitigate risks of outsourcing* of software development.

    Structure 101

      Tuesday, March 23, 2010

      OSGi For Modularizing Large Projects

      OSGi helps establish good practices in software development by effectively applying at a macro level these good OO practices:
      • hide implementation details (design by interface contract)
      • minimize dependencies (high cohesion, low coupling)
      Declarative programming and in particular declarative services promote:
      • extensibility (e.g. wrapping a web server)
      • writing POJOs and using in a larger context
      Keeping the data model and visual representation separate promotes:
      • not writing too much from scratch
      • maintaining the reusability of core logic
      • allowing different app versions per audience
      • grow or shrink app

      Tuesday, March 9, 2010

      Messaging Patterns Used In CORBA

      • Synchronous with Timeout Method Invocation (SMI) – the client is blocked until a response is received from the server or a timeout occurs (client might spawn a thread so main thread is not blocked)
      • Asynchronous Method Invocation (AMI) – the client is not blocked but receives a callback from the server
      • One-way Method Invocation (OMI) – like AMI except no callback is received

      Friday, March 5, 2010

      Presentation And Diagramming Links

      Programmer Productivity Tips

      1. Use a modern IDE such as Eclipse.
      2. Content Assist (or Code Completion, tab completion, Intellisense, etc.)  Content assist provides you with a list of suggested completions for partially entered strings. In Eclipse type something in the editor window and then ctrl-space. (e.g in Eclipse: Preferences->Java->Editor->Content Assist->Advanced)
      3. Code Templates: For example, type sysout and then ctrl-space and it spits out System.out.println(); with the cursor in the right spot. Type "for" ctrl-space and get a for...loop, type "try" ctrl-space and get a try...catch block.  (Eclipse: Window->Preferences->Java->Editor->Templates) 
      4. Code Generation: Faster Java coding in Eclipse Galileo (IBM), Useful Eclipse Shortcuts (SO) , Eclipse Shortcuts (Vogella)
      5. Compiler Warnings: Using Eclipse Java Compiler Errors/Warnings – Improving your code quality, CheckStyle
      6. Syntax Highlighting
      7. Focus (i.e. turn off email, browser, im when possible)
      8. Google
      9. Dual Monitors
      10. Synergy lets you easily share a single mouse and keyboard between multiple computers with different operating systems
      11. Caffeine
      12. Debugger Java Debugging With Eclipse (Vogella)
      13. Sound isolating headphones
      14. Design Patterns
      15. XML Binding (no need to write DOM and SAX code any more)