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.
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.
Design Pattern: Factory Pattern
In Factory pattern, we create object without exposing the creation logic to the client and refer to newly created object using a common interface.
Blog Article: http://jyaasa.com/blog/factory-design-pattern-in-ruby/
Name : Prasoon Dadhich
USN : 1MS09IS069
CODE
#include <iostream>
using namespace std;
class Singleton
{
private:
static bool instanceFlag;
static Singleton *single;
Singleton()
{
//private constructor
}
public:
static Singleton* getInstance();
void method();
~Singleton()
{
instanceFlag = false;
}
};
bool Singleton::instanceFlag = false;
Singleton* Singleton::single = NULL;
Singleton* Singleton::getInstance()
{
if(! instanceFlag)
{
single = new Singleton();
instanceFlag = true;
return single;
}
else
{
return single;
}
}
void Singleton::method()
{
cout << "Method of the singleton class" << endl;
}
int main()
{
Singleton *sc1,*sc2;
sc1 = Singleton::getInstance();
sc1->method();
sc2 = Singleton::getInstance();
sc2->method();
return 0;
}
Explanation
If we create any object of this class then the static object (player) will be returned and assigned to the new object.
Finally only one object will be there. The point is not how many times something gets executed, the point is, that the work is done by a single instance of the the class. This is ensured by the class method Singleton::getInstance().
As you can see in the above code,Client can access any instance of the singleton only through the getInstance() method.Once an instance is created,the instanceFlag value becomes true and then any further objects pointers created will be given the reference to the same object that has been created.
Also,make sure you notice the presence of a private constructor.This ensures that no new objects of the class are created and that all the class pointers get the same reference to work on.
Design patterns are known as best practices that the programmer can use to solve common problems when designing an application or system.
Singelton Design Pattern
Factory Design Pattern
Builder Design Pattern
Strategy Design Pattern
Iterator Design Pattern
Observer Design Pattern
Prototype Design Pattern
Command Design Pattern
Decorator Pattern
Proxy Pattern
Adapter Pattern
Patterns and Anti-patterns
How to learn design patterns?
Categories of GoF patterns
The Fundamental theorem of software engineering
Real-world problems and how design patterns solve them with GoF structural patterns
in these slides i have explained the factory method design pattern. slides contains complete notes on this pattern from definition to implementation by code example.
Design patterns are known and tested solutions to common problem. In software engineering we constantly come across similar problems. The same problems or tasks need to be programmed again and again, hence patterns. Design patterns catalog and document these solutions.They are built on industry knowledge of what works and why. We will look at what design patterns are, their history and the structure of documenting patterns.
As an example we look at the Observer pattern.
We will also look at Liskov Substitution Principle and the Open Close Principle, both which are very useful in building enterprise systems. Finally we look at creating objects.
Design Pattern: Factory Pattern
In Factory pattern, we create object without exposing the creation logic to the client and refer to newly created object using a common interface.
Blog Article: http://jyaasa.com/blog/factory-design-pattern-in-ruby/
Name : Prasoon Dadhich
USN : 1MS09IS069
CODE
#include <iostream>
using namespace std;
class Singleton
{
private:
static bool instanceFlag;
static Singleton *single;
Singleton()
{
//private constructor
}
public:
static Singleton* getInstance();
void method();
~Singleton()
{
instanceFlag = false;
}
};
bool Singleton::instanceFlag = false;
Singleton* Singleton::single = NULL;
Singleton* Singleton::getInstance()
{
if(! instanceFlag)
{
single = new Singleton();
instanceFlag = true;
return single;
}
else
{
return single;
}
}
void Singleton::method()
{
cout << "Method of the singleton class" << endl;
}
int main()
{
Singleton *sc1,*sc2;
sc1 = Singleton::getInstance();
sc1->method();
sc2 = Singleton::getInstance();
sc2->method();
return 0;
}
Explanation
If we create any object of this class then the static object (player) will be returned and assigned to the new object.
Finally only one object will be there. The point is not how many times something gets executed, the point is, that the work is done by a single instance of the the class. This is ensured by the class method Singleton::getInstance().
As you can see in the above code,Client can access any instance of the singleton only through the getInstance() method.Once an instance is created,the instanceFlag value becomes true and then any further objects pointers created will be given the reference to the same object that has been created.
Also,make sure you notice the presence of a private constructor.This ensures that no new objects of the class are created and that all the class pointers get the same reference to work on.
Design patterns are known as best practices that the programmer can use to solve common problems when designing an application or system.
Singelton Design Pattern
Factory Design Pattern
Builder Design Pattern
Strategy Design Pattern
Iterator Design Pattern
Observer Design Pattern
Prototype Design Pattern
Command Design Pattern
Decorator Pattern
Proxy Pattern
Adapter Pattern
Patterns and Anti-patterns
How to learn design patterns?
Categories of GoF patterns
The Fundamental theorem of software engineering
Real-world problems and how design patterns solve them with GoF structural patterns
in these slides i have explained the factory method design pattern. slides contains complete notes on this pattern from definition to implementation by code example.
Design patterns are known and tested solutions to common problem. In software engineering we constantly come across similar problems. The same problems or tasks need to be programmed again and again, hence patterns. Design patterns catalog and document these solutions.They are built on industry knowledge of what works and why. We will look at what design patterns are, their history and the structure of documenting patterns.
As an example we look at the Observer pattern.
We will also look at Liskov Substitution Principle and the Open Close Principle, both which are very useful in building enterprise systems. Finally we look at creating objects.
Why Design Patterns Are Important In Software EngineeringProtelo, Inc.
In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. Learn how design patterns quickly solve common classes of problems and streamline communication between developers.
Patterns (contd)Software Development ProcessDesign patte.docxdanhaley45372
Patterns (contd)
Software Development Process
Design patterns used to handle change
More time extending and changing code than developing it.
The Strategy design pattern handle change by selecting from a family of external algorithms rather than rewrite.
Design point: Make code closed for modification of code, but open for extension
Problem
Computer object created
Description Method returns
Getting a Computer
Problem
Program has to change every time
Customer changes options
Decorator Pattern
Wrapper code used to extend your core code
Extend a class dynamically at runtime
Decorator uses wrapper code to extend core functionality - decorating the code
Decorator Pattern
description() returns “You are getting a computer”
Wrapper description() returns
“You are getting a computer and a disk”
Wrapper description() returns
“You are getting a computer and a disk and a monitor”
Decorator Pattern
Core component: Computer
Variables holding computer objects should also be able to hold objects that wrap computer objects.
Extend the wrapper classes from the Computer class.
Abstract class cannot be instantiated
Ensures all wrappers are consistent
Developers have to provide their own description
Decorator Pattern
Method calls the core computer object’s
description method and adds “and a disk”
Decorator Pattern
Method calls the core computer object’s
description method and adds “and a disk”
Extend the core object by wrapping it in decorator wrappers. Avoids modification of the core code.
Each successive wrapper called the description method of the object it wrapped and added something to it.
Factory Pattern
Based on type, call the
Connection method
Factory Pattern
Create a method that returns the
correct connection type
Factory Pattern
New operator used to create OracleConnection objects.
New operator used to create SqlServerConnection objects, and MySqlConnection objects.
New operator to instantiate many different concrete classes
Code becomes larger and needs to be replicated in many places
Factor that code out into a method.
Code keeps changing
Encapsulate code into a factory object
Goal: Separate out the changeable code and leave the core code closed for modification
Building the Factory
Creating the Factory
FirstFactory class encapsulates the connection object creation
Pass to it the type of connection (“Oracle”, “SQL Server”,)
Use the factory object to create connection objects with a factory method named createConnection
Building the Factory
Create the FirstFactory class.
Save the type of the database, passed to the FirstFactory class’s constructor.
Object-creation code changes
Check which type of object to be created
(OracleConnection, SqlServerConnection,
and then create it.
Factory Class
Create the Abstract Connection Class
Core code should not be modified or has to be modified
as little as possible.
Using the connection object returned by the
new factory object
Use t.
Hönnunarmunstur er þekktar og reyndar lausnir við almennum vandamálum. Hugbúnaðargerð felur í sér að leysa vandamál og oft rekumst við að sömu vandamálin aftur og aftur. Þessi vandamál má leysa með þekktum leiðum, svo kölluðum munstrum. Hönnunarmunstur skjala þekktar lausnir. Þau eru byggð á þekkingu úr iðnaðnum, segja hvað virkar og af hverju.
Í þessum fyrirlestri skoðum við hönnunarmunstur, sögu þeirra og hvernig þau eru skjöluð. Við lítum á ýmis dæmi og tökum svo fyrir grunnmunstur - base patterns. Þá skoðum við Open Close Principle sem er eitt af þessum prinsippum sem við þurfum að hafa í huga.
Lecture two,
An introduction to Design Pattern
History
Pattern Language,
Categorization according to GoF
MVC
Creational Design Patterm
Factory Method
Abstract Factory
Singleton
Builder
Design Patterns are very popular among software developers. A design pattern is a well-described solution to a common software problem.
Some of the benefits of using design patterns are:
1. Design Patterns are already defined and provide industry standard approach to solve a recurring problem, so it saves time if we sensibly use the design pattern. There are many java design patterns that we can use in our Java-based projects.
2.Using design patterns promotes reusability that leads to more robust and highly maintainable code. It helps in reducing total cost of ownership (TCO) of the software product.
3.Since design patterns are already defined, it makes our code easy to understand and debug. It leads to faster development and new members of team understand it easily
Design patterns - How much we understand and know ??Vinay Raj
A quick presentation on design patterns and their classifications. Some point to note slides on to do's and not do's when it comes to implementing and adapting a proper design pattern. A case study of a creation kind of pattern which is factory design pattern.
This case study offers details of a project which involved developing an app to allow people to search for physicians/clinics in specified geographic areas. The app allows the users to rate and share reviews about the physicians they visit, and thus offer a reference point for people wanting to visit the same physicians in the future. For more details on our Health IT capabilities, visit: http://www.mindfiresolutions.com/healthcare.htm
The case study offers details of an app developed to enable its users to design healthy and personalized diet schedules, thus enabling them to keep their body weight under check. The app has features to offer customized solutions for the users. Progress can be monitored by referring to information shared in the form of charts and tables. For more details on other fitness/wellness apps developed by us, visit: http://www.mindfiresolutions.com/mHealth-development-services.htm
This casestudy elaborates on a cloud-based platform that we developed to enable enterprises to manage all their major business functions with outmost convenience – sales, internal efficiency, customer management. The platform offers them the capability to rapidly build web and mobile apps that can work together with built-in programs. For more details on our software development capabilities, visit: http://www.mindfiresolutions.com/
The casestudy offers details on an app developed to record and store readings made by three healthcare devices, which are used to measure healthcare vitals of users at remote locations. The App also has provision to generate different types to reports to facilitate subsequent analyses. For more details on our mHealth app development capabilities,
visit: http://www.mindfiresolutions.com/mHealth-development-services.htm
The project describes how a software platform can advance a very contemporary digital marketing technique of using Influencers to promote brands and services. For more details on our IT services, visit: http://www.mindfiresolutions.com/
This is all about details on High Availability of Applications running in Azure. Would cover on fundamentals of High Availability in Azure and discuss in depth on PaaS (High Availability of Web Role and Worker Role).
There was always embedded device in action, but the missing part was connectivity, intelligence, Knowledge from the data it was collecting. The Internet of Things is the new buzz word in trend. There will more embedded devices, more devices with sensor and more control on the physical process. Then we will see there are lots of thing surrounding us in near future. This is very initial phase of the IoT industry. But we have all the tools to experiment and make the things.
Oracle SQL Developer is an Integrated development environment (IDE) for working with SQL in Oracle databases.By the use of this, one can get an easy access to the Database, along with quick and effective SQL queries.
The introduction of Adaptive Layout in iOS 8 is a big paradigm shift for iOS app designers. When designing ones app, one can now create a single layout, which works on all current iOS 8 devices – without crafty platform-specific code!
Auto Layout is one of the most important system that lets one manage layout of ones application user interface. As we know, Apple supports different screen sizes in their devices, therefore managing application user interface becomes difficult.
LINQPad is a software utility targeted at Microsoft .NET development. It is used to interactively query SQL databases using LINQ.Some one planning to use this tool on the work front can refer to this presentation.
WatchKit is an API that extends Apple's development environment for iOS applications to allow apps / notifications to extend to the Apple Watch product. WatchKit is the Objective-C and Swift framework created by Apple to allow third-party developers to create apps for the Apple Watch ecosystem.
Objective-C is how we’ve built Mac and iOS apps for many years. It’s a huge part of the landscape of Apple Development. And, here comes Swift which is only a year old but with lot of promises and features.
Material Design can be simply explained as good design with the innovation and possibility of technology and science. In Material Design lot of new things were introduced like Material Theme, new widgets, custom shadows, vector drawable s and custom animations. This presentation is all about Material Design in Android.
This presentation is at the beginners level and mainly focusses on how to create and consume OData service in ASP.NET. OData (Open Data Protocol) is a standardized protocol for creating and consuming data APIs through regular HTTP requests and REST.
This presentation is about a basic Overview of Ext JS framework. Covers the discussion on topics like Understanding Ext JS API, Ext JS component Life cycle,Ext JS Components and Events and Ext JS Layouts etc.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
2. AGENDA
A brief history
What is design
pattern
When to use
design Pattern ?
Introduct
ion
Classification of
Design Patterns
Understanding
different
patterns
How to use
different
patterns ?
Overview
Data Tier
Middle Tier
Presentation Tier
MVC
Detailed
Study
3. A BRIEF HISTORY
Christopher Alexander Kent Beck Ward Cunningham
- Patterns originated as an architectural concept by Christopher Alexander (1977/79).
- In 1987 Kent Beck (creator of Extreme Programming and TDD) and Ward Cunningham (contributor to
Extreme Programming) began experimenting with the idea of applying patterns to programming and
presented their results at the OOPSLA conference that year
4. GANG OF FOUR
Erich Gamma Ralph Johnson John Vlissides Richard Helm
- Design patterns gained popularity in computer science after the book Design Patterns: Elements of Reusable
Object-Oriented Software was published in 1994 by the so-called "Gang of Four" (GoF)
- GoF established 23 patterns classified into 3 types – Creational, Structural and Behavioral
5. WHAT IS DESIGN PATTERN ?
solutionsReusable ProblemsCommonly
occurring DesignSoftware
- In software engineering, a design pattern is a general reusable solution to a commonly occurring problem
within a given context in software design - Wikipedia
- It is a description for how to solve a problem that can be used in many different situations
6. WHEN DESIGN PATTERN ?
You can consider not using any design pattern in following cases –
- The application being built will not change in future, the code accurately captures all requirements and
there are no planned enhancements on new features (the application you are building is the first and
last release )
- Your application‟s requirement is unique . No software engineer has ever built anything like your
application
- There is plenty of time to prototype your new design ideas . No proof-of-concept is required
- Everyone one your team has worked together for 20 years or so . You all posses a common set of design
vocabulary, so you don‟t need to learn someone else‟
If you don’t fall into any of the above categories – Use Design
Pattern
7. THE STORY OF LIGHT, SWITCH & FAN
Fan Fancy Switch Bulb Normal Switch
8. BENEFITS OF USING DESIGN PATTERN
- speed up the development process by providing tested, proven development paradigms .
- Reusing design patterns helps to prevent subtle issues that can cause major problems, and it also
improves code readability for coders and architects who are familiar with the patterns.
- Design patterns provide general solutions, documented in a format that doesn't require specifics tied to
a particular problem.
- In addition, patterns allow developers to communicate using well-known, well understood names for
software interactions. Common design patterns can be improved over time, making them more robust
than ad-hoc designs
- A standard solution to a common programming problem enable large scale reuse of S/W
9. TYPES OF DESIGN PATTERNS
Creational •Object creation
Structural
•Build large, complex
objects
Behavioral
•Play with algorithms and
relationship with objects
12. Creational
Pattern
creational design patterns are design patterns that deal with object creation mechanisms, trying to create
objects in a manner suitable to the situation. The basic form of object creation could result in design
problems or added complexity to the design. Creational design patterns solve this problem by controlling
the object creation.
13. FACTORY DESIGN PATTERN
- This pattern is used to create concrete class instances without specifying the exact class type.
- Define an interface for creating an object, but let the subclasses decide which class to instantiate. The Factory
method lets a class defer instantiation to subclasses .
- Logical model
14. FACTORY PATTERN - A REAL WORLD EXAMPLE
Document
Resume Report Presentation
16. FACTORY PATTERN – HOW ?
- If you have an inheritance hierarchy that exercises polymorphism, consider adding a polymorphic
creation capability by defining a static factory method in the base class.
- Design the arguments to the factory method. What qualities or characteristics are necessary and
sufficient to identify the correct derived class to instantiate?
- Consider designing an internal “object pool” that will allow objects to be reused instead of created from
scratch.
- Consider making all constructors private or protected.
17. FACTORY PATTERN IN .NET
- IDbCommand.CreateParameter
- Convert.ToBoolean
- WebRequest: HttpWebRequest, FtpWebRequest
- ASP.NET Runtime
18. FACTORY PATTERN – WHEN ?
Do we need to have derived classes figure out what to instantiate
and decouple client from instantiated class ?
19. Structural Pattern
structural design patterns are design patterns that ease the design by identifying a simple way to realize
relationships between entities.
20. FAÇADE DESIGN PATTERN
- Used to provide a simpler interface into a more complicated portion of code.
- A facade can make a software library easier to use and understand, since the facade has convenient methods for
common tasks
- A facade can make code that uses the library more readable, for the same reason
- A facade can reduce dependencies of outside code on the inner workings of a library, since most code uses the
facade, thus allowing more flexibility in developing the system
- A facade can wrap a poorly-designed collection of APIs with a single well-designed API
- The Facade however, can itself become too complex for a huge subsystem. Also it's a good idea to actually have
an abstract Facade over the Facade. One of the most common and successful examples is using this pattern
through a webservice, making the webservice acting as the Facade or the interface to many different dll's each
representing a subsystem.
22. FAÇADE – A REAL WORLD EXAMPLE
Marriage
Decoration
Food
Procession
23. FAÇADE DESIGN PATTERN – HOW ?
- Identify a simpler, unified interface for the subsystem or component.
- Design a „wrapper‟ class that encapsulates the subsystem.
- The facade/wrapper captures the complexity and collaborations of the component, and delegates to the
appropriate methods.
- The client uses (is coupled to) the Facade only.
- Consider whether additional Facades would add value.
24. FAÇADE DESIGN PATTERN – WHEN ?
Do we want simplify, beautify or OO-fy an existing class or subsystem ?
25. COMPOSITE DESIGN PATTERN
- Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual
objects and compositions of objects uniformly.
- Recursive composition
- “Directories contain entries, each of which could be a directory.”
- 1-to-many “has a” up the “is a” hierarchy
27. COMPOSITE – A REAL WORLD EXAMPLE
Category
Food
Diary
Milk
Yogurt
cheese
Non-Veg
Fish
Chicken
Veg
Potato
Onion
Sweets
Candy
Ice cream
Electronics
Audio
Digital
28. COMPOSITE PATTERN – HOW ?
- Ensure that your problem is about representing “whole-part” hierarchical relationships.
- Consider the heuristic, “Containers that contain containees, each of which could be a container.” For
example, “Assemblies that contain components, each of which could be an assembly.” Divide your
domain concepts into container classes, and containee classes.
- Create a “lowest common denominator” interface that makes your containers and containees
interchangeable. It should specify the behavior that needs to be exercised uniformly across all containee
and container objects.
- All container and containee classes declare an “is a” relationship to the interface.
- All container classes declare a one-to-many “has a” relationship to the interface.
- Container classes leverage polymorphism to delegate to their containee objects.
- Child management methods [e.g. addChild(), removeChild()] should normally be defined in the
Composite class. Unfortunately, the desire to treat Leaf and Composite objects uniformly may require
that these methods be promoted to the abstract Component class. See the Gang of Four for a
discussion of these “safety” versus “transparency” trade-offs.
29. COMPOSITE PATTERN – WHEN ?
Do we have units and groups and want to treat them the same way ?
30. Behavioral
Pattern
behavioral design patterns are design patterns that identify common communication patterns between
objects and realize these patterns. By doing so, these patterns increase flexibility in carrying out this
communication.
31. OBSERVER DESIGN PATTERN
- Define a one-to-many dependency between objects so that when one object changes state, all its
dependents are notified and updated automatically.
- You should use the pattern in the following cases:
- You have a publisher/subscriber model.
- Objects need to be notified of a change in another objects.
- You need that the object that notify its state change would not know about its subscribers.
34. OBSERVER PATTERN – HOW ?
- Differentiate between the core (or independent) functionality and the optional (or dependent)
functionality.
- Model the independent functionality with a “subject” abstraction.
- Model the dependent functionality with an “observer” hierarchy.
- The Subject is coupled only to the Observer base class.
- The client configures the number and type of Observers.
- Observers register themselves with the Subject.
- The Subject broadcasts events to all registered Observers.
- The Subject may “push” information at the Observers, or, the Observers may “pull” the information they
need from the Subject.
36. OBSERVER PATTERN – WHEN ?
Do various entities need to know about events that have occurred?
How to keep dependent object up-to-date.
37. STRATEGY DESIGN PATTERN
- The Strategy design pattern allows you to use multiple algorithms interchangeably.
- Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the
algorithm vary independently from the clients that use it.
- Capture the abstraction in an interface, bury implementation details in derived classes.
38. STRATEGY PATTERN- A REAL WORLD EXAMPLE
Sorting
Merge
Sort
Shell
Sort
Quick
Sort
40. STRATEGY PATTERN – HOW ?
- Identify an algorithm (i.e. a behavior) that the client would prefer to access through a “flex point”.
- Specify the signature for that algorithm in an interface.
- Bury the alternative implementation details in derived classes.
- Clients of the algorithm couple themselves to the interface.
41. STRATEGY PATTERN IN .NET
Membership Providers
Role Providers
Site Map Providers
Session State Providers
Profile Providers
Web Event Providers
Web Parts Personalization Providers
44. PATTERNS IN MVC
Observer (Behavioral Pattern)
- MVC uses the observer pattern to keep each view in sync with the model . Therefore whenever data
with in the model changes, each subscribing view (whether it‟s a webpage, a windows form or a form in
PDA) gets notified .
Composite (Structural Pattern)
- Each view uses composite pattern to make up its internal structure of visual elements (buttons, text
boxes, scrollbars etc.).
Strategy (Behavioral Pattern)
- The strategy design pattern defines the relationship between the view and controller . Hence multiple
controller can be used with a single view, depending upon the current state of the application. It allows
you to interchange the controller of a view when needed at design time and at runtime.
Factory (Creational Pattern)
- You can choose the default controller of a view when its rendered .
Editor's Notes
Source from - http://www.codeproject.com/Articles/98598/How-I-explained-Design-Patterns-to-my-wife-Part-1