This document provides information about a course on design patterns taught by Dr. Asma Cherif. It includes the course code, instructor details, learning objectives, textbooks, and topics that will be covered such as architectural design, what patterns are, and different types of patterns. Design patterns provide solutions to common software design problems and promote reuse of successful designs. The course aims to help students understand design patterns, identify patterns in code and designs, and implement patterns to design and develop quality software applications.
Je vous partage l'un des présentations que j'ai réalisé lorsque j'étais élève ingénieur pour le module 'Anglais Business ' , utile pour les étudiants souhaitant préparer une présentation en anglais sur les Design Pattern - ou les patrons de conception .
Je vous partage l'un des présentations que j'ai réalisé lorsque j'étais élève ingénieur pour le module 'Anglais Business ' , utile pour les étudiants souhaitant préparer une présentation en anglais sur les Design Pattern - ou les patrons de conception .
Design patterns are optimized, reusable solutions to the programming problems that we encounter every day. A design pattern is not a class or a library that we can simply plug into our system; it's much more than that. It is a template that has to be implemented in the correct situation. It's not language-specific either. A good design pattern should be implementable in most—if not all—languages, depending on the capabilities of the language. Most importantly, any design pattern can be a double-edged sword— if implemented in the wrong place, it can be disastrous and create many problems for you. However, implemented in the right place, at the right time, it can be your savior.
YouTube Link: https://youtu.be/C_oPLDaSy-8
**Java, J2EE & SOA Certification Training - https://www.edureka.co/java-j2ee-training-course **
This Edureka PPT on "design patterns in java" will provide you with detailed knowledge about Java Design Patterns and along with it, This PPT will also cover some real-time examples of some important Design Patterns in Java, in order to provide you with a deep understanding about their functionality. This PPT will cover the following topics:
Why do we need Design Patterns?
What are Design Patterns?
Structure of a Design Pattern
Types of Design Patterns
Creational Design Pattern
Structural Design Pattern
Behavioural Design Pattern
JEE Design Pattern
Overview of design patterns
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
Domain Driven Design main concepts
This presentation is a summary of the book "Domain Driven Design" from InfoQ.
Here is the link: http://www.infoq.com/minibooks/domain-driven-design-quickly
Design patterns are optimized, reusable solutions to the programming problems that we encounter every day. A design pattern is not a class or a library that we can simply plug into our system; it's much more than that. It is a template that has to be implemented in the correct situation. It's not language-specific either. A good design pattern should be implementable in most—if not all—languages, depending on the capabilities of the language. Most importantly, any design pattern can be a double-edged sword— if implemented in the wrong place, it can be disastrous and create many problems for you. However, implemented in the right place, at the right time, it can be your savior.
YouTube Link: https://youtu.be/C_oPLDaSy-8
**Java, J2EE & SOA Certification Training - https://www.edureka.co/java-j2ee-training-course **
This Edureka PPT on "design patterns in java" will provide you with detailed knowledge about Java Design Patterns and along with it, This PPT will also cover some real-time examples of some important Design Patterns in Java, in order to provide you with a deep understanding about their functionality. This PPT will cover the following topics:
Why do we need Design Patterns?
What are Design Patterns?
Structure of a Design Pattern
Types of Design Patterns
Creational Design Pattern
Structural Design Pattern
Behavioural Design Pattern
JEE Design Pattern
Overview of design patterns
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
Domain Driven Design main concepts
This presentation is a summary of the book "Domain Driven Design" from InfoQ.
Here is the link: http://www.infoq.com/minibooks/domain-driven-design-quickly
This ppt covers the following topics :-
Introduction
Design quality
Design concepts
The design model
Thus it covers design engineering in software engineering
This is take two of the presentation, some things added, some removed, but still the regurgitation is best..
The purpose is to raise your awareness of software architecture in light of modern day agile development. Disciplines to incorporate and reconsider
Design and Implementation in Software EngineeringKourosh Sajjadi
These slides were presented to the software engineering class held in IAUN. The main context is provided from the "Software Engineering" book authored by Sommerville.
Most of the icons used in the slides are provided in the flaticon.com website.
Thanks to our professor Habib Seifzadeh.
A cooperation with Mohammad Mostajeran.
Software Development Life Cycle Models | What are Software Process Models ?
Here you are going to know What is Software Development Life Cycle Model or What are Software Process Models?
Software Process Models defines a distinct set of activities, actions, tasks, milestones, and work products that are required to engineer high-quality software...
For more knowledge watch full video...
Video URL:
https://youtu.be/3Lxnn0O3xaM
YouTube Channel URL:
https://www.youtube.com/channel/UCKVvceV1RGXLz0GeesbQnVg
Google+ Page URL:
https://plus.google.com/113458574960966683976/videos?_ga=1.91477722.157526647.1466331425
My Website Link:
http://appsdisaster.blogspot.com/
If you are interested in learning more about topics like this so Please don't forget to like, share, & Subscribe to this channel.
Thanks
Software Process Models | Software Development Process Models | SDLC | Traditional Software Process Models | Waterfall Model Incremental Model | Prototyping Model | Evolutionary Process Model
Similar to Design Patterns - General Introduction (20)
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
COVID-19 had an unprecedented impact on scientific collaboration. The pandemic and its broad response from the scientific community has forged new relationships among public health practitioners, mathematical modelers, and scientific computing specialists, while revealing critical gaps in exploiting advanced computing systems to support urgent decision making. Informed by our team’s work in applying high-performance computing in support of public health decision makers during the COVID-19 pandemic, we present how Globus technologies are enabling the development of an open science platform for robust epidemic analysis, with the goal of collaborative, secure, distributed, on-demand, and fast time-to-solution analyses to support public health.
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Hivelance Technology
Cryptocurrency trading bots are computer programs designed to automate buying, selling, and managing cryptocurrency transactions. These bots utilize advanced algorithms and machine learning techniques to analyze market data, identify trading opportunities, and execute trades on behalf of their users. By automating the decision-making process, crypto trading bots can react to market changes faster than human traders
Hivelance, a leading provider of cryptocurrency trading bot development services, stands out as the premier choice for crypto traders and developers. Hivelance boasts a team of seasoned cryptocurrency experts and software engineers who deeply understand the crypto market and the latest trends in automated trading, Hivelance leverages the latest technologies and tools in the industry, including advanced AI and machine learning algorithms, to create highly efficient and adaptable crypto trading bots
Large Language Models and the End of ProgrammingMatt Welsh
Talk by Matt Welsh at Craft Conference 2024 on the impact that Large Language Models will have on the future of software development. In this talk, I discuss the ways in which LLMs will impact the software industry, from replacing human software developers with AI, to replacing conventional software with models that perform reasoning, computation, and problem-solving.
Your Digital Assistant.
Making complex approach simple. Straightforward process saves time. No more waiting to connect with people that matter to you. Safety first is not a cliché - Securely protect information in cloud storage to prevent any third party from accessing data.
Would you rather make your visitors feel burdened by making them wait? Or choose VizMan for a stress-free experience? VizMan is an automated visitor management system that works for any industries not limited to factories, societies, government institutes, and warehouses. A new age contactless way of logging information of visitors, employees, packages, and vehicles. VizMan is a digital logbook so it deters unnecessary use of paper or space since there is no requirement of bundles of registers that is left to collect dust in a corner of a room. Visitor’s essential details, helps in scheduling meetings for visitors and employees, and assists in supervising the attendance of the employees. With VizMan, visitors don’t need to wait for hours in long queues. VizMan handles visitors with the value they deserve because we know time is important to you.
Feasible Features
One Subscription, Four Modules – Admin, Employee, Receptionist, and Gatekeeper ensures confidentiality and prevents data from being manipulated
User Friendly – can be easily used on Android, iOS, and Web Interface
Multiple Accessibility – Log in through any device from any place at any time
One app for all industries – a Visitor Management System that works for any organisation.
Stress-free Sign-up
Visitor is registered and checked-in by the Receptionist
Host gets a notification, where they opt to Approve the meeting
Host notifies the Receptionist of the end of the meeting
Visitor is checked-out by the Receptionist
Host enters notes and remarks of the meeting
Customizable Components
Scheduling Meetings – Host can invite visitors for meetings and also approve, reject and reschedule meetings
Single/Bulk invites – Invitations can be sent individually to a visitor or collectively to many visitors
VIP Visitors – Additional security of data for VIP visitors to avoid misuse of information
Courier Management – Keeps a check on deliveries like commodities being delivered in and out of establishments
Alerts & Notifications – Get notified on SMS, email, and application
Parking Management – Manage availability of parking space
Individual log-in – Every user has their own log-in id
Visitor/Meeting Analytics – Evaluate notes and remarks of the meeting stored in the system
Visitor Management System is a secure and user friendly database manager that records, filters, tracks the visitors to your organization.
"Secure Your Premises with VizMan (VMS) – Get It Now"
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?XfilesPro
Worried about document security while sharing them in Salesforce? Fret no more! Here are the top-notch security standards XfilesPro upholds to ensure strong security for your Salesforce documents while sharing with internal or external people.
To learn more, read the blog: https://www.xfilespro.com/how-does-xfilespro-make-document-sharing-secure-and-seamless-in-salesforce/
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
Data privacy is one of the most critical issues that businesses face. This presentation shares insights on the principles and best practices for ensuring the resilience and security of your workload.
Drawing on a real-life project from the HR industry, the various challenges will be demonstrated: data protection, self-healing, business continuity, security, and transparency of data processing. This systematized approach allowed to create a secure AWS cloud infrastructure that not only met strict compliance rules but also exceeded the client's expectations.
2. REFERENCES
Many resources have been used to build this course, if you notice any missing reference please
contact me at acherif@kau.edu.sa
• GoF book
• Laurent Audibert (developpez.com)
• Dr. Birgit Demuth (OCL)
• Dr. K.M Anderson
• Head First Collection
• Software engineering, Ian Sommerville, ch2- quality management
• www.newthinktank.com
• https://sourcemaking.com
• Derek Banas youtube channel
2
4. Course Objectives
1. Generate code from class diagrams and vice versa (i)
2. Identify any GoF creational design patterns for code or scenario or design (k)
3. Design and implement GoF creational design patterns (c)
4. Identify any GoF structural design patterns for code or scenario or design (k)
5. Design and implement GoF structural design patterns (c)
6. Identify any GoF behavioural design patterns for code or scenario or design (k)
7. Design and implement GoF behavioural design patterns (c)
8. Design and Implement an application that simulate a medium size project as part of a group (l)
9. Detect the appropriate design patterns in class diagrams (b)
10. Recognize the design patterns from code (k)
11. Produce a pattern based design that maps the requirements of a given scenario using design patterns
(k)
12. Implement code that maps the requirements of a given scenario or designs (c)
13. Evaluate the quality of software design using ISO25001 standard (m)
5. Textbooks
• Len Bass, Paul Clements, Rick Kazman, "Software
Architecture in Practice", Addison-Wesley
Professional; 2 edition (2003)
• Erich Gamma, John Vlissides, Ralph Johnson, and
Richard Helm, “Design Patterns: Elements of Reusable
Object-Oriented Software”, (1994)
5
6. DESIGN
Design - Analysis vs Design
- Structured vs OO Design
- Architectural Design -
Design Patterns
7. What is a design?
• Formulate the maximum alternative solutions
of the problem and select the best one.
• Design Possibilities :
Algorithmic strategy
Decomposition of a system
Abstract function hierarchy
7
8. 8
Types of design
Logical
Forms and
Reports
Interfaces and
Dialog
Physical
Creating
database, tables
and fields
Developing the
logic of the code
using the
algorithm
Hierarchical or
system structure
design
9. Why do we need design?
9
Provides an
overall picture of
the system
Allows us to
focus on one
thing at a time
Provides concept
reuse (NOT code
reuse)
Simplify
implementation
Assesses quality
10. Design &
quality
10
The design must implement all of the explicit (clear)
requirements contained in the analysis model, and
it must accommodate all of the implicit (hidden)
requirements desired by the customer.
The design must be a readable, understandable
guide for developers, code generators and testers.
The design should provide a complete picture of the
software.
12. Structured Vs OO design
12
Structured Design Object Oriented Design
Basic components functions/procedures classes which include state (behaviors) and functions
Component
relationships
one function calls other functions. One class uses other classes to help it fulfill its
responsibilities (by its methods calling methods in the other
classes)
Inheritance
Classes grouped into packages/subsystems
Design Strategy Top level function corresponds to program
requirements
Define this in terms of less abstract functions
Continue on down until all functions are
concrete
Refactoring: go back and re-design higher level
functions if design becomes ugly
Identify basic objects/concepts in application domain, and
use these as foundation classes
Select a design architecture
Add additional classes for desired functionality
Abstract out super classes to facilitate understanding and
possible reuse
Refactor as necessary
13. Analysis and Design
(What and How)
• The analysis model analyses
the problem in the problem
domain, while the design
model analyses the solution
in the solution domain.
16. What is a pattern?
• A pattern is a model or design used as a guide
in needlework and other crafts
• Synonymous:
• Sample, specimen, swatch
16
17. What is a
pattern?
17
Pattern is a structure or template that is designed
to provide solution of a specific problem.
“A pattern describes a problem which occurs over and over again in our
environment, and then describes the core of the solution to that problem,
in such a way that you can use this solution a million times over, without
ever doing it the same way twice.”- Christopher Alexander
A pattern is a recurring solution to a standard
problem, in a context.
18. Pattern-based Design
• A software designer begins with a
requirements model that presents an abstract
representation of the system.
• The requirements model describes the
problem set, establishes the context, and
identifies the system of forces.
18
19. Pattern-based design tasks
1. Examine the requirements model and develop a problem hierarchy.
2. Determine if a reliable pattern language has been developed for the problem
domain.
3. Beginning with a broad problem, determine whether one or more architectural
patterns are available for it.
4. Using the collaborations provided for the architectural pattern, examine
subsystem or component level problems and search for appropriate patterns to
address them.
5. Repeat steps 2 through 5 until all broad problems have been addressed.
19
20. Effective design pattern
A Design Pattern is effective when:
20
It solves a
problem
It is a proven
concept
The solution
isn't obvious
It describes a
relationship
Minimizes
human
intervention
22. Architectural Design
22
Is an early stage of the system design process.
It represents the link between specification and design processes.
It is often carried out in parallel with some specification activities.
Main objective: identifying the sub-systems making up a system and the framework for sub-system
control and communication.
Output: description of the software architecture.
24. MVC (Model – View -
Controller)
• MVC is an architectural
pattern used in software
engineering that separates
the application logic from
business logic.
• Used in web based
applications mainly
25. How MVC works?
• The user interacts with the UI
• (e.g., user presses a button)
• A controller handles the input event from
the user interface.
• The controller accesses the model, possibly
updating it in a way appropriate to the
user's action.
• The view uses the model to generate an
appropriate user interface
• (e.g., view produces a screen listing
the shopping cart contents).
• The view gets its own data from the model.
The model has no direct knowledge of the
view.
26. Common
Design
Mistakes
26
Not enough time has been spent to understand the
underlying problem, its context and forces, and as a
consequence, you select a pattern that looks right, but is
inappropriate for the solution required.
Once the wrong pattern is selected, you refuse to see your
error and force fit the pattern.
In other cases, the problem has forces that are not
considered by the pattern you’ve chosen, resulting in a poor
or wrong fit.
Sometimes a pattern is applied too exactly and the required
adaptations for your problem space are not implemented.
27. Design Patterns and OOP: why do we need
patterns?
• OO approach divides the application to smaller, simpler and reusable
entities.
• However, OO approach can complexify the application if the way you
divide your code does not follow any rule.
• Spagetti effect
• Ex: an application with 40000 lines of code, no architecture the application
can turn to be difficult to manage which leads to the emergence of bugs that
are difficult to correct (dominos effect)
• To avoid the problem another level of OO design should be followed
• Design patterns
27
28. What is a design pattern?
• Design pattern is a widely accepted solution to a recurring design problem
in OOP
• A design pattern describes how to structure classes to meet a given
requirement
• Provides a general blueprint to follow when implementing part of a
program
• Does not describe how to structure the entire application
• Does not describe specific algorithms
• Focuses on relationships between classes
• Made popular by Erich Gamma, Richard Helm, Ralph Johnson, and John
Vlissides (authors of design patterns: elements of reusable object-oriented
software)
28
29. 29
Benefits of design patterns
Learn from
community
wisdom
Determine
implementation
faster
Make code
more readable
to other
programmers
Give design
structures
explicit names
Facilitate
refactoring
30. Types of design patterns
Creational Patterns provide a way to create objects while hiding the creation logic, rather than
instantiating objects directly using new operator. This gives program more
flexibility in deciding which objects need to be created for a given use case.
Structural Patterns concern class and object composition. Concept of inheritance is used to
compose interfaces and define ways to compose objects to obtain new
functionalities.
Behavioral Patterns These design patterns are specifically concerned with communication
between objects.
30
32. OO Design review
32
The main concept in OOP is the
class.
A class groups data (attributes)
and treatments (methods).
A class is an abstraction describing
how objects act.
An object is an instance of a class.
• It is created in the run time with the new
operator.
Elements in OOP have a scope and
a visibility.
The visibility can be
private/public/protected/package
33. The 4 pillars of OOP
Abstraction Encapsulation
Polymorphism Inheritance
OOP
33
34. Class Diagram
• The most important diagram in OOD (obligatory).
• Use case Vs class:
• Use cases diagram illustrates the system according to actors point of view while
• The class diagram illustrates the internal structure of the system. It gives an abtract
representation of system objects that will intercat to accomplish uses cases.
• Gives a static view of the system.
• Main elements:
• Classes
• The relation between classes
• association
• generalization
• dependency
• realization
34
37. Methods
• Overloading (be careful the difference is not in the return type only)
• Class method : static method
• Cannot use instance variables (non static fields)
• Cannot call non static methods
• Abstract method: is not implemented
• A class that has at least one abstract
method should be declared abstract
37
abstract
abstract
*A subclass of an abstract superclass should be declared abstract if it does not implement the
abstract inherited methods
45. • A class can have a relationship with other classes.
• The main relation is the inheritance (generalization/specialization).
45
Person
Student Professor
superclass
subclasssubclass
generalization
specialization
Account
CheckingAccount
Inheritance
46. • A subclass inherits the fields and methods of the super class
• A subclass can add its own fields and methods (specialization)
• A subclass can redefine an inherited method (Overriding)
46
Account
CheckingAccount
Inheritance
47. • Some times you can’t implement all the details in the super class
• A superclass is abstract when it has at least one abstract method
(without implementation)
• The subclass should implement the abstract method (override)
47
Account
CheckingAccount
Inheritance
48. • An interface in java is a design of a class.
• It has static constants and abstract methods only.
• The interface allows to achieve fully abstraction: no method body.
• Allows multiple inheritance in Java.
• Java Interface also represents IS-A relationship.
• Interface cannot be instantiated like abstract class.
48
Printer
PrinterSetup
Realization
PrinterSetup
Printer
49. A class implements an interface, if the class is not abstract,
it should override the methods of the interface
49
Printer
PrinterSetup
Realization
PrinterSetup
Printer
50. • A class implements an interface
• A class extends a superclass
• An interface extends another interface
50
Printer
PrinterSetup
Realization
PrinterSetup
Printer
51. Printer
PrinterSetup
Realization
PrinterSetup
Printer
Abstract class Interface
1) Abstract class can have abstract and non- abstract
methods.
Interface can have only abstract methods.
2) Abstract class doesn't support multiple inheritance. Interface supports multiple inheritance.
3) Abstract class can have final, non-final, static and
non-static variables.
Interface has only static and final variables.
4) Abstract class can have static methods, main method
and constructor.
Interface can't have static methods, main method or
constructor.
5) Abstract class can provide the implementation of
interface.
Interface can't provide the implementation of abstract
class.
6) The abstract keyword is used to declare abstract class. The interface keyword is used to declare interface.
7) Example:
public class Shape{
public abstract void draw();
}
Example:
public interface Drawable{
void draw();
}
52
52. • The dependency means that class A uses class B, but that class A does
not contain an instance of class B as part of its own state.
• It also means that if class B’s interface changes it will likely impact
class A and require it to change.
• You would use dependency to indicate that:
• class A receives an instance of class B as a parameter to at least one of its
methods.
• class A creates an instance of class B local to one of its methods.
• You would not, however, use dependency to indicate that class A
declares an instance variable of class B.
53
Order PaymentSystem
Dependency
55. • An aggregation is a special kind of association
• Instance of aggregator (Library) contains a reference to an instance of
aggregated (Book) as part of the aggregator’s state, but the use of the
specific instance of the aggregated is or may be shared among other
aggregators (!= Library).
• A shared association means that the lifetime of the aggregated object
(the instance of Book), is outside the scope of the referencing object.
when a specific instance of the aggregator goes out of scope
(garbage collected), the instance of the aggregated does not necessarily
go out of scope.
56
Library
Book
Aggregation
59. Reverse Engineering
• Reverse Engineer existing Applications consists in generating UML
Models from source code (or binary files) to facilitate analysis,
enhancement, or reuse
• Hand-written or legacy source code can be difficult to understand.
• Some projects incorporate binary or byte-code files that also require
analysis.
• The original developer may no longer be available, or may be development
was assigned in pieces and no single individual knows the entire project.
60
61. OCL
• Developed at IBM in 1995 originally as a business engineering language
• Adopted as a formal specification language within UML
• Part of the official UML standard (from version 1.1 on)
• Used to complement UML diagrams
• Extends the Unified Modeling Language (UML)
• Formal language for the definition of constraints and queries on UML models
• Add precise semantics to visual (UML-) models
62
63. 64
“A constraint is a restriction on one or more values of (part
of) an object-oriented model or system.“
A constraint is formulated on the level of classes, but its semantics is
applied on the level of objects
originally formulated in the syntactic context of a UML model (i.e a set of
UML diagrams)
66. 1. Invariant
• An invariant is a constraint that should be true for an object during its
complete lifetime.
• Represents rules that should hold for the real-life objects after which the
software objects are modeled.
68. Examples
• context Meeting inv: self.end > self.start
• context Meeting inv: end > start
• context Meeting inv startEndConstraint: self.end > self.start
"self" always refers to the object identifier from
which the constraint is evaluated.
Names can be given to the constraint
69
69. Exercise
Write the OCL statement to specify that the age is greater than 18.
• Context Employee inv : age >18
• Context Employee inv : self.age >18
• Context Employee inv AgeCST: age >18
70
Employee
name: String
age: int
70. Precondition/Postcondition
71
Constraints that specify the applicability and effect of an
operation without stating an algorithm or implementation
Are attached to an operation in a class diagram
Allow a more complete specification of a system
71. 2. Precondition
• It is a constraint that must be true just prior to the execution of an operation
73. 3. Postcondition
• It is a constraint that must be true just after the execution of an operation
• Postconditions are the way how the actual effect of an operation is described in OCL.
75. Main Keywords
76
Result
• refers to the result of the
operation
• context
Meeting::duration():Integer
post: result = self.end –
self.start
@pre
• is to be evaluated in the
original state -- before
execution of the operation
• is only allowed in
postconditions
• context Meeting ::
shift(d:Integer) post:
start = start@pre +d and
end = end@pre + d
76. OCL Expressions
77
Boolean expressions
•Standard library of
primitive types and
associated operations
• Basic types: Boolean,
Integer, Real, String
Collection types
•Set
•Ordered Set
•Bag
•Sequence
77. User defined types (OCLType)
• Class type:
• A class has the following Features:
• Attributes (start)
• Operations (duration())
• Class attributes (Date::today )
• Class operations
• Association ends (navigation expressions)
• Enumeration type (e.g. Gender, Gender::male)
78
82. Navigation Expressions
• Association ends (role names) used to navigate from one object in the model to another
object.
• Navigations are treated as attributes (dot-Notation).
• The type of a navigation expression is either a
• User defined type (association end with multiplicity at most 1)
• Collection (association end with multiplicity > 1)
83
83. Example
User defined type
context Meeting context Meeting inv:
self.moderator.gender = Gender::female
Collection
context Meeting inv:
self->collect(participants)->size()>=2
self.participants
84
84. 85
And, or, =, <>
Logical and, or, equal and not equal
Context Person inv :
self.participants -> size()>2
85. 86
p implies q
True if either q is true or p is false
Context Person inv :
isDriver = true implies
age>=18
87. Exercise
• Specify the requirements:
• A vehicle owner age must be >=18 : Context vehicle inv: owner.age > = 18
• A car owner age must be >=18 :Context car inv: owner.age > = 18
• Nobody has more than 3 vehicles: Context Person inv: (fleet->size())<=3
• Calling birthday() increments the age of a person by 1:
Context Person :: Birthday() post: age = age@pre+1
90
89. What is Gang of Four (GOF)?
• In 1994, four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides
published a book titled Design Patterns - Elements of Reusable Object-Oriented
Software which initiated the concept of Design Pattern in Software development.
• These authors are known as Gang of Four (GOF).
• According to GOF design patterns are primarily based on:
• Program to an interface not an implementation
• Favor object composition over inheritance
92
90. Elements of Design Patterns
Design patterns have 4 essential elements:
• Pattern name: increases vocabulary of designers
• Problem: intent, context, when to apply
• Solution: UML-like structure, abstract code
• Consequences: results and tradeoffs
93
91. Describing Design Patterns
• Pattern Name and Classification: A descriptive and unique name that helps in identifying and referring to the pattern.
• Intent: A description of the goal behind the pattern and the reason for using it.
• Motivation (Forces): A scenario consisting of a problem and a context in which this pattern can be used.
• Applicability: Situations in which this pattern is usable; the context for the pattern.
• Structure: A graphical representation of the pattern. Class diagrams and Interaction diagrams may be used for this purpose.
• Participants: A listing of the classes and objects used in the pattern and their roles in the design.
• Collaboration: A description of how classes and objects used in the pattern interact with each other.
• Consequences: A description of the results, side effects, and tradeoffs caused by using the pattern.
• Implementation: A description of an implementation of the pattern; the solution part of the pattern.
• Sample Code: An illustration of how the pattern can be used in a programming language.
• Known Uses: Examples of real usages of the pattern.
• Related Patterns: Other patterns that have some relationship with the pattern; discussion of the differences between the pattern
and similar patterns.
94
92. Design Patterns are
95
Design Patterns are not
Data structures (i.e.,
linked lists, hash tables)
Complex domain-specific
designs (for an entire
application or subsystem)
93. What are they?
96
“Descriptions of communicating
objects and classes that are
customized to solve a general
design problem in a particular
context.”
94. Benefits of Design Patterns
• enable large-scale reuse of software architectures
• help to document systems
• explicitly capture expert knowledge and design tradeoffs and make it more widely available
• help improve developers communication
97
95. Classification of
design patterns
GF DP classification
purpose
creational
How to create objects while hiding the creation logic
Deal with initializing and configuring classes and objects
structural
Define ways to compose objects to obtain new functionalities.
Deal with decoupling interface and implementation of classes and objects
behavioral
Deal with dynamic interactions among societies of classes and objects
How they distribute responsibility
scope
class
Deal with relationships between classes and their subclasses
Relationships established through inheritance, so they are fixed at compile
time (static)
object
Deal with object relationships
Relationships can be changed at runtime (dynamic)
98
11
5
7
4
20
96. The Catalog of Design Patterns
99
Purpose
Scope
Creational Structural Behavioral
Class Factory Method Adapter(class) Interpreter
Template Method
Object Abstract Factory
Builder
Prototype
Singleton
Adapter (object)
Bridge
Composite
Decorator
Façade
Flyweight
Proxy
Chain of Responsibility
Command
Iterator
Mediator
Observer
State
Strategy
Visitor
97. Design Pattern Scope
• Class Patterns (4)
• Deal with relationships between classes and their subclasses
• Relationships established through inheritance, so they are fixed at
compile time (static)
• Object patterns (20)
• Deal with object relationships
• Relationships can be changed at runtime (dynamic)
100
98. General Introduction-Design
Six types of design patterns
1. Creational class patterns defer some part of object creation to subclasses
2. Creational object patterns defer some part of object creation to another object
3. Structural class patterns use inheritance to compose classes
4. Structural object patterns describe ways to assemble objects
5. Behavioral class patterns use inheritance to describe algorithms and flow of control
6. Behavioral object patterns describe how a group of objects cooperate to perform a task that no
single object can carry out alone 101
101. 104
The hard
part about
OO design is
decomposing
a system into
objects
Many factors are involved: encapsulation, granularity,
dependency, performance, evolution, reusability, etc.
Many objects come from the analysis model. But we often
end up with classes that has no counterpart in the real
world. Strict modeling of the world leads to a design that
reflect today’s need and not necessarily future.
Abstraction is a way to treat objects that do not have a
physical counterpart.
Design patterns help identify less
obvious abstractions and objects that
can capture them.
103. 106
How do we
decide
what
should be
an object?
In what
granularity?
Objects can vary in size and
numbers.
They can represent everything
(hardware entire application)
Design Patterns address this issue.
Example: Façade pattern describe
how to present complete
subsystems as objects.
105. 108
Interface? Interface = set of signatures, operation signature =
Name + return type + parameters
A type is name used to denote a particular interface
Interfaces are fundamental in OO systems
Objects are known only through their interfaces.
An object interface hides its
implementation
106. Design patterns help defining
interfaces by determining the
type of data that gets sent across
interfaces.
example: Memento pattern shows
objects must define two interfaces: a
restricted one that hold and copy
mementos and another one that only
original object can use to store and
retrieve state.
Design patterns specify
relationships between
interfaces.
108. 111
Implementation?
An object implementation is defined by its class.
Object instantiations, Class hierarchy,
inheritance, what should be the abstract classes
and what should be concrete classes, etc..?
Patterns such as Composite,
Abstract factory, chain of
responsibility address these issues.
110. 1st good design principle:
Program to an interface not
to an implementation
113
111. 114
Implementation? Class inheritance gives the ability to define new objects in terms of an old one.
Get identical interfaces by inheriting from an abstract class.
All classes derived from an abstract class simply override interfaces and
therefore they can all respond to the requests to the abstract class (i.e they are
all subtypes)
Two benefits:
1- clients remain unaware of the specific type of objects they
use.
2- clients remain unaware of the classes that implement these
objects
112. Consequences
of the 1st
principle
• Don’t declare variables to be
instances of concrete classes
since clients need only know the
abstract classes
• Creational patterns ensure that
your system is written in terms of
interfaces, not implementations.
115
114. Pros and Cons of inheritance
117
CLASS INHERITANCE IS EASY TO USE AND
EASY TO MODIFY (OVERRIDE)
CANNOT CHANGE IMPLEMENTATION AT
RUNTIME
(IT IS DEFINED AT COMPILE TIME)
WORSE IT BREAKS ENCAPSULATION
ANY CHANGE TO PARENT
IMPLEMENTATION WILL FORCE
SUBCLASSES TO CHANGE.
MAKES REUSE OF SUBCLASSES VERY
LIMITED.
117. Object
composition
120
Object Composition is defined dynamically at
runtime (unlike inheritance) through acquiring
references to other objects
does not break encapsulation
Any object can be replaced with another (of
same type) at runtime
so much less implementation dependency
119. Consequences
of the 2nd
principle
• Helps keep each class encapsulated
and focused on one task.
• Classes and class hierarchies will
remain small and more manageable.
• A design with composition will have
more objects and system behavior will
depend on their interrelationship
rather than defined in one class.
• Allow to delegate a request
122
121. 124
A WAY TO MAKING
COMPOSITION POWERFUL
FOR REUSE.
TWO OBJECTS ARE
INVOLVED IN HANDLING A
REQUEST
ONE OBJECT RECEIVES THE
REQUEST, AND DELEGATES
THE REQUEST TO BE
HANDLED BY ITS DELEGATE.
122. Example: Window and Rectangle objects
125
instead of using inheritance, by defining window as being a
rectangle, it can have a rectangle as attribute
124. 127
Delegation makes easy to compose behaviors at run-time (e.g. window
can become circle instead of rectangle, by simply replacing the instances if
they are the same type)
Dynamic, highly parameterized software is hard to read and understand.
Use composition as recommended by design patterns
128. Designing for Change
131
A DESIGN THAT DOES NOT TAKE
CHANGE INTO ACCOUNT RISKS A
MAJOR REDESIGN IN THE FUTURE.
EACH DESIGN PATTERN LETS SOME
ASPECT OF SYSTEM STRUCTURE
VARY INDEPENDENTLY OF THE
OTHER ASPECTS
MORE ROBUST SYSTEM TO A
PARTICULAR TYPE OF CHANGE.
130. 133
1. Creating an object by specifying a class explicitly
(committing to an implementation not to an interface)
• Solution: create an object indirectly;
• Examples: Abstract Factory, Factory Method, Prototype patterns
2. Dependence on specific operations. (committing to
one way of responding to a request)
• Solution: avoid hard-coded request;
• Examples: Chain of responsibility, Command patterns
131. 134
3. Dependence on hardware and software platform. Porting problem
from one platform to the other, different OS or different Hardware
• Solution: Design with no (limited) platform dependencies;
• Examples: Abstract factory and Bridge patterns
4. Dependence on object representations or implementations
• Solution: Hide this information from clients;
• Examples: Abstract Factory, Bridge, Memento, Proxy patterns
5. Algorithmic dependencies
• Solution: Algorithms must be isolated;
• Examples: Strategy, Builder, Iterator, Visitor and Template Method
132. 135
6. Tight coupling – Changes in one class requires changes in many
others.
• Solution: Loose coupling, abstract coupling and layering;
• Examples: Abstract Factory, Bridge, Chain of Responsibility, Command, Façade,
Mediator, Observer
7. Extending functionality by subclassing
• Solution: Object Composition and delegation;
• Examples: Composite, Decorator, Observer, Bridge, …
8. Inability to change classes (no access to source, commercial class
library)
• Solution: use Adapter, Decorator, and Visitor
Editor's Notes
ghmhn
1.AbstractionAbstraction is a process of exposing essential feature of an entitywhile hiding other irrelevant detail. Why would you want to use abstraction?abstraction reduces code complexity and at the same time it makes your aesthetically pleasant.
2.EncapsulationWe have to take in consideration that Encapsulation is somehow related to Data Hiding.Encapsulation is when you hide your modules internal data and all other implementation details/mechanismfrom other modules.it is also a way of restricting access to certain properties or component.Remember, Encapsulation is not data hiding, but Encapsulation leads to data hiding
3.InheritanceThe ability of creating a new classfrom an existing class.
Like ther word Inheritance literally means it is apractice of passing on property, titles, debts, rights and obligations upon the death of an individual.in OOP this is somehow true(Except the death of an individual) ,where The base class(the existing class sometimes called as the Parent class) has properties and methodsthat will be inherited by the sub class(somtimes called a subtype or child class) and it can have additional properties or methods.
Inheritance is also a way to use code of an existing objects.
4. PolymorphismJust like in biology, Polymorphism refers to the abilityto take into different forms or stages.A subclass can defineits own unique behaviour and still share the same functionalities or behavior of itsparent/base class.Yes, you got it right, subclass can have their own behavior and sharesome behaviour from its parent class BUT!! not vice versa. A parent class cannot have the behaviourof its subclass.
12down voteaccepted
A slash in front of an attribute means that the attribute is derived. The value of a derived attribute is calculated from the value of other model elemetns in the diagram. For instance, the accountBalance value can be derived from the list of payments and deposits made for that account (assuming that information about payments and deposits is stored in other classes in the diagram).
The derivation rule for a derived attribute (i.e. how to compute its value) can be specified in natural language or more formally in OCL
User defined type – Navigation from Meeting to moderator results in type Teammember
Collection – Navigation von Meeting to participants results in type Set(Teammember)
Context vehicle inv: owner.age > = 18
Context car inv: owner.age > = 18
Context Person inv: fleet->size()<=3
Context Person :: Birthday() post: age@pre = age@pre+1
does not break encapsulation because objects are accessed solely through interfaces (but that means some effort on good interface design)