A design pattern is a general reusable solution to a commonly occurring problem in software design.

learn more… | top users | synonyms (1)

1
vote
3answers
421 views

Figuring out the Call chain [closed]

Let's say I have an assemblyA that has a method which creates an instance of assemblyB and calls its MethodFoo(). Now assemblyB also creates an instance of assemblyC and calls MethodFoo(). So no ...
0
votes
1answer
390 views

In PHP, what are the different design patterns to implement OO controllers as opposed to procedural controllers?

For example, it's very straightforward to have an index.php controller be a procedural script like so: <?php //include classes and functions //get some data from the database //and/or process a ...
7
votes
4answers
459 views

How to prevent duplicate data access methods that retrieve similar data?

In almost every project I work on with a team, the same problem seems to creep in. Someone writes UI code that needs data and writes a data access method: AssetDto GetAssetById(int assetId) A week ...
2
votes
2answers
1k views

What Design Pattern is separating transform converters

For converting a Java object model into XML I am using the following design: For different types of objects (e.g. primitive types, collections, null, etc.) I define each its own converter, which acts ...
7
votes
3answers
1k views

Motivation for a service layer (instead of just copying dlls)?

I'm creating an application which has 2 different UIs so I'm making it with a service layer which I understood is appropriate for such scenario. However I found myself just creating web methods for ...
10
votes
1answer
971 views

So, “Are Design Patterns Missing Language Features”? [closed]

I saw, here on Programmers, the answer to this question: How does thinking on design patterns and OOP practices change in dynamic and weakly-typed languages? There I found a link to an article with an ...
0
votes
2answers
326 views

Software Architecture - From design to sucessful implementation

As the subject goes; once a software architect puts down the high level design and approach to a software that is to be developed from scratch, how does the team ensure that it is implemented ...
3
votes
4answers
3k views

C# Open Source software that is useful for learning Design Patterns [closed]

In college I took a class in Expert Systems. The language the book taught (CLIPS) was esoteric - Expert Systems: Principles and Programming, Fourth Edition. I remember having a tough time with it. ...
4
votes
2answers
391 views

What is the right way to group this project into classes?

I originally asked this on SO, where it was closed and recommended that I ask it here instead. I'm trying to figure out how to group all the functions necessary for my project into classes. The goal ...
17
votes
2answers
3k views

Equivalent of SOLID principles for functional programming

I've found the SOLID principles quite useful when thinking about object-oriented design. Is there a similar / equivalent set of language-agnostic principles tailored for functional programming?
1
vote
1answer
314 views

design pattern advice: graph -> computation

I have a domain model, persisted in a database, which represents a graph. A graph consists of nodes (e.g. NodeTypeA, NodeTypeB) which are connected via branches. The two generic elements (nodes and ...
5
votes
1answer
198 views

Is there a standard for machine-readable descriptions of RESTful services?

I've interacted with a few RESTful APIs that provided excellent documentation for humans and descriptive URIs, but none of them seem to return machine-readable descriptions of themselves. It's not ...
4
votes
2answers
240 views

Is it dangerous for me to give some of my Model classes Control-like methods?

In my personal project I have tried to stick to MVC, but I've also been made aware that sticking to MVC too tightly can be a bad thing as it makes writing awkward and forces the flow of the program in ...
2
votes
2answers
128 views

Testing of visualization projects

We develop small to large visualization projects for different tasks and industries and sometimes while rewriting them a couple of times in the process we hit walls because we discover that we need to ...
6
votes
2answers
2k views

Caching factory design

I have a factory class XFactory that creates objects of class X. Instances of X are very large, so the main purpose of the factory is to cache them, as transparently to the client code as possible. ...
11
votes
6answers
1k views

How to Be a Software Engineer? [duplicate]

My problem is kind of weird so please bear with me. I have been working in a start up concerned basically with mobile development since my graduation 2 years ago. I develop apps for iOS but it's not ...
1
vote
1answer
1k views

How can I implement a database TableView like thing in C++?

How can I implement a TableView like thing in C++? I want to emulating a tiny relation database like thing in C++. I have data tables, and I want to transform it somehow, so I need a TableView like ...
3
votes
1answer
988 views

Design patterns and multiple programming languages

I am referring here to the design patterns found in the GOF book. First, how I see it, there are a few peculiarities to design pattern and knowing multiple languages, for example in Java you really ...
0
votes
2answers
334 views

Approach on Software Development Architecture

I am planning to standardize our way of creating project for our new projects. Currently we are using 3tier architecture where we have our ClassLibrary Project where it includes our Data Access Layer ...
4
votes
4answers
2k views

Best Method of function parameter validation

I've been dabbling with the idea of creating my own CMS for the experience and because it would be fun to run my website off my own code base. One of the decisions I keep coming back to is how best ...
0
votes
5answers
511 views

what's the name of this pattern?

I see this a lot in frameworks. You have a master class which other classes register with. The master class then decides which of the registered classes to delegate the request to. An example based ...
17
votes
8answers
6k views

Interfaces on an abstract class

My coworker and I have different opinions on the relationship between base classes and interfaces. I'm of the belief that a class should not implement an interface unless that class can be used when ...
3
votes
3answers
1k views

iOS - Unit tests for KVO/delegate codes

I am going to design a MVC pattern. It could be either designed as a delegate pattern, or a Key-Value-Observing(KVO), to notify the controller about changing models. The project requires certain ...
6
votes
2answers
453 views

How to use DI and DI containers

I am building a small PHP mvc framework (yes, yet another one), mostly for learning purposes, and I am trying to do it the right way, so I'd like to use a DI container, but I am not asking which one ...
2
votes
3answers
659 views

High-Level Application Architecture Question

So I'm really wanting to improve how I architect the software I code. I want to focus on maintainability and clean code. As you might guess, I've been reading a lot of resources on this topic and all ...
1
vote
1answer
242 views

Is there a name for this use of the State design pattern?

I'm looking to see if there is a particular name for this style of programming a certain kind of behavior into a program. Said program runs in real time, in an update loop, and the program uses the ...
0
votes
2answers
1k views

A sample Memento pattern: Is it correct?

Following this query on memento pattern, I have tried to put my understanding to test. Memento pattern stands for three things: Saving state of the "memento" object for its successful ...
4
votes
1answer
2k views

Methodologies for Managing Users and Access?

This is something I'm having a hard time getting my head around. I think I might be making it more complicated than it is. What I'm trying to do is develop a method to store users in a database with ...
7
votes
3answers
847 views

Philosophy behind the memento pattern

I have been reading up on memento pattern from various sources of the internet. Differing information from different sources has left me in confusion regarding why this pattern is actually needed. ...
6
votes
2answers
1k views

Returning an IQueryable from an IRepository

Using the Repository pattern, is it proper to return an IQueryable of a data set (table), for generic usage? It is very handy in many cases, especially when using external libraries that leverage ...
9
votes
5answers
1k views

How to unit test a function that is refactored to strategy pattern?

If I have a function in my code that goes like: class Employee{ public string calculateTax(string name, int salary) { switch (name) { case "Chris": ...
39
votes
6answers
26k views

How essential is it to make a service layer?

I started building an app in 3 layers (DAL, BL, UI) [it mainly handles CRM, some sales reports and inventory]. A colleague told me that I must move to service layer pattern, that developers came to ...
3
votes
1answer
2k views

Low Coupling: Single Responsibility Principle vs Cohesion

I've read several articles on SRP and cohesion, and they seem to contradict each other as far as low coupling is concerned. Articles on cohesion argue that putting closely related responsibilities ...
4
votes
1answer
337 views

When designing an enterprise API, what level is appropriate for separating libraries?

Assume we are developing a REST system for an enterprise company to expose the companies resources in a Java based application. Ultimately you have one web application, and domain libraries. My ...
0
votes
1answer
239 views

Would this be considered dependency injection? [closed]

Would this be considered dependency injection, or delegation or object collaboration? https://gist.github.com/3428071
0
votes
2answers
332 views

Does there exist a design-pattern for this problem?

I have a big database of data which we can consider today's system. The data has a web front-end which allows my users to update the data. Let's call this "original solution" When new users come in ...
1
vote
0answers
186 views

Build filter conditions for entities on client side

I have the requirement that users should be able to specify filter conditions for one kind of entity through a GUI on a thin client. These conditions must be convenient to generate, meaning the GUI ...
2
votes
2answers
303 views

Dealing with units in arithmetic operations (multiplication and division)

I need to design a function to perform the basic arithmetic operations that are addition (+), subtraction (-), multiplication (x), and division (/) between 2 numbers. That function takes 3 arguments: ...
3
votes
3answers
2k views

How to use the unit of work and repository patterns in a service oriented enviroment

I've created an application framework using the unit of work and repository patterns for it's data layer. Data consumer layers such as presentation depend on the data layer design. For example a CRUD ...
3
votes
3answers
846 views

Object-Oriented Design: What to do when responsibility of the class is big

I applied principles of the GRASP and ended up having a class called Environment. This class's responsibilities are to: Keep information about services in the environment,i.e. environment definition ...
14
votes
5answers
26k views

Best way to load application settings

A simple way to keep the settings of a Java application is represented by a text file with ".properties" extension containing the identifier of each setting associated with a specific value (this ...
14
votes
3answers
1k views

How can you tell whether to use Composite Pattern or a Tree Structure, or a third implementation?

I have two client types, an "Observer"-type and a "Subject"-type. They're both associated with a hierarchy of groups. The Observer will receive (calendar) data from the groups it is associated with ...
2
votes
1answer
1k views

Extend functionallity of a class: inheritance or java's dynamic proxy

Currently I have three classes and respective interfaces and respective builders: Tree: the data structure (implemented in SimpleTree) ProbabilityTree: is a Tree with added functionality to randomly ...
10
votes
9answers
3k views

How to split large, tightly coupled classes?

I have some huge classes of more than 2k lines of code (and growing) that I would like to refactor if possible, to have some more light and clean design. The reason it is so big is mainly because ...
2
votes
3answers
2k views

Best practices / Design patterns for code generation [closed]

I'm working on a ground up code generator project, but I feel I might be reinventing the wheel. Does anyone know where I can find some best practices guidelines or design patterns for code ...
3
votes
2answers
217 views

How long does one have to wait to consider design change in code?

I had a few days ago. I was having trouble with threads. Had lots of questions asked on StackOverflow and honestly for the first time I did not get the answer I was looking for. Finally, I decided to ...
108
votes
15answers
34k views

Do I need to use an interface when only one class will ever implement it?

Isn't the whole point of an interface to for multiple classes to adhere to a set of rules and implementations?
8
votes
8answers
2k views

Is STL implemented with OO?

There are several design patterns like Adaptor, Iterator implemented in STL. Does that mean STL is implemented with OO concepts? What is the relationship between OO and template parts of C++? I ...
0
votes
1answer
347 views

NSNotificationCenter vs. Protocol

I am using MPMoviePlayerController in a project. The loadState of the MPMoviePlayerController object is observed using NSNotificationCenter. Why did Apple choose NSNotificationCenter in this ...
5
votes
3answers
2k views

Make use of design patterns in C? [closed]

Design patterns are useful for object oriented languages. But how can a non-object-oriented language such as C make of use them?