Skip to Content.
Sympa Menu

gang-of-4-patterns - Re: [gang-of-4-patterns] new to design patterns

gang-of-4-patterns AT lists.cs.illinois.edu

Subject: Design Patterns discussion

List archive

Re: [gang-of-4-patterns] new to design patterns


Chronological Thread 
  • From: "Justin Daubenmire" <jdaubenm AT yahoo.com>
  • To: <gang-of-4-patterns AT cs.uiuc.edu>
  • Subject: Re: [gang-of-4-patterns] new to design patterns
  • Date: Wed, 14 May 2008 15:24:08 -0400
  • Importance: Normal
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/gang-of-4-patterns>
  • List-id: Design Patterns discussion <gang-of-4-patterns.cs.uiuc.edu>

A little more information on this little application.
 
Reminders and Notes share the same properties:
 
.Date - set or get the date of note/reminder
.Text - set or get text of note/reminder
 
They share the same methods:
 
.Add - add a note/reminder
.Delete - delete a note/reminder
.Update - update a note/reminder
.GetAll - return all notes/reminders
.Get - return a single note or reminder
 
So the reminder class and note class implement the same abstract class or interface.
 
Since a note or a reminder can be treated as the same object since they have the same interface, does this design concept yield those objects to a certain design pattern for processing them?
 
For example, I could loop through a collection of those objects and the application doesn't care if it is a reminder or note object, it can process .Date and .Text regardless of its implementation.
 
What design pattern does this concept yield to if any?
 
notes and reminders can be attached to the calendar object but need to be disconnected from the calendar object.
 
For example, the calendar current date could be today and it would know to look up the reminders and notes for today's dates.
 
Is this an observer pattern?
 
The calendar object is the subject and the notes/reminders are observers?
 
So if the calendar changes date, it alerts all observers, in this case notes/reminders.
 
Does this sound correct?
 
Thanks!
 

Regards,
Justin

From: Justin Daubenmire
Sent: Wednesday, May 14, 2008 1:57 PM
To: gang-of-4-patterns AT cs.uiuc.edu
Subject: [gang-of-4-patterns] new to design patterns

Hi All,
 
I am new to design patterns but have been reading/studying them for around 2 months now. As a way to practice the design patterns, I decided to start a little c#.net project. It is a calendar that allows users to attach notes to dates on the calendar and also set reminders for notes. The application can support setting up multiple users so each user can have his/her own calendar, reminders, and notes. Users can attach multiple notes to a single date. Users can attach multiple reminders to a single date.
 
So the main objects are: calendar, user, notes, reminders and they are classes, not even any GUI objects yet.
 
 
As I sat down to program the application and select design patterns, I drew a blank! Do I use an abstract factory? composite pattern for notes/reminders? This is why I am here since I am sure others have experienced this just starting out too.
 
I have been programming for around 8 years and am familiar with object oriented programming, but design patterns are new to me so I thought it best to drill them into my mind via a small application.
 
With the brief description I just provided, can some of you please steer me to what design patterns I should use for the application?
 
What design pattern would be good to use for reminders/notes? The calendar? users?
 
Thanks for any suggestions or help!
 

Regards,
Justin


_______________________________________________
gang-of-4-patterns mailing list
gang-of-4-patterns AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/gang-of-4-patterns



Archive powered by MHonArc 2.6.16.

Top of Page