A design pattern is a general reusable solution to a commonly occurring problem in software design.
0
votes
1answer
61 views
Memento with optional state?
EDIT:
As pointed out by Steve Evers and pdr, I am not correctly implementing the Memento pattern, my design is actually State pattern.
Menu Program
I built a console-based menu program with multiple ...
0
votes
0answers
8 views
Review of the testing code that I have written using easymock/junit [migrated]
I have these classes that have boilerplate way of initialization. So, instead of writing it each time, I wrote a class called MockUtil.java where I put the boilerplate mocks in there.
MockUtil has ...
2
votes
1answer
40 views
Is this considered an implementation of a Layer Supertype pattern?
1. According to Fowler's definition this pattern is implemented by having all classes in a layer inherit from a superclass. But after some googling it appears all of the following are considered as ...
3
votes
1answer
44 views
Wouldn't Layer Supertype pattern corrupt our domain model?
a) To my knowledge Domain Objects should for the most part be oblivious to technical aspects of a design. Since I view class inheritance as being a technical solution, wouldn't introducing a Layer ...
2
votes
1answer
98 views
Help me to understand following points about the strategy pattern, how it relates to open/closed principle
I am learning design patterns. I read this article. Point no. 3 is not clear to me. The writer said that strategy lets you change the guts of an object. But this is a violation of the open-close ...
1
vote
2answers
163 views
Is it a Single Responsibility Principle violation?
I'm designing an OO graph library and at the moment I'm trying to figure out the design for a GraphEdge class. I've added setters and getters for it's nodes, direction and weight. This seemes ...
0
votes
0answers
65 views
State Pattern - should a state know about its context?
I am referring to the state pattern as described in this link.
In the example class diagram, a context has numerous states. However, it does not show how does a state communicates with a context ...
1
vote
1answer
63 views
Design pattern for complex view creation in sheet music
I've got a bunch of Note-Models with properties like pitchand duration. In music notation, these notes must now be placed into a certain bar on a certain line on a certain page, and so on. Many more ...
-4
votes
0answers
35 views
software usage tracker application [closed]
from few days i have study few software which are using for create report for user application use time/ productivity time and many more advanced report. this type of services provided by this few ...
1
vote
3answers
180 views
Shall we always use IoC in our designs?
I was studying Mediator Pattern and I noticed that to use this pattern you should register the Colleagues into Mediator from the Colleague concrete classes. for that we have to make an instance of ...
-1
votes
1answer
122 views
How to reconstruct this application using design pattern
I am engaging in redesigning a linux c++ server application. The application acts as file relayer in the form of receiving file packets (incuding control packets and data packets) from client A, ...
5
votes
5answers
325 views
Why would a developer create a public class that has all static properties?
A previous developer has a couple public classes that do not inherit from any other classes but are filled with static properties. Is this another way of creating a struct or enum? Is this an older or ...
0
votes
1answer
68 views
Architecture for writing add-ins for closed-source software
currently I'm designing an add-in for the modelling tool Enterprise Architect. The general architecture is shown in the picture below.
Basically every action where the add-in can react to is ...
2
votes
4answers
293 views
Which design patterns would I use for this algorithm?
I need to create a string using the following algorithm:
Generate a GUID as a byte array.
Convert that GUID to a string.
From this string, get the UTF-8 encoding as a byte array.
From this byte ...
2
votes
2answers
64 views
Pattern to use for different Stages in a software
I am developing a software for a laboratory to test some devices. To test each device there are multi subtests which should be done to reach to the final result.To perform a complete test, the ...
4
votes
1answer
109 views
Difference between the Adapter pattern and the Proxy pattern?
As far as understand, the adapter pattern is creating a wrapper object for our real object of interest, simply one more level of indirection, which provides flexibility. the flexibility is in that, if ...
-2
votes
1answer
76 views
Which design pattern is the most appropriate? [closed]
I'm creating a game in which the user controls and helps grow a civilization. The user can unlock many kinds of technologies which will modify the civilization's behavior. There could potencially be ...
4
votes
1answer
104 views
OOP Design - Possible wrong approach makes it impossible to implement it in code
This last semester i've had lectures about OOP design, i understood most of what i was supposed to
but there is something that i can't get right.
I'm pretty sure that the models i create are wrong ...
1
vote
1answer
25 views
IXRepository and test problems
Recently had a doubt about how and where to test repository methods.
Let the following situation: I have an interface IRepository like this:
public interface IRepository<T>
where T: class, ...
2
votes
1answer
31 views
Scalable spring core with AMQP?
I use 3 standard Spring MVC war, which share a common core (Services, DAO, and Models).
The main problem is when I plan to deploy all the 3 wars on a same server. I have the Core Application Context ...
3
votes
1answer
63 views
Should I write a wrapper within a manager object?
I have three classes that work together to do one function (from the perspective of the rest of my program). There is a little bit of set up between them, so, to make it easier for the rest of my ...
3
votes
5answers
280 views
Tic tac toe class diagram
I'm in a software engineering class and I want to practice some skills on the most basic case possible : tic tac toe. I know this is overkill but I want to do it in "proper" OOP.
I designed a class ...
4
votes
2answers
105 views
How to delete an object when other things reference it (and not making the code full of inter-dependencies)
The situation:
In my program, there are a list of cues. To call a cue at a certain time, there are objects called Triggers. Cues have many public methods that allow them, among other things, to be ...
2
votes
3answers
195 views
MVC seems to create dependencies that just “don't feel right”
I might be misunderstanding MVC, so forgive me if that is the case.
This is my program structure (Java/Swing): I have a JTable (View) that is pointed to by a custom linked list (Model). When the user ...
1
vote
4answers
295 views
Why is the factory method design pattern more useful than having classes and calling them individually?
From the "Gang of Four" design patterns, there's the Factory method:
class Factory(product)
case product
when a
new A
when b
new B
when c
new C
end
new Factory(a)
Why is this ...
3
votes
3answers
106 views
Request - Reply vs Publish-subscribe
We are working on a integration between two large systems.
System A is a database with employee data, and System B is an external system that is used for the daily contact with the customers (i.e ...
2
votes
3answers
135 views
Automatically observing changes in database tables
currently I'm working on a project with the following setting:
There is a proprietary application which performs transactions on a Microsoft Access database (which is actually stored as an .mdb ...
1
vote
1answer
72 views
Design pattern advice required for sending xml files to different destinations
I am using an Export Module, now I want to extend it for different connections.
I have a database which contains products
Its Description, Review, Images etc. I use the serialize function to save it ...
6
votes
1answer
244 views
Object oriented vs vector based programming
I am torn between object oriented and vector based design. I love the abilities, structure and safety that objects give to the whole architecture. But at the same time, speed is very important to me, ...
-1
votes
0answers
50 views
RFC: implement a demo application for OO layout [closed]
I want to create a little demo application to show off and try out my developing "framework". So it should implement most of the use cases I have, be testable, easy to deploy and change. Usually I ...
1
vote
0answers
78 views
Creating a System Sequence Diagram from an [extended] use case
As I have been taught - one controller = one use case.
But I have:
OutsiderController
SupplierController (which extends OutsiderController)
SubContractorController (which also extentds ...
0
votes
2answers
121 views
Which could be a good design pattern for complex numeric calculations between three or more different data models?
The source code I'm working on at the moment performs numeric calculations between a bunch of different properties belonging to different data models. All the calculations are coded in a big method ...
0
votes
3answers
206 views
Object design where hard-coded values are used to instantiate objects?
I'm creating the design for a browser bookmark merging program and I've ran into a design problem that I've seen before yet I've never come up with a good solution for it. So lets say I have a ...
2
votes
1answer
83 views
Do I need JUnit tests for the controller layer on a MVC when I have a database layer
I have a MVC which has this structure:
ui
controller
db
model
Basically the controller doesn't really do much more than connection ui with db layer.
Do I need to provide JUnit tests for the ...
-2
votes
0answers
52 views
Design Patterns for Data Synchronization [closed]
I would like to know where I can find some design patterns for
data synchronization for data to be synchronized between an
android phone and a server. The client must be able to work
in both online ...
-1
votes
0answers
55 views
Design for ordering from a menu [closed]
I am working on my first app on Swing, an app for a restaurant.
There is a set of menu which contains items, that has to be selected by the user for the order processing. All the items are grouped in ...
0
votes
0answers
41 views
Design suggestion required to create an Export plugin
I am trying to create Export Module for our application, this seems to me a bit complex so I am posting it here
to get some guide lines.
In our database we have a list of Products, which can be ...
-5
votes
0answers
52 views
Application of Design Patterns for Legacy Code [closed]
I have been asked to put together a list of use cases where design patterns were applied to solve a particular requirement/feature in a legacy codebase. It has to be based on actual experiences that ...
2
votes
2answers
140 views
Saving user profiles in SQL database
So, I got a table UserProfiles in my database, that, similar to C#'s Settings file, holds a property with the appropriate datatype and the specified setting in the profile.
Now each time I add a new ...
0
votes
1answer
147 views
Where should I put my method
I am writing a Java program using the MVC design pattern.
I have classes Item and Supplier. In the database they are connected through a item_supplier table.
I'm writing a method which will give me ...
0
votes
1answer
47 views
How to record/store edits?
In many programs and web apps (stack exchange included) the program is able to backtrack what edits where made to the piece. My issue is similar: I want to be able to store a "timeline" of edits, ...
0
votes
2answers
137 views
Making a class pseudo-immutable by setting a flag
I have a java project that involves building some pretty complex objects. There are quite a lot (dozens) of different ones and some of them have a HUGE number of parameters. They also need to be ...
1
vote
1answer
66 views
What should the relation between parent and child GUI components be?
This seems to happen every time I create any sort of GUI. I have trouble figuring out how child classes should communicate to their siblings.
It's a general problem, but it's probably easier to use a ...
0
votes
3answers
137 views
What is the preferred access modifier for instance variables of a data transfer object?
I'm creating a data transfer object and can't decide whether it would be better to just give public access to the instance variables or if there would be a purpose to using getters and setters to ...
0
votes
0answers
107 views
Matrix Pattern Recognition Algorithm for a 2D space
I have a picture that I elaborate with my program to obtain a list of coordinates.
There is a matrix represented in the image.
In an ideal test I would get only the sixteen central points of each ...
0
votes
0answers
54 views
Using a Finite State Machine for access management?
My intranet site uses LDAP and Active Directory to authenticate users. There are 2 kinds of Users: Managers and Employees. They are differentiated by having membership in a particular AD group.
In an ...
2
votes
3answers
220 views
Is it completely impossible to have total separation without leakage of any kind in a design? [closed]
For the past week I have been attempting to write a proof-of-concept project using dependency injection, a service layer, unit of work pattern + repository.
I am looking to design something that can ...
4
votes
4answers
393 views
How to create different paths for users to take through the pages in my site?
I have a website where users are directed to go through a sequence of pages to perform a sequence of work tasks (transcribe a paragraph, answer a survey, interact with another user, etc). For short, ...
2
votes
1answer
86 views
design strategy pattern with null checking
When the context class can accept a null strategy, is there another way to do it without check if its null?
Is this considered a good strategy design implementation?
class MainApp{
static void ...
15
votes
5answers
753 views
Is this pattern bad? [duplicate]
I notice that when I code I often use a pattern that calls a class method and that method will call a number of private functions in the same class to do the work. The private functions do one thing ...