A design pattern is a general reusable solution to a commonly occurring problem in software design.
2
votes
3answers
195 views
Layering Design Pattern in Java clean code style
As a Java developer, I am developing trying to use the clean code rules. But in my team we are facing a concrete problem:
We have a business layer offering a service called "createObject", this ...
-4
votes
1answer
96 views
What book of Martin Fowler is must read for a good developer? [on hold]
I usually see links on Martin Fowler blog regarding design patterns and well, after looking on wikipedia, i found that he wrote a couple of books on them.
EDIT I've rewritten the question. Maybe I'm ...
0
votes
0answers
35 views
Separating Db from business with Inherited classes using multiple views
I have a software that has a car model that will be used in different views (listing, ads, detail page, carousel, up sell widget,etc).
class CarModel extends DbModel{
}
I look for a "nice way" (a ...
1
vote
1answer
97 views
Is there a name for the Builder Pattern where the Builder is implemented via interfaces so certain parameters are required?
So we implemented the builder pattern for most of our domain to help in understandability of what actually being passed to a constructor, and for the normal advantages that a builder gives. The one ...
0
votes
1answer
154 views
Entity Framework 5, separating business logic from model - Repository?
I am working on my first public-facing web application and I’m using MVC 4 for the presentation layer and EF 5 for the DAL. The database structure is locked, and there are moderate differences ...
1
vote
2answers
123 views
best way to send messages to all subscribers with multiple subscriptions and multiple providers
I'm writing an application in which -
Many users can subsribe to posts made by another users.
So for a single publisher there can be many subscribers.
When a message is posted by an user X, all ...
2
votes
7answers
402 views
Is there a pattern to restrict which classes can update another class?
Say I have a class ImportantInfo with a public writable property Data. Many classes will read this property but only a few will ever set it. Basically, if you want to update Data you should really ...
0
votes
0answers
71 views
Algorithms or patterns for a linked question and answer cost calculator
I've been asked to build an online calculator in PHP (and the Laravel framework). It will take the answers to a series of questions to estimate the cost of a home extension.
For example, a couple of ...
0
votes
1answer
177 views
how to improve design ability [closed]
I recently went on a couple of interviews and all of them asked a one or two design questions, like how you would design a chess, monopoly, and so on. I didn't do good on those since I am a college ...
0
votes
0answers
68 views
Syncing client and server CRUD operations using json and php
I'm working on some code to sync the state of models between client (being a javascript application) and server. Often I end up writing redundant code to track the client and server objects so I can ...
4
votes
1answer
419 views
Understanding Visitor Pattern
I have a hierarchy of classes that represents GUI controls. Something like this:
Control->ContainerControl->Form
I have to implement a series of algoritms that work with objects doing various ...
2
votes
1answer
106 views
Data Transformation Pipeline
I have create some kind of data pipeline to transform coordinate data into more useful information.
Here is the shell of pipeline:
public class PositionPipeline
{
protected ...
0
votes
2answers
174 views
Subclassing to avoid line length
The standard line length of code is 80 characters per line. This is accepted and followed by the most of programmers.
I working on a state machine of a character and is necessary for me follow this ...
3
votes
3answers
459 views
How bad is it to have two methods with the same name but different signatures in two classes?
I have a design problem related to a public interface, the names of methods, and the understanding of my API and code.
I have two classes like this:
class A:
...
function collision(self):
...
19
votes
6answers
792 views
Is an event loop just a for/while loop with optimized polling?
I'm trying to understand what an event loop is. Often the explanation is that in the event loop, you do something until you're notified that an event occurred. You than handle the event and continue ...
1
vote
0answers
100 views
Which are the best ways to organize view hierarchies in GUI interfaces?
I'm currently trying to figure out the best techniques for organizing GUI view hierarchies, that is dividing a window into several panels which are in turn divided into other components.
I've given a ...
-1
votes
2answers
115 views
New to Java and Spring. What are some good design principles for an inexperienced java developer like me? [closed]
I am learning Java and have written a few small useful programs. I am new to spring but have managed to understand the concept of dependency injection for decoupling. I'm trying to applying that in my ...
4
votes
4answers
245 views
Rails: Law of Demeter Confusion
I am reading a book called Rails AntiPatterns and they talk about using delegation to to avoid breaking the Law of Demeter. Here is their prime example:
They believe that calling something like this ...
2
votes
0answers
171 views
How do you usually manage callbacks in Java using Swing library? [closed]
I'm quite new to the Java Swing programming, and GUI development as well.
As a beginner, I'm currently reading Design Pattern, but finding what I'm looking for is quite hard, most of the times.
So ...
2
votes
5answers
460 views
Web programming, standard way to deal with a response that takes time to complete
With normal form submission I use the pattern Post / Redirect / Get, when processing the forms.
I have a database application built with Django. I want to allow the users to select a number of items ...
0
votes
1answer
74 views
How are the forwarding of requests normally managed in the Chain of Responsibilty pattern? [closed]
I was just experimenting with the Chain of responsibility pattern, implementing my own version.
I'm currently reading Design Patterns, but I'm not really sure whether DP tells to stop your ...
4
votes
3answers
241 views
When to use repository pattern
I have read recently that it is not good practice to use the repository pattern in conjuntion with an ORM, from my understanding this is because the abstraction they provide over the SQL database is ...
1
vote
1answer
169 views
Should Uncle Bob's example be refactored to an AbstractFactory or a SimpleFactory?
In the book "Clean Code" Robert Martin makes a statement regarding the following code:
public Money calculatePay(Employee e) throws InvalidEmployeeType { switch (e.type) {
case COMMISSIONED:
...
5
votes
3answers
360 views
What the best way to wire up Entity Framework database context (model) to ViewModel in MVVM WPF?
As in the question above: What the best way to wire up Entity Framework database model (context) to viewModel in MVVM (WPF)?
I am learning MVVM pattern in WPF, alot of examples shows how to implement ...
3
votes
7answers
533 views
Is it a bad idea to create a class which will only have one instance?
Is it bad coding practice/design to make a class which will only be instantiated once?
I have some variables and functions that can be grouped together under a class to "look good" (for a lack of a ...
4
votes
2answers
326 views
.NET MVC project architecture / layering
When planning the architecture for a mid-large scale MVC web application how do you implement the layers to be as decoupled as possible and easy to test? (basically follow best practices) Let's say ...
0
votes
1answer
72 views
Properly structure an existing project into the MVC architecture
I'm taking a legacy classic asp project up to more modern technology (I've been working with ASP.NET MVC lately so using this concept is stuck in my mind), but I'm trying to think of how to structure ...
6
votes
3answers
286 views
What's is the point of PImpl pattern while we can use interface for same purpose in C++?
I see a lot of source code which using PIMPL idiom in C++. I assume Its purposes are hidden the private data/type/implementation, so it can resolve dependence, and then reduce compile time and header ...
-1
votes
2answers
137 views
Generics vs IoC [closed]
One of the "Service Locator" pattern drawbacks is that a caller can be misleaded about dependencies of a callee.
Ok, but what if I put dependencies as generic parameters at a class level:
class ...
1
vote
1answer
145 views
Client-server application design issue
I have a collection of clients on server's side. And there are some objects that need to work with that collection - adding and removing clients, sending message to them, updating connection settings ...
1
vote
1answer
197 views
Design Issue: Service layer/ trying to maintain RESTful architecture
I'm trying to design a web-application - and after doing a lot of reading on REST + design patterns, I'm at a loss on how to handle my requirements. I think I may be getting caught-up in all the ...
1
vote
0answers
69 views
How should Object Model wrapper classes behave when underlying objects are deleted?
I'm currently building an object model library for use in a project. It wraps our internal concepts - Servers, Folders, Items - in an object hierarchy (IFolder, IItem, etc), and we have several ...
0
votes
1answer
95 views
Datastructure for a factory pattern in practice
I'm implementing what's basically an event log system for a larger system. I used Single-table inheritance to build out the table.
The problem I'm having is figuring out how to build out the classes ...
1
vote
1answer
68 views
Discovering functionality from parallel class hierarchy
I have an abstract syntax tree which I want to compile down to different representations. I am now struggling to arrange the classes in a way that new representations can be added easily.
The easiest ...
1
vote
2answers
125 views
Validation and data persistence in a domain model
My (first and current) workplace (a .NET shop) suffers from an over-abundance of anemic domain models, to the extent that I don't really know how validation and data persistence should be handled in a ...
2
votes
3answers
159 views
Is it good practice to not filter values according to nullability?
Sometimes when I create an API that should enable getting a single value or all values I use the following pattern (passing NULL to the API, means get all rows):
@Usernames - comma separeted list of ...
1
vote
1answer
92 views
Task Consumer/Processor architecture
PROBLEM
We have various tasks in our system which can take up to 20 minutes. These tasks are generally started from the web interface and run on a new thread. This is obviously a terrible solution ...
1
vote
2answers
143 views
Loadbalancing and failover in code
I have HTTPS based webservices (not REST, rather old code). I am generating Java client stubs using Axis & using that to call the webservices. There are around 20 different APIs on the webservice. ...
1
vote
1answer
178 views
Best practices for refactoring parameter file structure in multiple environments
Background info and what I've tried
Within each of two mostly distinct environments, say 'Research' and 'Production', there is a need for a structured parameter file. The file contains things like ...
15
votes
8answers
1k views
Is Dependency Injection worth it outside of UnitTesting
Given a constructor that will never, ever, have to use any different implementations of several objects that it initializes, is it still practical to use DI? After all, we might still want to unit ...
1
vote
2answers
139 views
Pattern / methodology for representing large database records as objects
A bit of background information: We have an old database application written in Access that lets users monitor their workload, and the code is... 'procedural' might be too kind. The vast majority of ...
1
vote
1answer
77 views
Optimized Special Character Escaper vs Matcher/Pattern
I need to escape special characters which are sent to apache lucent.
Since the code will run on a production server I want the code to be the fastest possible.
I've seen multiple ways to do it:
...
1
vote
2answers
320 views
A better alternative to incompatible implementations for the same interface?
I am working on a piece of code which performs a set task in several parallel environments where the behaviour of the different components in the task are similar but quite different.
This means that ...
3
votes
1answer
166 views
Naming a sending/receiving module. Does the pattern have a name? [closed]
I'm working on a simple piece of functionality (actually a ruby gem, but that is beside the point) which can be used to
receive and persist incoming messages
send and persist outgoing messages
...
0
votes
0answers
69 views
Recaching calculations
I'm working on a webapp which has an existing framework to cache values from the database. I have a requirement which needs multiple values from the database and the values have to be ...
0
votes
1answer
127 views
Design pattern for locking asynchronous operations in Objective-C
I'm writing my first Objective-C Class. It's responsible for interaction with an HTTP SSO authentication service.
The process requires multiple HTTP transactions in order to complete. The Class acts ...
1
vote
1answer
287 views
Is the Entity Component System architecture object oriented by definition?
Is the Entity Component System architecture object oriented, by definition? It seems more procedural or functional to me. My opinion is that it doesn't prevent you from implementing it in an OO ...
-2
votes
1answer
156 views
DDD/SOA Using .NET Message pattern(s) / Request Response with File Saving [closed]
I've done some research on this but I can't find more specific examples to help me with this. I'm new to SOA/Patterns in general please take it easy... :)
Can you display an example of using the ...
1
vote
1answer
63 views
how to model a connection to a resource, with rudimentary event processing
For my simple MUD client I'm using Apache Telnet (no, not ssh). A mud client is a strange beast:
Generally, a MUD client is a very basic telnet client that lacks VT100 terminal emulation and the ...
16
votes
4answers
2k views
Is it ever a good idea to use the design pattern name in the implementing classes?
Recently I came across a moderately large python codebase with lots of MyClassAbstractFactory, MyClassManager, MyClassProxy, MyClassAdapter etc. classes.
While on the one hand those names pointed me ...