design-patterns

Should the data access layer contain business logic?

I've seen a trend to move business logic out of the data access layer (stored procedures, LINQ, etc.) and into a business logic component layer (like C# objects). Is this considered the "right" way to do things these days? If so, does this mean that some database developer positions may be eliminated in favor of more middle-tier codi...

Peer Learning Topic Suggestions

Every Friday we have a half-hour peer learning session, where on a rotating basis, we all get a turn to give a short, introductory presentation on technology we feel we know and could benefit our colleagues knowing. I know everything ;-), so I'd like some ideas on what I could present. What I mean to say, is that I don't really have an...

Design for generic options to algorithms.

Hi, I want to know if there is a design pattern for specifying options to a set of algorithms. I am using C++. Let me describe my problem. I am having a set of algorithms and these algorithms have different options. I want to design a single point access to these algorithms. Something similar to a strategy pattern. This single point acce...

Whats a good approach/pattern to solve this scheduling problem

I have an object public class Task { public TimeSpan Length { get; set; } public IList<Task> Dependencies { get; set; } public DateTime? StartDate { get; set; } } which has dependencies on other instances. For example: (read "<-" as "depends on") B <- A C <- A D <- B,C and Q <- P R <- Q Given a list of Tasks* and...

Template or abstract base class?

If I want to make a class adaptable, and make it possible to select different algorithms from the outside -- what is the best implementation in C++? I see mainly two possibilities: Use an abstract base class and pass concrete object in Use a template Here is a little example, implemented in the various versions: Version 1: Abstract...

How do I return a Generic Type through a method in a base class?

I've been trying to create a simple base class that encapsulates some of my conventions for database access. I generally create a sproc named "products_retrieve_product" to select a product based on productID. I would like the method "Retrieve" in the base class to return the type that the derived class supplies in it's definition. I...

networking design ; socket communication using polling

A few words about an ongoing design and implementation I send a lot of requests to the remote application (running on a different host, of course), and the application send back data. About client Client is a UI that spawn a separate thread to submit and process the requests. Once it submits all the requests, it calls Wait. And the ...

Game architecture and design strategy for a multiplayer card game

I am relatively new to game development so I decided I wanted to create a hobby project from scratch for both experience and entertainment. The specific game is similar to poker known as Three Card Brag. The game is played in the movie Lock, Stock and Two Smoking Barrels. I have been reading up on some of the topics on SO regarding gam...

Treating Classes as First Class Objects

I was reading the GoF book and in the beginning of the prototype section I ready this: This benefit applies primarily to languages like C++ that don't treat classes as first class objects. I've never used C++ but I do have a pretty good understanding of OO programming, yet, this doesn't really make any sense to me. Can anyone ...

How to do Events in Ruby?

I come from a C# background, and have just started programming in Ruby. The thing is, that I need to know how I can raise events in my classes so that various observers can be triggered when things need to happen. The problem is the books I have on Ruby don't even mention events, let alone provide examples. Is anyone able to help me? ...

python design patterns

I am looking for any resources that gives examples of Best Practices, Design patterns and the SOLID principles using Python. ...

In Java, how should message producers identify themselves?

I have a queue of uniform message objects with multiple producers and a single consumer. The consumer is publishing the information and needs to be able to grant access based on the data's origin, so I want the producer send a suitable identifier along with the message. The producers themselves can't be responsible for the far side acces...

Swapping in and out logic on a running system

I want to design this system which has two major components: Base/core stuff. Never changes. Stuff running on the core. Changes rather frequently. This is going to be developed in Java, but the problem applies to any classical OO language. How can I replace 2 above in a running system without recompiling 1, and without even stopping ...

Design Pattern reference implementations in Ada?

Does anyone know of some good reference implementations of common design patterns in Ada? ...

n-Tier Architecture Feedback Needed

I started my website, like stackoverflow, with a little technical debt that I'm trying to pay off. Being a contract developer, I've been in many places and see many different methods of achieving this result, but the way I'm going is.. Presentation (web) Business Layer (old fashioned entity classes and BL layer) Data Layer (DA classe...

How often and with whom do you discuss design patterns?

At my workplace we don't often discuss design patterns, best practices, common pitfalls, etc. You're just expected to know what to do and avoid mistakes without much direction. This might be because we're an overloaded group of four full time developers however I feel in a shop of any size you should be actively discussing topics to im...

What methods should go in my DDD factory class?

I am struggling to understand what my factory class should do in my DDD project. Yes a factory should be used for creating objects, but what exactly should it be doing. Consider the following Factory Class: public class ProductFactory { private static IProductRepository _repository; public static Product Creat...

SQL Date pattern for dates that user may not know all the information

You system allows new users to register and enter their wedding date. Being a purist, I wanted to store this as a date. After user interviews, it was clear that the reality differs from this approach. Users are often not sure of the day or the month, and wish to store partial dates, so "June 2009" or "sometime in 2012". Does anyone know...

Java library class to handle scheduled execution of "callbacks"?

My program has a component - dubbed the Scheduler - that lets other components register points in time at which they want to be called back. This should work much like the Unix cron service, i. e. you tell the Scheduler "notify me at ten minutes past every full hour". I realize there are no real callbacks in Java. Here's my approach, i...

Elegant way to read business rules stored in XML file

I have to read business rules stored in XML file (I am using VC++/MFC/MSXML). XML consists of rules. Each rule has a set of conditions and actions. What would be an elegant OOP design for such system? What design patterns would you use if you where a designer of such system? update: Rules are put in sequence and executed one buy one if ...