Views: 3345
. it's a practical book that tells you
using some of the most common design patterns. It also serves as a
. The pattern discussions are structured as a series of short chapters, each describing a design pattern and giving one or more complete working,
illustrating how the classes interact. This book is not a "companion" book to the well-known Design Patterns text. by the "Gang of Four." Instead, it is a
about and how to use them in their work. So
.
Content Overview of e-book: With this book, you will learn that design patterns are frequently used ways of organizing objects in your programs to make them easier to write and modify. You will get some valuable vocabulary for discussing
how your programs are constructed. People come to appreciate design patterns in different ways—from the highly theoretical to the intensely practical, with this you will get an internal picture of how that pattern can help you in your work. This e-book help you about conceptual idea, by describing the pattern in as many ways as possible. The book is organized into six main sections:
an introductory description, an introduction to C#, and descriptions of patterns, grouped as creational, structural, and behavioral.For each pattern, it start with a brief verbal description and then build
simple example programs. Each of these examples is a
visual program that you can run and examine to make the pattern as concrete a concept as possible. It provides a
simple introduction of UML. In addition, you’ll see
UML diagrams of some programs, illustrating the interactions between classes in yet another way. UML diagrams are just simple box and arrow illustrations of classes and their
inheritance structure, where arrows point to parent classes, and dotted arrows point to interfaces. When you finish this book, you’ll be comfortable with the
basics of design patterns and will be able to start using them in your day-to-day C# programming work.
Topics explained in this e-bookWhat are Design Patterns?Defining Design Patterns
The Learning Process
Studying Design Patterns
Notes on Object-Oriented Approaches
C# Design Patterns
How This Book Is Organized
Syntax of the C# Language Data Types
Converting Between Numbers and Strings
Declaring Multiple Variables
Numeric Constants
Character Constants
Variables
Declaring Variables as You Use Them
Multiple Equals Signs for Initialization
A Simple C# Program
Compiling & Running This Program
Arithmetic Operators
Increment and Decrement Operators
Combining Arithmetic and Assignment Statements
Making Decisions in C#
Comparison Operators
Combining Conditions
The Most Common Mistake
The switch Statement
C# Comments
The Ornery Ternary Operator
Looping Statements in C#
The while Loop
The do-while Statement
The for Loop
Declaring Variables as Needed in For Loops
Commas in for Loop Statements
How C# Differs From C
Summary
Writing Windows C# ProgramsObjects in C#
Managed Languages and Garbage Collection
Classes and Namespaces in C#
Building a C# Application
The Simplest Window Program in C#
Windows Controls
Labels
TextBox
CheckBox.
Buttons
Radio buttons
Listboxes and Combo Boxes
The Items Collection
Menus
ToolTips
Other Windows Controls
The Windows Controls Program
Summary.
Using Classes and Objects in C# What Do We Use Classes For?
A Simple Temperature Conversion Program
Building a Temperature Class
Converting to Kelvin
Putting the Decisions into the Temperature Class
Using Classes for Format and Value Conversion
Handling Unreasonable Values
A String Tokenizer Class
Classes as Objects
Class Containment
Initialization.
Classes and Properties
Programming Style in C#
Summary
Inheritance Constructors
Drawing and Graphics in C#
Using Inheritance
Namespaces
Creating a Square From a Rectangle
Public, Private and Protected
Overloading
Virtual and Override Keywords
Overriding Methods in Derived Classes
Replacing Methods Using New
Overriding Windows Controls
Interfaces
Abstract Classes
Comparing Interfaces and Abstract Classes
Summary
UML DiagramsInheritance
Interfaces
Composition.
Annotation
WithClass UML Diagrams
C# Project Files
Arrays, Files and Exceptions in C#Arrays
Collection Objects
ArrayLists
Hashtables
SortedLists
Exceptions
Multiple Exceptions
Throwing Exceptions
File Handling
The File Object
Reading Text File
Writing a Text File
Exceptions in File Handling
Testing for End of File
A csFile Class
The Simple Factory PatternHow a Simple Factory Works
Sample Code
The Two Derived Classes
Building the Simple Factory
Using the Factory
Factory Patterns in Math Computation
Thought Questions
The Factory Method The Swimmer Class
The Events Classes
Straight Seeding
Circle Seeding
Our Seeding Program
Other Factories
When to Use a Factory Method
Thought Question
The Abstract Factory PatternA GardenMaker Factory
The PictureBox
Handling the RadioButton and Button Events
Adding More Classes
Consequences of Abstract Factor
Thought Question
The Singleton PatternCreating Singleton Using a Static Method
Exceptions and Instances
Throwing the Exception
Creating an Instance of the Class
Providing a Global Point of Access to a Singleton
Other Consequences of the Singleton Pattern
The Builder PatternAn Investment Tracker
The Stock Factory
The CheckChoice Class
The ListboxChoice Class
Using the Items Collection in the ListBox Control
Plotting the Data
The Final Choice
Consequences of the Builder Pattern
Thought Questions
The Prototype PatternCloning in C#
Using the Prototype
Cloning the Class
Using the Prototype Pattern
Dissimilar Classes with the Same Interface
Prototype Managers
Consequences of the Prototype Pattern
Thought Question
Summary of Creational Patterns
The Adapter PatternMoving Data Between Lists
Making an Adapter
Using the DataGrid
Detecting Row Selection
Using a TreeView
The Class Adapter
Two-Way Adapters
Object Versus Class Adapters in C#
Pluggable Adapters
Thought Question
The Bridge Pattern The VisList Classes
The Class Diagram
Extending the Bridge
Windows Forms as Bridges
Consequences of the Bridge Pattern
Thought Question
The Composite Pattern An Implementation of a Composite
Computing Salaries
The Employee Classes
The Boss Class
Building the Employee Tree
Self-Promotion
Doubly Linked Lists
Consequences of the Composite Pattern
A Simple Composite
Composites in .NET
Other Implementation Issues
Thought Questions
The Decorator Pattern. Decorating a CoolButton
Handling events in a Decorator.
Layout Considerations
Control Size and Position
Multiple Decorators
Nonvisual Decorators
Decorators, Adapters, and Composites
Consequences of the Decorator Pattern.
Thought Questions
The Façade Pattern What Is a Database?
Getting Data Out of Databases
Kinds of Databases
ODBC
Database Structure
Using ADO.NET
Connecting to a Database
Reading Data from a Database Table
dtable = dset.Tables [ ];
Executing a Query
Deleting the Contents of a Table
Adding Rows to Database Tables Using ADO.NET
Building the Façade Classes
Building the Price Query
Making the ADO.NET Façade
The DBTable class
Creating Classes for Each Table .
Building the Price Table .
Loading the Database Tables .
The Final Application
What Constitutes the Façade?
Consequences of the Façade
Thought Question
The Flyweight Pattern Discussion
Example Code
The Class Diagram.
Selecting a Folder
Handling the Mouse and Paint Events
Flyweight Uses in C#
Sharable Objects
Copy-on-Write Objects
Thought Question
The Proxy Pattern. Sample Code
Proxies in C#
Copy-on-Write
Comparison with Related Patterns
Thought Question
Chain of Responsibility Applicability
Sample Code
The List Boxes
Programming a Help System .
Receiving the Help Command
A Chain or a Tree?
Kinds of Requests .
Examples in C# .
Consequences of the Chain of Responsibility
Thought Question
The Command Pattern Motivation
Command Objects .
Building Command Objects.
Consequences of the Command Pattern
The CommandHolder Interface
Providing Undo
Thought Questions
The Interpreter Pattern Motivation
Applicability.
A Simple Report Example
Interpreting the Language
Objects Used in Parsing
Reducing the Parsed Stack
Implementing the Interpreter Pattern
The Syntax Tree
Consequences of the Interpreter Pattern
Thought Question
The Iterator Pattern Motivation
Sample Iterator Code .
Fetching an Iterator
Filtered Iterators
The Filtered Iterator
Keeping Track of the Clubs .
Consequences of the Iterator Pattern
The Mediator Pattern An Example System
Interactions Between Controls
Sample Code
Initialization of the System
Mediators and Command Objects..
Consequences of the Mediator Pattern
Single Interface Mediators
Implementation Issues
The Memento Pattern Motivation
Implementation .
Sample Code
A Cautionary Note .
Command Objects in the User Interface
Handling Mouse and Paint Events .
Consequences of the Memento .
Thought Question
The Observer Pattern Consequences of the Observer Pattern
The State Pattern Sample Code
Switching Between States
How the Mediator Interacts with the State Manager
The ComdToolBarButton
Handling the Fill State
Handling the Undo List
The VisRectangle and VisCircle Classes.
Mediators and the God Class .
Consequences of the State Pattern.
State Transitions
Thought Questions
The Strategy Pattern Motivation
Sample Code
The Context
The Program Commands
The Line and Bar Graph Strategies
Drawing Plots in C#
Making Bar Plots
Making Line Plots
Consequences of the Strategy Pattern.
The Template Method Pattern Motivation
Kinds of Methods in a Template Class ..
Sample Code
Drawing a Standard Triangle
Drawing an Isosceles Triangle
The Triangle Drawing Program
Templates and Callbacks
Summary and Consequences
The Visitor Pattern Motivation
When to Use the Visitor Pattern .
Sample Code
Visiting the Classes
Visiting Several Classes..
Bosses Are Employees, Too
Catch-All Operations with Visitors .
Double Dispatching
Why Are We Doing This?
Traversing a Series of Classes Consequences of the Visitor Pattern
Thought Question
Tags:
Design Patterns C# UML OOPS .NET Framework