
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
In this lecture you will learn as to WHAT design patterns are, and why we would need them.
Design patterns are a crucial tool in the toolkit of a Software Engineer and we explore here why you need to become familiar with them.
In this lecture we will present to you the specific design patterns that we will cover in this course.
These are, in our mind, the most important and fundamental of all design patterns and we will go over them in depth in subsequent lectures.
Who needs Software Architecture?
Why do we care about well designed and maintainable software?
How do we achieve SOLID Architecture?
This lecture will show you why.
In this lecture we will show you why UML is very useful when working with design patterns and Software Architectures in general.
UML diagrams offer a bird's-eye-view of our designs and archietctures and act as high-level blue-prints for all our design patterns.
Here we will explored the final piece of the coding-well puzzle. We will appeal to you in a visual way as to why having good and organized code matters.
In this lecture I will show you how to setup the VS IDE environment that I use to run the code samples in this course.
NOTE:
You can use any other IDE of your choosing and you do not have to use VS Code. In case you would like to, here are some resources:
You can download VS Code here: https://code.visualstudio.com/
You can also get JDK installation directly in VSCode once you have installed it.
Alternatively you can get a JDK for your specific platform here: https://www.oracle.com/java/technologies/downloads/
If you have any questions or issues please ask in the Q/A section and I will help you with any setup issues you might have.
This is an optional lecture that you can skip if you are very comfortable with UML diagrams.
In case you want a quick and gentle refresher then by all means dive in!
We will do a quick overview of Class and Sequence diagrams.
How can you tell what a good Architecture is?
What are the main features of a great Architecture?
In this lesson we will explore the hallmarks of a great architecture are and how to spot them. This will prepare you for what it is that we will be achieving in this course: to sharpen your sense of Software Architecture appreciation.
This is a very important topic.
How do you start on the journey to be a better Software Engineer?
The S.O.L.I.D design principles form the backbone of what a great architecture should have at its base approach.
In this lecture we explore these principles in preparation for when we go over the design patterns of this course.
This is a quick hands-on practice session where you will get a chance to exercise your SOLID knowledge by refactoring a bad solution into a good solution as per SOLID principles.
In this session we go over Single Responsibility Principle(SRP)
This is a quick hands-on practice sessions where you will get a chance to exercise your SOLID knowledge by refactoring a bad solution into a good solution as per SOLID principles.
In this session we go over Open/Closed Principle(OCP)
This is a quick hands-on practice sessions where you will get a chance to exercise your SOLID knowledge by refactoring a bad solution into a good solution as per SOLID principles.
In this session we go over Liskov Substitution Principle (LSP)
This is a quick hands-on practice sessions where you will get a chance to exercise your SOLID knowledge by refactoring a bad solution into a good solution as per SOLID principles.
In this session we go over interface Separation Principle (ISP)
This is a quick hands-on practice sessions where you will get a chance to exercise your SOLID knowledge by refactoring a bad solution into a good solution as per SOLID principles.
In this session we go over Dependency Inversion Principle (DIP)
NOTE: Once you are done with this lecture we have provided you with a PDF of SOLID exercises for you to try on your own. The PDF is attached with this lecture.
We introduce the Singleton Design Pattern and discuss its importance and relevance in Software Engineering. In this lesson you will learn what it is and why we need it.
It is a creational design pattern that helps us with ensuring that we have only a single copy of a given class in the whole project scope.
You will find out why that is relevant.
In this lesson we will explore how to code this pattern in Java using the most straightforward implementations of a singleton in Java.
We explore both eager loading and lazy instantiation versions of the singleton creation as well as thread-safety issues of the Lazy Instantation version.
We will also look into the architectural nature of this software recipe through the UML lens.
NOTE: Attached you will find the zipped source code for this lecture.
Let's code something practical using the Singleton Pattern.
In this lecture we will look at different iterations of a custom Logger class which we will explore as a Singleton.
We will start with a simple example, and then go through different phases of making our Logger a thread-safe Singleton that is customizable and flexible through an abstract class concept.
NOTE: attached you will find the zipped source code for this lecture.
Let's make our SingletonLogger better by making it into an abstract class so that we can easily extend our solution.
In this lecture we will look at how to improve our initial Logger utility
We will first look at what makes the SingletonLogger inflexible and how to address this by using proper Object Oriented Design.
NOTE: attached you will find the zipped source code for this lecture.
In this, final simple logger lecture, we will take the previous improvements and we will look with a critical eye as to how we can even further improve our design of a singleton based utility for logging.
We will make sure that our improved design follows SOLID principles and as a showcase we will create a network logger which will log to a server which will then take the logged messages and log them to the servers log file.
NOTE: attached you will find the zipped source code for this lecture.
In this lecture we will look with a critical eye at the efficiency issues of thread-safety of our Simple Lazy Loading GoF Singleton solution.
We will look at two classic and more efficient ways of synchronizing access to our Singleton instance:
Double Checked Locking (DCL) Singleton
Bill Pugh Singleton
NOTE: attached you will find the zipped source code for this lecture.
In this lecture we will explore the issues with the Simple Singleton implementation we have so far utilized.
We will look at the different vulnerabilities of the Simple GoF approach in java and see how such Java language constructs like Cloning, Serialization, and Reflection can allow for circumvention of the GoF implementation possibly rendering it ineffective.
NOTE: attached you will find the zipped source code for this lecture.
In this final Singleton Lecture we will explore arguably the simplest Singleton implementation in Java:
Enum Singleton
We will look at its strengths and weaknesses. Is it the best approach? Kind of one implementation to rule them all? We shall find out in this lecture.
NOTE: Attached you will find the zipped source code for this lecture.
NOTE: I have also attached a PDF with a quick introduction to JavaFX with setup instructions.
This is an optional exercise for the student to do. It is important to practice and try things out.
This exercise will ask you to put the singleton patterns that we have learned so far through some testing.
We introduce the Factory Method Design Pattern and discuss its importance and relevance in Software Engineering.
In this lesson you will learn what it is and why we need it. It is a creational design pattern that makes the process of object creation more maintainable.
We further explore the Factory Method Pattern and look into the architectural nature of this software recipe through the UML lens.
Let's code something using the Factory Method Pattern. In this lesson we will explore how to code this pattern in Java. We have a fun little application which draws random shapes on the screen by utilizing the Factory Method Pattern and a custom Window Painter.
NOTE: attached you will find the zipped source code for this lecture.
This is an optional exercise for the student to do. It is important to practice and try things out. This will cover two scenarios to use a Factory Method Design Pattern in.
We introduce the Builder Design Pattern and discuss its importance and relevance in Software Engineering. In this lesson you will learn what it is and why we need it.
It is a creational design pattern that makes the process of complex object creation more maintainable and decoupled from the client.
We further explore the Builder Pattern and look into the architectural nature of this software recipe through the UML lens.
Let's code something using the Builder Pattern. It's time for some Pizza!
In this lesson we will explore how to code this pattern in Java. We are going to create a Builder abstraction that will be responsible for creating different types of Pizza.
You will also learn about Fluent Interface and Chainability in Java.
NOTE: attached you will find the zipped source code for this lecture.
This is an optional exercise for the student to do. It is important to practice and try things out.
This will cover a basic scenario on how to use the Builder Design Pattern.
We introduce the Adapter Design Pattern and discuss its importance and relevance in Software Engineering. In this lesson you will learn what it is and why we need it.
It is a structural design pattern that allows two different processes to talk to each other even though their view of data is not compatible.
We further explore the Adapter Pattern and look into the architectural nature of this software recipe through the UML lens.
Let's code something using the Adapter Pattern. In this lesson we will explore how to code this pattern in Java. We are going to create an Adapter for some XML and JSON data conversion!
As part of your Adapter pattern Exercise you will add a CSV Adapter to the featured code.
NOTE: attached you will find the zipped source code for this lecture.
Please note that the code provided is part of a Maven Project and a pom.xml file is included for the dependencies necessary.
This is an optional exercise for the student to do. It is important to practice and try things out.
This will cover two scenarios to use a Adapter Design Pattern in.
In this section will will introduce this incredibly simple yet powerful design pattern.
This is probably the most popular and useful of all the design patterns in the whole of GoF collection.
We further explore the Strategy Pattern and look into the architectural nature of this software recipe through the UML lens.
Let's code something fun using the Strategy Pattern. In this lesson we will explore how to code this pattern in Java. We are going to look at how to create different handlers for creating different rendering strategies in a Drawing Application.
We will create a Drawing Application which will allow users to draw (like Paint) on the screen using different types of strokes/tools such as Pencil, Brush, or Spray-Paint.
the UI will be coded in JavaFX which is much nicer to look at compared to AWT.
NOTE: The source code for this lecture is attached with this video.
This is an optional exercise for the student to do. It is important to practice and try things out. This will cover two scenarios to use a Strategy Design Pattern in.
It is recommended that you first study the code from the "Coding the Strategy Pattern in Java" and become familiar with it as you tackle exercise #1.
NOTE: The code used for this exercise is the code we used in the "Coding the Strategy Pattern in Java" lecture.
In this section we will explore the Observer Design Pattern with its very important role in inter-object communications.
Such aspects as notifications about specific events, and in general signalling about action workflows is what this pattern excels at.
Here we will look at more detail about the Architectural make up of the Observer Pattern. We will look at UML as well as general workflow of what makes this pattern great.
Let's learn something about the Observer Design Pattern in Java by using it in a context of a practical mini-project. In this lesson we will explore how this pattern is used by building a group chat application which will utilize the Observer pattern to simplify the application architecture.
NOTE: The source code for this lecture is attached with this video.
This is a set of exercises for the student to do. It is important to practice and try things out. This will go over the code that we have looked at in the Coding With Observer Pattern - Chat Application (lecture #42)
You will use that code as your starting point for those exercises as you improve the functionality of the Group Chat Application.
We will go over the concept of what a State and a State Machine is. We will understand how to break down states and associated data into a set of discrete steps that make up a State Machine.
We further explore the State Pattern and look into the architectural nature of this software recipe through the UML lens and get a better understanding of h ow to design a State Machine.
In this lecture we will quickly go over the application that we will build using none other than the State Design Pattern.
We will look at writing our own fully functional Media Player Application which is a perfect utilization of the State Pattern.
Here we will look at how we will Architect the application.
We will create and go over the state-machine-diagram and will study through the UML Architecture of the application.
We will go through the following diagrams:
Class Diagram of the full architecture
Sequence Diagrams to show the context of how the classes work together.
After this we will be ready to go through the code.
In this final lecture, we will look at the code for our Media Player with specific emphasis on how the State Design Pattern is used in this application.
We will be using JavaFX as our primary UI but its our controller (i.e. the Context) class that is the star of this show!
This application is a great start to a much larger application that you can then continue developing.
NOTE: The source code for this lecture is attached with this video.
In this lecture we will look into the course assignment.
You will see what 'Game of Life' is all about. This is a famous and classic life simulation that is a staple of colleges and universities in their Computer Science programs for its curious 'emergent' behaviour.
You will design, architect and code this application for your mobile device. All of it using the design patterns you have learned in this course.
I have provided you with a working starter code which has all the logic for the game of life but is not architected well. Your task will be to take the code and refactor it so that it is well architected and follows all the SOLID principles as well as uses some of the Design Patterns we learned in the course.
NOTE: The source starter code for this lecture is attached with this video.
A helping hand with the architecture and general 'design' approach for your assignment.
We all want to become better software developers and be able to call ourselves "Software Engineers" or "Software Architects", but to do that you first have to master a number of design patterns.
This course will put you on a track to that destination.
We will teach you how to recognize when to use specific design patterns to build complex systems in a divide-and-conquer manner so that complexity is reduced and abstracted.
But rather than learning all the design patterns out there, we have curated the most important, top fundamental GoF Design Patterns for you.
All of that in the context of the Java programming language.
We start with full understanding of the S.O.L.I.D Design Principles and how they in turn relate to those design patterns. We eplain everything in the context of real-world problems as well as specific code examples.
At the end of the course you will get to Architect a solution by coding John Conway's Game of Life simulation which will run on variety of devices.
Complex software systems are plagued with three major issues:
Timelines are stretched as requirements change.
Multiple developers have a hard time coordinating their efforts.
Code redundancy.
This in turn creates issues with maintenance and overall flexibility for adding new features. In general this means poorly designed systems that are hard to maintain and are not adaptable.
One answer to all the above problems is having a proper design and architecture. Think of a skyscraper being built. There is always a high-level blueprint. This blueprint is used to show everybody involved (from architects to supply chain to construction workers to machinery scheduling etc…) what is being worked on.
Everybody understands and follows the same vision.
A blueprint has a number of commonly understood elements which repeat themselves across many projects. For example all buildings need electrical wiring and plumbing, they might need elevators, and cooling systems, and underground parking lots, and of course stairs. They also usually are connected to the electrical grid and water supply as well as… roads.
All these common elements follow certain standards that have been improved over many many years and across many many projects. They are well understood and can be used almost like recipes.
In Software Engineering we also have a set of elements that repeat themselves across many projects. For example all software applications need to create objects, they need to communicate state change across those objects, they need to be able traverse over collections of those objects. In other words, if you want to be a better developer then you need to become proficient in those elements that have been time-tested. In the Software Engineering world these elements are known as “Design Patterns”
This course will teach students how to recognize when to use specific design patterns to build complex systems in a divide-and-conquer manner so that complexity is reduced and abstracted.
This will help you to design projects in an Architectural manner before any major development happens and can be used to shorten development time and reduce maintenance costs.
Design patterns are important because they are time-tested recipes or solutions to well-known software engineering problems. When creating software applications certain problems recur in a pretty predictable fashion so rather than ‘reinvent’ the wheel we will have an assortment of, if you will, wheels to choose from.
We will teach you this in a slightly different manner than you probably have been taught before. We will take a practical approach (i.e. specific examples) but the power of Design Patterns comes from their ‘concept’ and we will teach you the concept of those design patterns so that you are fully able to change them and modify them to your needs. In addition we will look at how to combine all those patterns into something greater: an architecture.
A well designed Architecture is this magical thing where the whole is greater than the sum of its parts.
This is what we will strive to teach you.