1/21
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
design pattern
a way of reusing abstract knowledge about a problem and its solution.
3 categories of design patterns
Creational
Structural
Behavioral
Creational (design pattern)
address problems of creating an object in a flexible way with separate creation, from operation/use
- singleton
- Factory Method
- Abstract Method
- Builder
Structural (design pattern)
address problems of using OOP constructs like inheritance to organize classes and objects into larger structures
- Adapter
- Bridge
- Composite
-Facade
Behavioral (design pattern)
define the communication and interaction between objects
- Command
- Observer
- Strategy
- Template Method
Elements of any design pattern
1. Name
▪ A meaningful pattern identifier.
2. Problem description
3. Solution description
▪ Not a concrete design but a template for a design solution that can be instantiated in different ways.
4. Consequences
▪ The results and trade-offs of applying the pattern
Facade Pattern
can be used to provide a unified interface to a complex set of database operations.
Usage Examples:
▪ Open Database Connectivity (ODBC)
▪ Java Database Connectivity (JDBC)
▪ Web services (RESTful API)
▪ Programmatic access to complexity of legacy systems (mainframe, transaction processing)
Decorator Pattern
can be used to add new functionality to existing GUI widgets without modifying their classes.
For example, a decorator could be used to add a border to a button or a scrollbar to a text box.
Usage Examples:
▪ Online car customization app
▪ An application that allows the user to dynamically build and /or change something (runtime vs compile time)
▪ Online shopping cart
Observer Pattern
can be used to implement a publish/subscribe system, where objects can subscribe to notifications from other objects.
Usage Examples:
▪ Stock market
▪ Conventional email delivery system
▪ Central logging system
▪ Ticket purchase system
Strategy Pattern
pattern can be used to implement different sorting algorithms in an application.
Usage Examples:
▪ Online payment system
▪ File compression application
▪ IDE application for multiple file types
User requirements
Statements in natural language plus diagrams of the services the system provides and its operational constraints.
Written for customers.
System requirements
A structured document setting out detailed descriptions of the system's functions, services and operational constraints.
Defines what should be implemented so written for developers and may be part of a contract between client and contractor.
Functional requirements
▪ Statements of services the system should provide, how the system should react to particular inputs and how the system should behave in particular situations.
▪ May state what the system should not do.
Non-functional requirements
▪ Constraints on the services or functions offered by the system such as timing constraints, constraints on the development process, standards, etc.
▪ Often apply to the system as a whole rather than individual features or services.
Benefits of code review
• Share knowledge
• Discover bugs early
• Maintain compliance
• Enhance security
• Increase team collaboration (cohesion)
• Improve quality of code
Main purpose of UML Sequence diagram
• Used to describe some interactions among different objects/actors in the software system.
• Capture dynamic behavior of a system.
• Describe the message flow of a system.
• Describe structural organization and interactions of objects
What is a scenario used in software design?
a description of how a system may be used for a particular task.
Purpose of a UML Class Diagram
1. Analysis and design
2. Describe responsibilities
3. Basis for deployment and component diagrams
Approaches to code review
1. Pair programming
2. Over the shoulder reviews
3. Tool-assisted reviews (version control)
4. Email passing around
5. Agile
Things to look for in code review
•Design: Is the code well-designed and appropriate for your system?
•Functionality: Does the code behave as the author likely intended? Is the way the code behaves good for its users?
•Complexity: Could the code be made simpler? Would another developer be able to easily
understand and use this code when they come across it in the future?
•Tests: Does the code have corrected and well-designed automated tests?
•Naming: Did the developer choose clear names for variables, classes, methods, etc.?
•Comments: Are the comments clear and useful?
•Style: Does the code follow our style guides?
•Documentation: Did the developer also update relevant documentation?
JavaDoc
a convenient, standard way to document your Java code.
a document generator tool in Java programming language for generating standard documentation in HTML format.
Benefit does JavaDoc give a program
• Program documentation creation is coupled with the programming process
• Automated generation of documentation: less error-prone
• Ease of generation of documentation
• Ease of update for documentation
• Short code-to-documentation cycle: all programmers can be made aware of others' developments almost in real time
• Can generate highly browsable documentation, accessible electronically over the web (HTML)