Software Development Project Kazi Masudul Alam
Course Objective Study Programming Best Practices Apply the knowledge to build a Small Software in Groups 7/10/2017 2
Programming Best Practices Code Formatting Comments Code Versioning System Object Oriented Design Design Pattern Architecture Pattern File/Folder Structure Documentation Project Management 7/10/2017 3
Code Formatting
Indentation Line Length Avoid lines longer than 80 characters, since they re not handled well by many terminals and tools. Wrapping Lines When an expression will not fit on a single line, break it according to these general principles: Break after a comma. Break before an operator. 7/10/2017 5
Declarations Number Per Line One declaration per line is recommended since it encourages commenting. 7/10/2017 6
Placement Put declarations only at the beginning of blocks. (A block is any code surrounded by curly braces { and }.) Don t wait to declare variables until their first use; it can confuse the unwary programmer and hamper code portability within the scope. 7/10/2017 7
Initialization Try to initialize local variables where they re declared. The only reason not to initialize a variable where it s declared is if the initial value depends on some computation occurring first. Class and Interface Declarations 7/10/2017 8
Statements Simple Statements Each line should contain at most one statement. return Statements if, if-else, if-else-if-else Statements 7/10/2017 9
Naming Conventions Naming conventions make programs more understandable by making them easier to read. They can also give information about the function of the identifier for example, whether it s a constant, package, or class which can be helpful in understanding the code. 7/10/2017 10
7/10/2017 11
Comments
Inline Commenting This is perfect to explain possibly confusing functionality. 7/10/2017 13
Descriptive Blocks When you need to include a large explanation generally a single liner won t do the trick. There are pre-formatted comment templates used in about every area of programming. Descriptive blocks are most notably seen around functions and library files. Whenever you setup a new function it is good practice to add a descriptive block above the declaration. 7/10/2017 14
Group/Class Comments The very top area of your page should hold comments regarding the file itself. In this way you can quickly check where you re editing when working on multiple pages at the same time. 7/10/2017 15
Code Versioning System
Version Control Revision control is a kind of practice that tracks and provides control over changes to source code. Software developers use revision control software to maintain documentation of change of source code. It is common for multiple versions of the same software to be deployed in different sites and for the software's developers to be working simultaneously on updates. Bugs or features of the software are often only present in certain versions. It may be necessary to develop two versions of the software concurrently. One version has bugs fixed, but no new features (branch), while the other 7/10/2017 version is where new features are worked on (trunk). 17
7/10/2017 18
Object Oriented Design
S.O.L.I.D S.O.L.I.D is an acronym for the first five objectoriented design(ood) principles by Robert C. Martin, popularly known as Uncle Bob. S Single-responsiblity principle O Open-closed principle L Liskov substitution principle I Interface segregation principle D Dependency Inversion Principle 7/10/2017 20
Single-responsibility Principle A class should have one and only one reason to change, meaning that a class should have only one job. 7/10/2017 21
7/10/2017 22
Open-closed Principle Objects or entities should be open for extension, but closed for modification. 7/10/2017 23
7/10/2017 24
Liskov substitution principle All this is stating is that every subclass/derived class should be substitutable for their base/parent class. 7/10/2017 25
7/10/2017 26
Interface segregation principle A client should never be forced to implement an interface that it doesn t use or clients shouldn t be forced to depend on methods they do not use. 7/10/2017 27
7/10/2017 28
Dependency Inversion principle Entities must depend on abstractions not on concretions. It states that the high level module must not depend on the low level module, but they should depend on abstractions. 7/10/2017 29
Design Pattern
Design Pattern Design pattern is a general repeatable solution to a commonly occurring problem in software design. Design patterns can speed up the development process by providing tested, proven development paradigms. Effective software design requires considering issues that may not become visible until later in the implementation. Reusing design patterns helps to prevent subtle issues that can cause major problems and improves code readability for coders and architects familiar with the patterns. 7/10/2017 31
Creational Design Patterns Singleton Factory Factory Method Abstract Factory Builder Prototype Object Pool 7/10/2017 32
Singleton When to use Singleton pattern should be used when we must ensure that only one instance of a class is created and when the instance must be available through all the code. A special care should be taken in multi-threading environments when multiple threads must access the same resources through the same singleton object. Common Usage There are many common situations when singleton pattern is used: - Logger Classes - Configuration Classes - Accesing resources in shared mode - Other design patterns implemented as Singletons: Factories and Abstract Factories, Builder, Prototype 7/10/2017 33
Lazy Singleton 7/10/2017 34
Behavioral Design Patterns Chain of Responsibility Command Interpreter Iterator Mediator Observer Strategy Template Method 7/10/2017 35
Template Method Define the skeleton of an algorithm in an operation, deferring some steps to subclasses / Template Method lets subclasses redefine certain steps of an algorithm without letting them to change the algorithm's structure. 7/10/2017 36
public class Trip { public final void performtrip(){ docomingtransport(); dodaya(); dodayb(); dodayc(); doreturningtransport(); } public abstract void docomingtransport(); public abstract void dodaya(); public abstract void dodayb(); public abstract void dodayc(); public abstract void doreturningtransport(); } public class PackageA extends Trip { public void docomingtransport() { System.out.println("The turists are comming by air..."); } public void dodaya() { System.out.println("The turists are visiting the aquarium..."); } public void dodayb() { System.out.println("The turists are going to the beach..."); } public void dodayc() { System.out.println("The turists are going to mountains..."); } public void doreturningtransport() { System.out.println("The turists are going home by air..."); } } public class PackageB extends Trip { public void docomingtransport() { System.out.println("The turists are comming by train..."); } public void dodaya() { System.out.println("The turists are visiting the mountain..."); } public void dodayb() { System.out.println("The turists are going to the beach..."); } public void dodayc() { System.out.println("The turists are going to zoo..."); } public void doreturningtransport() { System.out.println("The turists are going home by train..."); } } 7/10/2017 37
Structural Design Patterns Adapter Bridge Composite Decorator Facade Flyweight Memento Proxy 7/10/2017 38
Facade Facade pattern hides the complexities of the system and provides an interface to the client using which the client can access the system. This type of design pattern comes under structural pattern as this pattern adds an interface to existing system to hide its complexities. 7/10/2017 39
Software Architecture Pattern
Architecture Pattern Model-View-Controller Architecture 3-Tier Architecture Service Oriented Architecture 7/10/2017 41
MVC Pattern MVC Pattern stands for Model-View-Controller Pattern. This pattern is used to separate application's concerns. Model - Model represents an object or JAVA POJO carrying data. It can also have logic to update controller if its data changes. View - View represents the visualization of the data that model contains. Controller - Controller acts on both model and view. It controls the data flow into model object and updates the view whenever data changes. It keeps view and model separate. 7/10/2017 42
7/10/2017 43
7/10/2017 44
3-Tier Architecture A 3-tier architecture separates its tiers from each other based on the complexity of the users and how they use the data present in the database. It is the most widely used architecture to design a DBMS. Database 7/10/2017 45
Service Oriented Architecture 7/10/2017 46
File/Folder Structure
7/10/2017 48
7/10/2017 49
Documentation
How to Write Software Documentation Writing Software Documentation for Technical Users Determine what information needs to be included. Decide how much of the documentation should be within the program code and how much should be separate from it. Choose the appropriate documentation tool. Writing Software Documentation for End Users Determine the business reasons for your documentation. Understand the audience you're writing the documentation for. Determine the appropriate format(s) for the documentation. Decide what form(s) the documentation should take. Choose the appropriate documentation tool. Tools JIRA 7/10/2017 51
Project Management
Tools (Trello) 7/10/2017 53
Build Small Software Form 3 Person Group. Find a library to build. Apply Test Driven Development Approach. Build a class and its relevant functions and along with its test cases. 7/10/2017 54