A design pattern is a general reusable solution to a commonly occurring problem in software design.
3
votes
2answers
61 views
What is the meaning of “inversion” in `Dependency Inversion Design Principle
I'm reading Design patterns. I know what this principle do. high-level and low-level classes are depend on abstractions. But why we say this inversion?
0
votes
1answer
11 views
Program Structure for Table Cells Representing Objects
So I have a program with "cue" objects and each have their own table cell. The thing is that the table cells have loading bars on them that represent the progress of the cues. This presents the ...
-2
votes
2answers
69 views
Calling blocking functions and execute code when result is ready, but without callbacks
I am designing an application that has some scripting capabilities: the host application may call the scripts to perform some operations when some events occur. To keep it easy and newbie-friendly, ...
0
votes
1answer
66 views
What is a good design for a container, assignment and items
------------- 1 * -------------- * 1 --------
| Container |--------| Assignment |-----------| User |
------------- -------------- --------
^ ...
0
votes
2answers
64 views
Converting Business Process Maps into Software
I am fairly new to web application development. I have defined my problem domain through talking to various stakeholders and putting a process map together - basically a flow chart showing the ...
1
vote
0answers
76 views
Fluent interface implementation and reflection. Case study
I hope I picked the right group for this question...
I have this little framework I want to implement and I would like to have an opinion on it. In particular I am more concerned about the ...
2
votes
2answers
152 views
How to use MVC in practice
I'm very confused. I can't even begin to understand how MVC would be implemented outside of web development. This might seem like too general a question, but how would one apply MVC. I have the ...
7
votes
2answers
145 views
How to maintain synchronised state across threads - is this a good use for a Singleton?
I hear a lot about "Singletons are always bad" around the place. I don't hate on them to that degree but I try not to use them if I have a better alternative.
In this case I have a system that ...
2
votes
3answers
132 views
Using a database for each module in a system [duplicate]
I was reading this question:
I was trying to standardize and modularize some functions (Email
Management Module, CMS Module & etc) by implementing a 3-tier
architecture concept where each ...
1
vote
2answers
70 views
Exposing a Disposing event
I'm implementing a .NET class which implements IDisposable. After being disposed, the object's state is invalid and so nobody should be accessing it, of course.
There are some situations where two ...
1
vote
0answers
58 views
design practice for business layer when supporting API versioning
Is there any design pattern or practice recommended for business layer when dealing with multiple API version.
For example, I have something like this.
http://site.com/blogs/v1/?count=10
which ...
2
votes
2answers
161 views
Programming style in Perl
I work in Java so basically I use OOP paradigm during coding.
I am about to start working in Perl and I was wondering what is the paradigm that Perl developers follow.
In wiki it mentions that it ...
-5
votes
1answer
116 views
Singleton: Is Singleton Pattern Evil/Stupid [duplicate]
Was reading an interesting blog post on Singleton design pattern which is so widely used.
If it's stupid or as in some quora posts, its an anti-pattern why is it so widely used even in frameworks.
...
8
votes
2answers
226 views
What's the practical difference between the styles of dependency injection?
I'm new to dependency injection and I have a few questions about which style I shouldI use in my applications. I've just read Inversion of Control
Containers and the Dependency Injection pattern by ...
4
votes
2answers
185 views
Can REST API be used as business layer?
I am using PHP Codeigniter MVC design pattern
and I had this project with some sort of specific business processes
In my application I will be dealing with 2 existing REST APIs:
Google
Trello
...
1
vote
3answers
198 views
What is the difference between polymorphism and factory method? [closed]
Can I say that polymorphism is same as factory method?
EDIT: So basically I can say that a factory method is used to determine at run time which object is required whereas polymorphism already knows ...
1
vote
2answers
95 views
Client Server .NET application with queuing message
I am new, so forgive me if my question is mistaken or anything, just give me an alert and I'll be glad to fix it.
Me and my team is about to develop a system where the database is located in a ...
1
vote
0answers
89 views
Educating Teams - Software Craftsmanship and Best Practices [closed]
I'm part of a team that's responsible for trying to spread better coding practices to other teams. These ideas are things like software craftsmanship, professionalism, learning new technology, ...
0
votes
1answer
81 views
How to design member access for an Article-type class?
I am doing a final project in a C++ class writing a very simple usenet-like client/server. I figure that since it's usenet-like I'll have a NewsGroup class and an Article class, I'm now working on my ...
2
votes
3answers
317 views
Is wrapping byte[] for stronger typing good practice?
I'm working on a Java-based library which makes use of PKCS #10 requests. There are PKCS #10 libraries available for Java (Sun and IBM libraries that come with the respective JDKs), and the ...
1
vote
0answers
34 views
Design pattern for sharing Social Authentication across subdomains?
Right now building an app that authenticates using either email or different social accounts. Because it is going to function on multiple subdomains and domains, I'm wondering if there's a design ...
0
votes
2answers
82 views
Implementing Context-based Undo/Redo Functionality
I'm currently implementing an undo/redo mechanism using the Command Pattern. Everything works so far. My problem now is to implement the undo/redo functionality in a way that it is bound to a given ...
5
votes
2answers
218 views
Which design pattern is illustrated by inheriting IStructuralComparable interface?
We know that some design patterns are found so useful that they become features of the language itself.
For instance, the interface IEnumerator which is implemented by Array object.
This helps in ...
-2
votes
1answer
130 views
What design patterns does every developer need to know [closed]
I was wondering what design patterns every developer, no mather what dev language, should know and why?
11
votes
2answers
391 views
.Net developer trying to learn ruby on rails
I am a .NET developer and I just had the chance to play with Ruby on Rails this weekend.
In .NET we separate layers of the application by creating separate class library projects. From the design ...
9
votes
4answers
336 views
Command pattern design
I have this old implementation of the Command pattern. It is kind of passing a Context through all the DIOperation implementation, but I realized later on, in the process of learning and learning ...
4
votes
2answers
154 views
Designing a function with many optional components
I'm trying to figure out a good practice for designing a function with (many) optional components.
For a specific example, say I am interested in designing a feature extractor function that takes as ...
3
votes
1answer
83 views
Are Request/Response Parameter Wrappers Good Practice?
I've seen several different ways to design WCF services, and it seems some developers prefer parameter wrappers while others favor 'naked' parameters. To explain what I mean, consider the following ...
1
vote
1answer
68 views
In an event-driven environment, how should a “cancel” function abort all further events?
In my iOS app, things are mostly driven by events.
The user presses a button
The app listens for an external device to be connected to the iOS device
Once the device is detected (is connected), an ...
3
votes
2answers
87 views
Is every page a new view?
I just started building an iOS app and wanted to get some feedback regarding views.
I've got specs for
Activity Page
Activity Recording
Activity Create
Activity Save
Each of the specs show a ...
2
votes
1answer
209 views
What kind of abstraction/SoC should I use here?
I am starting a new project, and I want to follow the separation of concerns pattern, and I have been reading on the topic, and now I am in doubt of how I should go about this.
Here is how I ...
4
votes
2answers
205 views
Preventing Liskov Substitution violation
I am reimplementing some component and noticed that the original version has a Liskov Substitution violation. It's not all that critical, though I'd like to get rid of it in the new implementation . ...
6
votes
2answers
362 views
Is there a name for this design pattern?
I don't like singletons, but I have to compromise now (but only as temporary measure).
However I don't want to go completely singleton. I'd rather want to use this pattern:
interface ...
1
vote
1answer
48 views
How to selectively update properties of an object on the server
I have a GWT website that displays some data onto the client in a tabular form. Some of the fields are editable, when any change is made the save button becomes active.
There are multiple properties ...
20
votes
6answers
828 views
How to avoid giant glue methods?
In my current job, I've been tasked with cleaning up old code a few times. Often the code is a labyrinth and the data behind it is even more tangled. I find myself combing out things into nice, ...
4
votes
3answers
183 views
Using the mouse as a multi-tool creates heavy conditional logic for executing commands, how do I change this?
The feature is in many different types of editing programs where a mouse click may have completely different commands to execute (using the Command Pattern)
Currently I have an overarching ...
6
votes
1answer
63 views
Ledger or log design for a point-based system?
Right now creating a new service that will integrate into our company's existing platform. The service will be responsible for tracking "points" that a user can generate over time through certain ...
1
vote
1answer
95 views
What is a general solution to allow the client to choose the concrete instance of a method output?
What is the general solutions to allow the client to choose the concrete instance of a method output?
For example, in the Lucene API the search method receives and modifies the collector input ...
1
vote
1answer
100 views
Designing status management for a file processing module
The background
One of the functionality of a product that I am currently working on is to process a set of compressed files ( containing XML files ) that will be made available at a fixed location ...
2
votes
1answer
113 views
Terminology for class
I am integrating with a Financial Management System (FMS). I have a class that prepares a set of objects (each of these objects is called a TransactionEntity). These are then passed to the FMS.
I give ...
7
votes
2answers
131 views
How would I combine 'Command' and 'Composite' to simulate a time delay?
As a learning exercise (I am not in school - just an old guy trying to learn something new), I am trying to write a logic gate simulation that incorporates propagation delay. The user should also be ...
3
votes
7answers
277 views
Are design principles important, and if so, why don't more people use them? [closed]
I am a developer who works for an in-house information communications technology (ICT) department.
I am usually quite critical when looking over code that I have not written as I find time and time ...
6
votes
4answers
320 views
How to use Dependency Injection in conjunction with the Factory pattern
Consider a module that is responsible for parsing files of any given type. I am thinking of using the strategy pattern to tackle this problem as I have already explained over here. Please refer to the ...
2
votes
2answers
73 views
Template method within one class without subclasses or inheritance
I have an algorithm with mostly invariant parts that needs to be reused within one class so as to stay DRY.
Code duplication with repeating method structure
public void save(String key, int value) ...
21
votes
5answers
1k views
How do I convince my boss (and other devs) to use/consider Unobtrusive JavaScript
I'm pretty new in our develepors team.
I need some strong arguments and/or "pitfall" examples, so my boss will finally understand the advantages of Unobtrusive JavaScript, so that he, and the rest of ...
0
votes
3answers
117 views
Changing behaviour of abstract class without modifying subclasses
I am facing a problem with changing behaviour of a library (thus cannot or don't want to change its internals because of future updates, etc.).
In this library there is an abstract class which shares ...
1
vote
5answers
205 views
Naming for a class that consumes an iterator pattern [closed]
The iterator pattern is very clearly defined. What would you call the consumer of an iterator?
1
vote
3answers
143 views
Is this Observer variant an improvement?
In a C++ code base I've been working on, they have a bunch of instances of the observer pattern, but it's a little different from the classical pattern. In the classic, the Observer is a specific ...
7
votes
3answers
640 views
What is the principle of least astonishment?
In programming what is called Principle of Least Astonishment? How is this concept related to designing good APIs? Is this something applicable to only object oriented programming or does it permeate ...
3
votes
2answers
272 views
Context class in Strategy pattern
I'm trying to understand the strategy pattern and asking myself: is the context class must-have or can I leave it out without compromising pattern's purpose ?
I was under the impression I needed some ...