SSE657+Project+2-+Iteration+2

=Project 2 - Elaboration Iteration 2= In Iteration 2 the book turned and focused on Design Patterns for developing programs. This probably the most critical chapters of the book. From my professional experience, knowing Design Patterns before planning and prototyping software, will greatly reduce time, cost, and MANY headaches later in the process. If a program is design uses a breathe of knowledge of design patterns and is used accordingly, then the solution will flow better from start to finish. This requires all programmers on the project to understand and be "on the same page" when writing the program.

Since I have had several design pattern classes in my undergrad and my Sudoku Game does not lead itself to a lot of the design patterns covered in these chapters, I will show examples of the ones I used and just talk about the ones that my project did not use. In other words, this section will look more like a book report other than a report only on my project. (It seems to be what most everyone else in the class is\has been doing for all their projects anyway).

Polymorphism
Polymorphism is the ability of an object to appear to be the same of another object of a different type. Inheritance is the major use here. In .NET most any class can inherit another class by: code format="csharp" public class ClassA : ClassB code This way all of ClassB's structure will be inherited by ClassA. Another way in .NET is declare a class an interface, which only holds structure and any class that inherits it has to fill in the data. code format="csharp" public interface ClassC {    public int ItemA { set; get;} public void DoSomething; }

public ClassD : ClassC {   private int itemA; public int ItemA {      get { return itemA;} set { itemA = value;} }   public void DoSomething {        itemA += 1; } } code Other uses of polymorphism in .NET is an Abstract class, which cannot be instantiated, and Virtual which allows itself to be overriden for more exact implementation, but the structure is always there.

Pure Fabrication
The idea behind Pure Fabrication is add functionality to the program that is handled by something that either not developed yet or is done by an outside source of the project. You add it to the domain model only for completeness but the full definition of how it works is not defined. This approach is used during initial design to keep the iteration in scope and not causing the programmers to have to design everything in the beginning.

Indirection
Indirection is used most commonly used as an adapter class for certain functionality. If software is beginning designed for several different types of systems then adapters are created to handle the different ways each system will handle the functionality. Most commonly used during I/O functions.

Protected Variations
Protected Variations (PV) is the most fundamental concept of any object-oriented language. It is similar to polymorphism (polymorphism is basically derived from PV) in that you use individual classes to handle the specific functions of the same name inside each class. It is basically encapsulating functions inside of classes to keep functionality separate.

Adapters
I used a built-in adapter of .NET for accessing the database to store users and save games. code format="csharp" SqlCeConnection conn = new SqlCeConnection(@"Data Source=C:\Users\Tim\Documents\My Dropbox\Sudoku Game\Sudoku Game\Sudoku.sdf"); conn.Open; SqlCeCommand cmd = new SqlCeCommand("Select password, userId FROM Users WHERE username='" + username + "'", conn); SqlCeDataAdapter adapter = new SqlCeDataAdapter(cmd, conn); adapter.Update; code The SqlCeDataAdapter is used to handle the flow of data in and out of the database. I used the basic form but the adapter has alot more built functionality that can handle and filter all of the SQL commands.

Factory
A Factory handles can used when Indirection is desired. The factory from the outside takes a command and returns a result. On the inside, the factory can handles all the different methods that the command can be called. For example, if a system has two printers, one color and one black and white, the programmer calls Factory.Print(object something) and the factory needs to determine which printer to print to and then call the necessary methods in order to print and then return a message back to the caller than the printing is done.

Basically, it handles multiple adapters so that the outside world only sees one operation.

Singleton
Singleton's are objects and/or classes that can only be initialized once. This keeps multiple objects of the samething from being created and the programmer trying to figure out which one is which. I use all the time but not in the Sudoku Game Project.

Strategy
Strategy uses of polymorphism to keep similar actions of interfaces separated by classes. I had actually never heard of this one before reading it the book. I guess I alway assume this was polymorphism.