This document discusses software development best practices, including object-oriented principles like encapsulation, inheritance, abstraction, and polymorphism. It also covers topics like class and module design with loose coupling and high cohesion, using appropriate access levels, writing self-explanatory methods, following coding standards, removing unused code, handling exceptions, and including understandable comments. The document provides guidance on general software engineering practices for object-oriented development.
3. Encapsulation
Public – Visible to all, Shared
members
Protected – Visible only through
inheritance
Default – Package level access
Private – Visible only within the
component
Rule: Protect variables by methods,
Limit and Control code access
5. Abstraction
A way to segregate implementation
from interface.
Achieved by using interface and
abstract class.
Use abstract class if you know the
common behaviour.
User interface when
implementation varies.
6. Polymorphism
Behaviour vary by type
Overloading – Object at compile
time
Overriding – Object at runtime
Super type Method Argument
Super type Variable
Return Super type
7. Class/Module
Loose Coupling – Interaction
through Simple Interface
High Cohesion – Reliability,
Reusability, Reduced maintenance
and modification costs.
Name – NOUN
Package – Should not contain
irrelevant classes
-cont.
8. Class/Modules
Use appropriate access levels.
Method – Self Explanatory. Use of
Java bean standards.
9. General
Use source control system.
Use coding standards – Variable,
Class, Method name, tabs,
brackets.
Delete unused code.
Catch specific exception.
Use understandable comments.
Coupling increases between two classes A and B if: A has an attribute that refers to (is of type) B . A calls on services of an object B . A has a method that references B (via return type or parameter). A is a subclass of (or implements) class B .