design-patterns

Best design patterns book for a beginer?

I am trying to read "Gang of four" design patterns book, but I feel I need something more practical and short - one that can get me thinking about real design problems. GoF seems more on the theoretical side. I must add that I really prefer to see Python examples - Java/C# would be ok too. ...

Need sample problems for hands-on

I have been working with C++ for a few years now and have got good theoretical knowledge on the matter (I think). However I've been missing involvement in good projects, sort of projects that really gets one going on the technologies. So I intend to work on my own to get some good grip on C++ and related technologies. 'Have started with ...

How to design an application in a modular way?

I am looking for pointers, suggestions, links, warnings, ideas and even anecdotical accounts about "how to design an application in a modular way". I am going to use python for this project, but advice does not need to necessarily refer to this language, although I am only willing to implement a design based on OOP. Here's some context ...

C#: Where would you put to-and-from-string conversion/translation-functionality?

I have some fairly simple (at least when you skip error checking, event stuff, et cetera) parameter classes. They are "assembled" kind of like this: public interface IParameter { Type ValueType { get; } object Value { get; set; } } public interface IParameter<TValue> : IParameter { new TValue Value { get; set; } } public a...

Naming Classes - How to avoid calling everything a "<WhatEver>Manager"?

A long time ago I have read an article (I believe a blog entry) which put me on the "right" track on naming objects: Be very very scrupulous about naming things in your program. For example if my application was (as a typical business app) handling users, companies and addresses I'd have a User, a Company and an Address domain class - a...

Is MVC a Design Pattern or Architectural pattern

According to Sun and Msdn it is a design pattern. According to Wikipedia it is an architectural pattern In comparison to design patterns, architectural patterns are larger in scale. (Wikipedia - Architectural pattern) Or it is an architectural pattern that also has a design pattern ? Which one is true ? ...

Zend framework techniques

I am trying to migrate to zend framework. Should each webpage be a Controller or an action. What is the advantage of having multiple actions. Can they talk to each other? and whats the best use of Action helpers and View helpers. Please guide me on how to start on the framework.. thanks ...

How to overcome neatly the fact that static attributes can't be overrriden?

I want to implement an aplication where I have various Objects that can be interpreted as XML Strings. First I thought of making an interface which made each object implement two methods: public abstract Element toXML(); public abstract void fromXML(Element element); The first one turns the object information into the an DOM Element a...

Make sure only corresponding implementations or childs of it will be handled

Imagine the following situation: As may notice the Handler-childs and the Costumer-childs match each other. Each Handler has a method that takes a costumer. Is there any good way true oo-ish to make sure that a Handler-implementation only takes a correponding Costumer-implementation or any childs of it? Some examples: Handler will...

Decorator Design Pattern

Hi, I have been looking at the decorator design pattern (I am new to the subject of design patterns), and I was wondering, Can a decorator interact with more than one component? If A is a decorator of component B, can A have operations that B does not have? Thank you. ...

Additional try statement in catch statement - code smell?

Situation: My application need to process the first step in the business rules (the initial try-catch statement). If an certain error occurs when the process calls the helper method during the step, I need to switch to a second process in the catch statement. The back up process uses the same helper method. If an same error occurs du...

Constructor vs. Factory in .NET Framework

Below is an article about .net framework's use of patterns. I'm not sure I understand the bolded part in the excerpt below. Is it implying if you change the details of creating the object, you (might) change the constructor arguments? There are many cases in the Framework where you can obtain a new instance of a struct or class ...

Composition or Inheritance for DAL And BLL?

Questions Should the Data Access Layer (DAL) and Business Logic Layer (BLL) be exposed through interfaces or through abstract base classes? When should we choose abstract classes instead of interfaces and when interfaces instead of abstract classes? Is one benefit of using abstract base classes that if external party decides to ext...

Create, Approve, Edit, Approve pattern for site content

I'm working on a modification to a site to allowing users to enter content. However, once they've created that content it needs to be approved before it can be published. This is fairly easy to achieve by having a "moderate" bit set in the record for that content and only one table is needed. Now I also want to allow users to edit the c...

Level Design in Pygame

Hey--I'm trying to design my first game using the Pygame library for Python, and I was wondering what the best practices are for level design in general. I would love to hear what you guys think are good object oriented design patterns for managing levels. Also, I'm fairly new to Python--thanks! ...

Language-integrated design patterns

Hi. I've noticed that getting started with design patterns is pretty difficult for beginners. Understanding the design patterns structure requires a lot of time. Applying the design patterns to your practice requires a lot of time too. Agree, you can't see the differences between various types of the design patterns for the first time if...

Pattern for radio buttons, each selecting a "set" of other controls?

I have noticed a common scenario in UI development (both Web and fat client) where there is a group of radio buttons, and clicking on a radio button means you want to "select" a certain "set" of other controls (for simplicity's sake, let's say they're all text boxes). Just to illustrate, the asterisks represent radio buttons and the und...

At what level of abstraction does Single Responsibility Principle (SRP) no longer make sense?

I'm getting push back on a design from a colleague, and am wondering if there's consensus as to who is correct on application of SRP in this case. I see SRP as relating mostly to the lower-level details of design, such as class responsibility. As you move up in levels of abstraction I believe SRP is still relevant but that the definiti...

design patterns scenario base learning

Hi, Do you know any resource/s that teaches design patterns by scenario. Ex : One day x person needs a converting A/C tool between different country resources..... Answer : Adapter Pattern .. because.... Thanks. ...

PHP/DB pattern question

I have an app that works with an idea of "redemption codes" (schema: ID, NAME, USES, CODE). And example would be "32, Stack Overflow, 75, 75%67-15hyh" So this code is given to the SO community, let's say, and it has 75 redemptions. You redeem it by entering some shipping info and the code. When entered, this check is preformed: if (cod...