When building big GUI based applications in other languages like C# or Java, we have various patterns like MVP, MVC, MVVM, and even complete guidance packages like Prism (WPF/Silerlight) that help us keep our code maintainable, extendable and keep the complexity of the application at a sane level.
But when it comes to big RIA applicati...
I recently read a post on "The Anemic Domain Model Pattern" which caught my attention. As I read though this I found that the Anemic Domain Model description applied to many of the projects that I have worked on and built. I never thought of this as a bad design decision as it felt very natural. I thought that in the case where the do...
Given a class hierarchy like this one:
a package tree
would it be a good idea to have a class that helps in creating the objects? E.i. a class with methods that correspond to each class that can be created (method equals() returns a CompareCriteria eg).
The advantage I see is that it would hide away the complex inheritance structure and ...
Class hierarchies and constructors are related. Parameters from a child class need to be passed to their parent.
So, in Python, we end up with something like this:
class Parent(object):
def __init__(self, a, b, c, ka=None, kb=None, kc=None):
# do something with a, b, c, ka, kb, kc
class Child(Parent):
def __init__(sel...
I have a relatively complicated generic type (say Map<Long,Map<Integer,String>>) which I use internally in a class. (There is no external visibility; it's just an implementation detail.) I would like to hide this in a typedef, but Java has no such facility.
Yesterday I rediscovered the following idiom and was disappointed to learn that ...
I've always thought having a class just for the sake of holding constants is a bad design. But recently, I've tried googling for it and found only that having an interface as a constants is bad an anti-pattern - no mention of using a class of constants.
I'm of the opinion that since a class of constants is really not much different from...
What are most common Ruby on Rails antipatterns and how to avoid them?
...
According to this post, requiring rubygems is an antipattern.
require 'rubygems'
The argument seems to boil down to this:
When I use your library, deploy your
app, or run your tests I may not want
to use rubygems. When you require
'rubygems' in your code, you remove my
ability to make that decision. I
cannot unrequire ru...
I've recently overheard people saying that DTOs are an anti-pattern. Can someone please explain why? What are the alternatives?
...
As a Git newbie, I realized that I have been using it as if it were Subversion. e.g. always working on master, not committing locally before pulling changes etc. This often results in avoidable manual merge situations. What are other common antipatterns of using Git?
...
What is the name for passing an argument to a function to select what the function does?
For example:
enum {
DoSomething,
...
};
void f(FunctionType a);
f(DoSomething);
....
f(DoSomethingElse);
Vs:
void DoSomething();
....
void DoSomethingElse();
...
In the database you have a table with a bit field, let call that field Active
In the application you have a variable boolean, let call it NotActive
Everytime you get the field from the table, in the application you have switch the meaning of the variable.
NotActive = !mytable.active;
Another example would be a bit field in the datab...
Possible Duplicate:
Common programming mistakes for .NET developers to avoid?
To cut a long story short: I find the Java antipatterns an indispensable resource. For beginners as much as for professionals. I have yet to find something like this for C#. So I'll open up this question as community wiki and invite everyone to share t...
I discovered this pattern (or anti-pattern) and I am very happy with it.
I feel it is very agile:
def example():
age = ...
name = ...
print "hello %(name)s you are %(age)s years old" % locals()
Sometimes I use its cousin:
def example2(obj):
print "The file at %(path)s has %(length)s bytes" % obj.__dict__
I don't ne...
Too often I find myself building selectors with string manipulation (split, search, replace, concat, +, join).
Good or bad?
...
I understand from this post, that it's an anti-pattern to modify Object's prototype in JavaScript. I was curious, however, if it's widely considered to be an antipattern to modify other 'built-in' prototypes.
For example: say we wanted to add a setPixel(x,y,color) function to CanvasRenderingContext2D - to abstract out the duty of get...
I'm relatively unskilled in Dependency Injection, and I'd like to learn some best practices and anti-patterns to use and avoid respectively when using DI.
...
I am doing an anti-virus project by disassembling its code and analyzing it.
So i want a list of the Suspected Malicious pattern codes, so i can observe which is suspected and which is not?
so i want a list of suspected patterns only.
Thank You for your Help.
Abdelrahman.
...
(except for proxy setup!)
I spent some time writing a question here regarding a better pattern for a problem I had - of a class that performed some conditional initialization on almost every property getter, since the initialization in the base class relied on data from the inheriting classes that wasn't available on construction.
Whil...
Being confused again after reading about this anti-pattern and the many concerns about it here on SO.
If I have a domain model and capture the data that must be persisted in a data transfer object, does that make my domain model a wrapper around the data? In that case I would be using an anemic domain model. But if I add enough domain l...