Is there a project that maintains annotations for patterns?
For example, when I write a builder, I want to mark it with @Builder.
Annotating in this way immediately provides a clear idea of what the code implements. Also, the Javadoc of the @Builder annotation can reference explanations of the builder pattern. Furthermore, navigating f...
Is there a specfic Gang Of Four Design Pattern that you frequently use, yet hardly see used in other peoples designs? If possible, please describe a simple example where this pattern can be useful. It doesn't have to necessarily be a Gang Of Four pattern, but please include a hyperlink to the pattern's description if you choose a non-G...
I'm trying to teach myself how to use modern Persistence patterns (OR/M, Repository, etc) and development practices (TDD, etc). Because the best way (for me) to learn is by doing, I'd like to build some sort of demo application for myself. The problem is, I've got no idea what sort of application to build. I'd like to blog about my exper...
I've heard the term MVC (Model View Controller) tossed about with a ton of Buzz lately, but what really is it?
...
What is the benefit of using singleton instead of global for database connections in PHP? I feel using singleton instead of global makes the code unnecessarily complex.
Code with Global
$conn = new PDO(...);
function getSomething()
{
global $conn;
.
.
.
}
Code with Singleton
class DB_Instance
{
private static $d...
Since AS3 does not allow private constructors, it seems the only way to construct a singleton and guarantee the constructor isn't explicitly created via "new" is to pass a single parameter and check it.
I've heard two recommendations, one is to check the caller and ensure it's the static getInstance(), and the other is to have a private...
We need to implement a simple state machine in C.
Is a standard switch statement the best way to go?
We have a current state (state) and a trigger for the transition.
switch(state)
{
case STATE_1:
state = DoState1(transition);
break;
case STATE_2:
state = DoState2(transition);
break;
}
...
DoState2(int transitio...
3-Tier design has been my standard design philosophy for years for database driven applications, and it has never failed me. For those who practice it, describe your layers.
I've found that many people muddle up the business tier and the data access tier, making it more like a 2.5-Tier design.
I prefer to move the data tier almost enti...
Where do you put user input validation in a web form application?
View: Javascript client side
Controller: Server side language (C#...)
Model: Database (stored procedures or dependencies)
I think there is validation required by each level:
Did the user input a sane value
are dates actual dates, are numbers actualy numbers ...
D...
When should you NOT use a singleton class although it might be very tempting to do so? It would be very nice if we had a list of most common instances of 'singletonitis' that we should take care to avoid.
...
I've done some research into server push with javascript and have found the general consensus to be that what I'm looking for lies in the "Comet" design pattern. Are there any good implementations of this pattern built on top of jQuery? If not, are there any good implementations of this pattern at all? And regardless of the answer to tho...
Where did the idea of design patterns come from, who decided what is and isn't a pattern and gave them their names? Is there an official organisation that defines them, or do they exist through some community consensus?
...
I just found myself creating a class called "InstructionBuilderFactoryMapFactory". That's 4 "pattern suffixes" on one class. It immediately reminded me of this:
http://www.jroller.com/landers/entry/the_design_pattern_facade_pattern
Is this a design smell? Should I impose a limit on this number?
I know some programmers have similar...
The Singleton pattern is a fully paid up member of the GoF Patterns Book but lately seems rather orphaned by the developer world. I still use quite a lot of singletons, especially for Factory classes, and while you have to be a bit careful about multithreading issues (like any class actually) fail to see why they are so awful.
This site...
Following on from Ewan Makepeace 's excellent earlier question about the Singleton pattern, I thought I would ask "when does the Community believe that it is appropriate to use a Singleton?"
Let me offer up an example to critique:
I have an "IconManager" singleton. It begins by reading a properties file which indicates where my icons ...
OK, I'm not looking for anti-patterns - I'm looking for things that aren't really patterns, or perhaps patterns that have been abused.
My personal least favourite is the "Helper" pattern.
E.g. I need to create a SQL query, so call SQLQueryHelper. This needs to process some strings, so it in turn calls StringHelper. Etc., etc.
See - th...
The popular design pattern MVC (Model/View/Controller) has an extended cousin MVC-ARS (Action/Representation/State). The added components all live within the database layer and while are not part of the model, they are invoked by it. Details are as follows:
State, as in state machine. This follows the classic state machine pattern. ...
What are the alternative "design methods" to the Model View Controller? MVC seems to be popular (SO was built with it, I know that much) but is it the only method used?
...
Out of order execution in CPUs means that a CPU can reorder instructions to gain better performance and it means the CPU is having to do some very nifty bookkeeping and such. There are other processor approaches too, such as hyper-threading.
Some fancy compilers understand the (un)interrelatedness of instructions to a limited extent, a...
I have started using Presentation Model w/ ASP.NET webforms and like the pattern quite a bit. What I am really having an issue with is where to instantiate some of my classes, mostly the presentation model, my business object, and things like the data for drop down lists. So I could use some tips or a complete example of the Presentation...