Thursday, November 3, 2011

OO concept and software development practices

I attended a 5-day Design Pattern class last year, and the summary that I published then, was the initial thought of this k-db site. I am revising them and put them here. :)

Day 1 : OO concept and software development practices

  1. OO concept revised.
      • Normally these are discussed :
        1. inheritance
        2. composition
        3. encapsulation
        4. polymorphism
      • Discussed in class :
        1. abstraction
        2. encapsulation
        3. generalization
        4. specialization
  2. Type of errors
      • compilation
        1. syntax
        2. contextual
      • linking
      • runtime
      • logical
  3. Example to show the best way to code to avoid error :
      1. if (x == 0)
      2. if (0 == x) <– using this coding style, missing a "=" in the condition statement will alarm error during compilation.
  4. Why it is a good practice to use static for variable declaration?
      1. for information hiding.
      2. so people won’t use extern to access to it in other file, to ensure the value is not overwritten by unknown.
      3. error prone during linking.
  5. Software quality measurement :
      1. reusability : code, function, user experience (dialogue box/interface), software pattern can be used in more context
      2. standardization
      3. robustness
      4. time to market
      5. stability
  6. Memory problem :
      1. memory leaks –> needs to take care by programmer
      2. memory fragmentation –> this will be based on how the heap memory is used and allocated for dynamic objects
  7. Good programming practice to have these 2 behaviour
      • low coupling
        • less dependency
      • high cohesion
        • make it smaller functions thus high reusability.
  8. Single assignment of responsibility
      • design by contract
        1. pre condition : should be caller’s responsibility, so callee need not to check and throw exception.
        2. post condition : should be callee’s responsibility, so caller can assume the result return is OK

As an introduction to design pattern in software, there are 3 categories : creation, behavioural and structural. These will be in the next few posts.

No comments:

Post a Comment