Reuse solutions, not just code. Code Smarter with Design Patterns helps you identify problems that occur repeatedly in your code, and solve those problems in a standardized way. Wrap your head around the concept of the design pattern-a programming solution or template that can be used in many different situations-and discover new tools for creating successful software.
Day 1 Why Patterns? This chapter discusses the reasons why you should study design patterns. Design patterns offer the ability to reuse solutions, not just code. By reusing already established designs, you get a head start on problems and avoid gotchas, you benefit by learning from the experience of others, and you dont have to reinvent solutions for commonly recurring problems. Design patterns establish a common terminology allowing developers to use a common vocabulary and share a common viewpoint of the problem. Design patterns provide a common point of reference during the analysis and design phase of a project. The course will use UML as a means to communicate pattern intent, and this chapter introduces key UML concepts.
Singleton Some solutions require the use of a single object instance across the whole solution, for example naming services or cached objects. This chapter will introduce the singleton pattern as a solution, along with variations for thread safety, and other varieties of single instance based on thread affinity.
Factory There are occasions when you want to decouple the knowledge of which type to create from the client code that creates that type. Factories allow you do this by encapsulating the necessary knowledge of how to create the object thus allowing the actual implementation used to vary at runtime. Factories are useful for building pluggable architectures and for creating application extension points.
Decorator One of the key design pattern goals is to write code that is closed for modification and open to extension. This pattern shows that an objects behavior and responsibilities can be extended at runtime, as opposed to design time using inheritance. This allows us to combine a variety of behaviors far more efficiently that normal inheritance. Examples of decorators in the framework are BufferedStream, SynchronizationWrappers, and XmlValidatingReaders. We will examine how to create and use decorators.
Day 2 Delegates and Events .NET introduces a new way to build loosely coupled systems through the use of the delegate type. This chapter provides a basic understanding of what delegates are, and how they are utilized to fire events.
Observer The ability to notify interested entities of changes to an object state is a fundamental requirement of most object-oriented solutions. There are many ways to do this, but there is a danger that we will build a tightly coupled system and we prefer to build a loosely coupled system. The typical way of implementing the observer pattern is to use interfaces, but here we show that delegates and events are a far more flexible and efficient way of implementing the pattern on the .NET framework.
Strategies and Templates What we can be 100% sure of with software is that it constantly needs to evolve. What we also know is every time we change existing working code there is a risk that we break it. What we need is an approach that allows the software to evolve without having to modify existing working code. The strategy and template patterns allow us to build solutions that can evolve without the risk of effecting existing well-tested code.
Command I In this chapter, we examine the command pattern. The command pattern allows us to encapsulate invocation, allowing the invoker to be decoupled from the client and the recipient, this enables us to build a variety of different invokers to deliver custom thread pooling, and invocation logging to build fault tolerant solutions.
Day 3 Command II In this chapter we extend the command pattern to not only encapsulate forward invocation but also undo invocation, allowing us to build a complex undo sequence through a series of simple undo commands. This pattern can then be combined with transaction support inside .NET to build transaction aware types.
State In many cases object behavior depends on the state an object is in. When the state of an object changes the behavior of the object also changes. This is typically modeled through the use of finite state machine. This pattern provides a means to map a finite state machine into a series of classes where each class represents a different state, thus providing different behaviors. This approach allows us to add new states and transitions without effecting existing code, continuing the theme of being closed for modification, open for extension.
Proxy and Interceptor The proxy pattern manages the invocation of an object, by hiding the true nature of the location and invocation mechanism of the object, typically used to make remote method calls. Most environments offer tool support for building proxies but .NET offers dynamic proxies (a.k.a. the TransparentProxy). This technology can also be deployed to build interceptors for objects at runtime. Using interceptors allows the layering of services onto objects at runtime. This technique also allows us to apply aspects to objects.
Day 4 Adapter and Facade Client's code is often written against a specific interface. As classes evolve, interfaces may change and the client needs a way to adapt to the changing interface. If there are many clients this would result in a lot of dangerous change. The adapter pattern solves this problem by building an adapter that can convert calls from one type hierarchy to another. Facade allows us to simplify an interface by providing more course grain operations; this is typically used for remote access to reduce the number of roundtrips.
Iterator, Composite, and Visitor There is often a need to touch and process every object inside an object hierarchy, for example walking over user interface control objects, XML documents, business entities, file systems, etc. The iterator pattern provides a standard means to achieve this. .NET provides a standard implementation of iterator, further the C# language simplifies the implementation further through language extensions. The visitor pattern gives us the ability to layer behavior onto the hierarchy without the need to change the underlying implementation of the hierarchy, continuing the theme closed for modification open for extension.
Anti Pattern During software development, we often come across common recurring problems in our code. These can be categorized as anti patterns. In this chapter, we will look at common anti patterns and how to fix them and avoid them.
The hardware and software needed to successfully deliver this course is listed below. PC configurations, including processor, RAM, and hard drive, are recommended minimums. Courses can be run on lower performing machine, but with slower performance. Please call for confirmation if your PC configuration is significantly less than what is recommended.
In addition to PC equipment, each instructor will require projection equipment that is capable of projecting the instructor's monitor onto a screen clearly visible by all students participating.
Student Machines
Instructor Machines
Hardware Requirements
Hardware Requirements
Pentium Processor (>= 1Ghz recommended) 512 MB RAM 500 MB free disk space after operating system and tools installed 17 color monitor (required) Networked with TCP/IP (required) Internet connection (optional)
Pentium Processor (>= 1Ghz recommended) 512 MB RAM 500 MB free disk space after operating system and tools installed 17 color monitor (required) Networked with TCP/IP (required) Internet connection (optional) XGA Projector with a minimum resolution of 1024 x 768 for displaying PowerPoint slides
Software Requirements
Software Requirements
Installed in this order:
1.) Windows Server 2003 (preferred)
OR Windows XP
OR Windows Vista with the following Windows Features turned on:
IIS7 with ASP.NET support
WCF HTTP activation
WCF non-HTTP activation
2.) Visual Studio 2008 required (Pro or Team Edition)
Include option to install SQL Express
3.) MSDN Complete Install
Installed in this order:
1.) Windows Server 2003 (preferred)
OR Windows XP
OR Windows Vista with the following Windows Features turned on:
IIS7 with ASP.NET support
WCF HTTP activation
WCF non-HTTP activation
2.) Visual Studio 2008 required (Pro or Team Edition)
Include option to install SQL Express
3.) MSDN Complete Install
Remote Access Available
Code Smarter with Design Patterns is now available as a remote access course.
You can now take open enrollment courses in our Los Angeles and Boston facilities without traveling. Remote Access to our ongoing schedule of instructor-led courses will allow you to fully participate real-time in expert-level lectures, demos and labs that have made DevelopMentor a leader in software development training. We've added new collaboration tools and prepared our instructors for remote students in class so you will be fully engaged in the learning process.
Mentoring
Quickly assimilate what you learn in Code Smarter with Design Patterns and apply it to your project by taking advantage of our Mentoring services.
Our dedicated mentors facilitate your team's development. We add value to your business by enhancing the talent of your employees and maximizing their productivity. Mentors integrate the methodologies, technologies and practical experiences of the classroom through an on-the-job and on-the-project experience that produces real-world results.
Onsite
Code Smarter with Design Patterns is also available as an onsite course.
If you have a group of people to train, an on-site course, delivered at your facility may be the most cost-effective solution for you. Our staff will work with your team to plan and produce the best possible result based on your team's size, experience levels, project needs and longer-term goals. We can structure a training course, or broader program, tailored to meet the specific needs of your organization. We'll make sure that any lab exercises run on the platform you use and we can tailor the lab exercises to be appropriate to your business. If you prefer to focus on just the pure technological principles, we can also deliver courses at your facility following the same format as our public curriculum.
.NET Design Patterns: Code Smarter is for developers who:
Want to construct better distributed applications using collective real-world knowledge
Need all of their development team on the same page with a common terminology, a common programming methodology, and a shared point of reference for analysis and design
Who have knowledge of design patterns in Java or C++ and want to implement them in .NET
Prerequisites
.NET Design Patterns: Code Smarter is for developers who:
Demonstrate proficiency in object-oriented programming techniques
Have previous .NET experience
Course price includes course materials provided on an eco friendly USB memory stick. Use of a PC for lab exercises.