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