design-patterns

is wrapping log4net in a transversal layer to reduce coupling an antipattern?

is wrapping log4net in a transversal layer to reduce coupling an antipattern and have that injected into a public property an antipattern, how do you use it? Thanks, Oscar ...

What's an Aggregate Root?

I'm trying to get my head around how to properly use the repository pattern. The central concept of an Aggregate Root keeps coming up. When searching both the web and Stack Overflow for help with what an aggregate root is, I keep finding discussions about them and dead links to pages that are supposed to contain base definitions. In the...

Good design for persisting a JPA domain object

I have a domain object that stores some metadata and some raw bytes. This is used for storing binary objects such as PDF documents and images. I would like to persist the metadata in a database so it can be easily queried but I want to store the raw bytes in the file system for performance reasons. What is a good design for achieving th...

Strategy Pattern with Different parameters in interface (C#)

I am basically trying to implement a Strategy pattern, but I want to pass different parameters to the "interfaces" implementation (that inherit from the same object) and don't know if this is possible. Maybe I'm choosing the wrong pattern, I get an error similar to 'StrategyA' does not implement inherited abstract member 'void DoSomet...

Resources for Programmatic Rendering of Topology Maps

Servus, Do you know of any frameworks, APIS, languages, or other resources that are well suited for drawing topology maps that allow a user to interact with objects on the map? I am not constrained by language choice and the program can be web-based, or stand-alone. I thought I would check before rolling my own. My goal is not to d...

Does anybody recognize any pattern/antipattern in attached class diagram?

Short description: I have a doubt whether it's normal that AbstractCrudDaoImpl implements both interface and abstract class which are inherited from the same parent (ReadOnlyDao). ...

Building a three tier architectural model for a web application based on a provider model design pattern?

After just re-building my role-base security framework base on a custom provider design pattern, I thought it would be a nice approach to build an entire application framework based on the provider pattern (where the area of concentration would be between the BLL and DAL). Can someone help with a skeletal high level view on how these tw...

Qt signals and slots - are they intended for GUI only or for entire app architecture?

Hello. I'm very curious - are Qt's signals and slots (delegate patter?) intended only for GUI callback or they are perfectly fine and intended for entire app? I mean, is it better to split app into small, self-contained objects (classes) and interconnect them via signals and slots. And if so, what is the recommended way to return value ...

designing application classes

Besides using the Single Responsibility Principle, when designing classes for an application one is writing, what should one keep in mind, to keep the code maintainable, reusable and adhere to OOP principles? I'm finding it hard to design the classes of applications I'm trying to write, because when does one decide what (functionality) ...

how to avoid circular dependencies here

Is there a way to avoid circular dependencies, other than mixing modules, in a arrangement like this(it is a chess application) Long description: There is the Gui module wich imports a ChessWidget module; ChessWidget just wraps ChessWorld module and imports CellButton; The CellButton module imports the module Cell; The ChessWorld Mo...

Reactor, Leaders/followers , Proactor - Client/Server

Hey, I'm looking to implement a pretty scalable client-server program. I look into 3 patterns, and my conclustion were : Reactor - pretty efficient but i have 2 concerns : 1. doesn't take advantage of multipreccosor machine (it's basically single threaded) 2. if one of the hooking methods are blocking, the entire application is blocke...

How can we learn where and when to apply particular Design Patterns ?

I was just going through Design Patterns Questions on Stackoverflow and everyone mentioned about GoF- Design Pattern book and Head First Design Patterns book to learn them. My questions is how can we learn where and when can we apply particular Design Pattern. Are there any books or online resources which imparts this knowledge or wha...

SRP and a lot of classes

I'm refactoring some code I wrote a few months ago and now I find myself creating a lot of smallish classes (few properties, 2-4 methods, 1-2 events). Is this how it's supposed to be? Or is this also a bit of a code smell? I mean if a class does need a lot of methods to carry out it's responsibility, I guess that's how it's gotta be,...

Dialog required in different parts of program - design

I have a dialog, Authentication dialog, that is going to be required in different parts of my application. What would be the best design practice to be able to effeciently call the dialog and the logic behind it (seperate classes) in different points of the program? EG: User starts program - login required User wants to view encrypte...

How to design a Javascipt Library?

Hello guys, We have just started our new assignment - web-based project. Before I get directly on to the question it would be necessary to explain about the project. We are actually moving a product from desktop to web. This is it. All backend services are web services. Our choice of server technology will be .NET. As we are good with ...

Registry or Singleton

Hey! I am creating a small php framework and I have a few classes that use the singleton design pattern. Like for example my Session class uses the singleton pattern because in theory I will only really need one instantiation of the class. I recently discovered the registry pattern (actually new about it for a while but it sort of cam...

Best way to access global objects (like Database or Log) from classes and scripts?

I've read some related questions (1, 2), but none seemed fully adequate. What's the best way to access globally important objects in each class or .php script? A few examples: DB (database) Cache (memcache wrapper) Logger (custom) CurrentUser (details about the currently logged in user) Some options I've seen include: Relying on ...

Config type data: Static global variable or pass it around?

So I'm writing a bunch or multithreaded code in library that will run in the background. So I'm having the UI pass in SynchronizationContext object so I can Post events back to the main UI thread. Many different objects have public events the UI can subscribe to. I initially just add the SyncContext object as a parameter to the creati...

Is the Mediator must hold a view in PureMvc ?

Hi all i have one question about pureMvc. i uew pureMvc to build an engine, in the engine init part i have an requirement 1) moduleA must init firt 2) moduleB , moduleC need init after moduleA init complate. 3) moduleD need init after moduleB & moduleC init complate. 4) moduleA , moduleB , moduleC , moduleD all extends Proxy beacu...

How to manage small variations of data?

Hi, I am currently building a multiplayer system, and I have a design question about how to manage lot small variations of data between lot of objects. I'll start with an example: Let's say I have 3 players: A, B and C. A is friendly with B and enemies with C. That means, I must show C that A is an enemy and B that A is friendly. Now I ...