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

learn more… | top users | synonyms

-4
votes
0answers
20 views

Rich Model vs God Class [on hold]

I have a legacy code containing some behaviour classes, like services and controllers. My model is pretty anemic. It's just a repository of getters and setters, and I wanna refactor it. There is a ...
2
votes
1answer
73 views

Controller class pattern

The GetDropdownList() function is being called on a couple of controllers based on this example and it may be called in many other controllers, so this code is ...
2
votes
0answers
37 views

Unit of work with Repository pattern

I am trying to work on a WPF application and decided to go for Unit of Work and Repository pattern, along with MVVM. I am using Entity Framework as my ORM. Could ...
0
votes
0answers
35 views

Unit of Work by using Windsor Castle

I want to implement Unit of Work patter with the usage of Windsor Castle in order to controll the trasanctions and sessions. What I did till now is: My business class methods: ...
4
votes
1answer
60 views

Acyclic Visitor pattern

Here is my attempt at implementing the Acyclic visitor pattern from here in C++11. The aim is to obtain an implementation which is easy to use and avoids all the boilerplate as much as possible. I ...
1
vote
0answers
22 views

Viability of BLL/domain design, using nested classes and IoC

Just looking for feedback and opportunities to further simplify this BLL/domain-layer design. The target implementation would be as the middle tier between EntityFramework 6 and MVC 5. What I'd most ...
2
votes
1answer
99 views

Is this correct implementation of visitor pattern?

I tried implementing visitor patter and have questions about my usage of is and as keywords. Is there a big performance hit when ...
3
votes
3answers
70 views

Observer pattern implementation in C#

In order to implement the Observer pattern in C#, one of the ways to go (at least, the one I chose) is to make classes that implement the IObservable<T> for ...
1
vote
2answers
59 views

Implementing Search method For a Class

In my web app, I have a view where users can search in receipts and drafts. I've implemented this ability in search method at my view model, but I'm not sure if this is the best place to put it. So ...
3
votes
3answers
80 views

An immutable person

I am trying to model person in OOPS using immutability. I have created an object bond with age as 25. To change the age I have created a new object and returned it. ...
1
vote
1answer
60 views

Networking layer module

These two classes are part of a networking layer module that I am building: ...
1
vote
1answer
27 views

JavaScript class for a GameRoom

I am new to object oriented design with JavaScript and am trying to make a PublicGame class with some methods that puts itself in a map of games. It calls ...
1
vote
1answer
76 views

Class to represent playing card

I admit I'm sort of stuck on this. I couldn't think of a better way of representing the card value that will be used in a playing card game. How well thought out is the casting an enum value to an ...
3
votes
1answer
57 views

Dependency injection with Factory pattern sample code

I'm trying to understand and learn about the SOLID principle and especially Dependency Injection (DI) and Factory pattern. Some background: I have a production application that uses some "helpers" ...
2
votes
1answer
37 views

Storing option value

I currently have a design that is used to store user/selected options in a database, but I am not sure what I am doing is good or not. I need some opinion, suggestion and criticise on the design. ...
5
votes
2answers
81 views

Console application menu

Sometimes I need to write a simple Java console applications and menu look: ...
1
vote
0answers
62 views

Generic DAO implementation

I wrote a generic DAO and two DAOs extending from it. I'm new at this pattern so I'm not sure if I'm doing this correctly. It seems to work fine though. I am using Hibernate for database access. Here ...
2
votes
1answer
68 views

(Y.E.S.E.J.) Yet Another Singleton with Enum in Java

I have a Java class which has to be generated only once for all the objects that I have - it is a small program. This singleton class holds a mapping of characters. I Googled stack overflow and found ...
6
votes
2answers
186 views

CRUD commands to SQL database

I have a large application that focuses on using dependency injection. I've made a small (as I possibly could) piece of sample code to make this question more manageable. Essentially, I have a lot of ...
1
vote
2answers
24 views

From scratch pub sub definition and implementation

I am finished with my implementation of PUB/SUB or Observer pattern, however I just want to see any ways that I may be able to improve this pattern. I wanted to be able to use the typical ...
0
votes
1answer
53 views

Wrapping packet information [closed]

I am developing a network application and therefor need to specify the packets I want to send. I have a basic interfaces class and one for the packets that implement them. ...
1
vote
1answer
60 views

Laravel API design

I've been designing and coding my Laravel API boilerplate for couple days now, and I'd like to hear some advice/improvement hints! I'm pretty satisfied with the result, but I'm also aware, there ...
1
vote
0answers
46 views

Using the same RecyclerView.Adapter with a different ViewHolder

I would use the same RecyclerView.Adapter with two or more different fragments. Every fragment uses a different view items layout so I must use a different ...
3
votes
1answer
100 views

Creating items in a game

I've created some base classes for items, and I want to know how maintainable or expandable the method seems. ...
3
votes
2answers
66 views

Proper way to insert a record and assign the id to the Entity object

Scenario: I need to insert a record in a database and use the id resulting from that operation for every other operation needed. So I've created a class that contains all details of the object that ...
3
votes
1answer
64 views

Bash plugin to setup project for books

I'm writing a bash plugin to help people create books in a specific way. It's an ordinary shell script to setup the project and create its subresources. I'm using a loop to create barebones assets and ...
7
votes
2answers
624 views

Decorator for cars

Is this a good use of the decorator pattern? If not, why not? Is this a good idea to use for example when we have objects communicating with MVC through PHP or via ASP? To send data through the model ...
11
votes
2answers
317 views

Simple object oriented design of student system

I have created a simple system to get hands on experience with OOPS design and some features in Java: The system is: A ClassOfStudents contains Students A ...
4
votes
3answers
90 views

State machine implementation

I have written a simple state machine. Comments and feedback are welcome. ...
1
vote
0answers
41 views

Update operation with hibernate

I am creating a project about hotel reservations. I created a udirection one to many relationship between users and reservations. That is, A user can have many reservations. Here is the User class. ...
2
votes
1answer
62 views

Different data sources for UnitOfWork and Repository patterns

I was involved in some code-review discussions about UnitOfWork and Repository pattern implementation with EF, which put me in ...
4
votes
1answer
126 views

CRUD operation using Object relational model and Data Mapper pattern for a Matrimonial website

Database.php As the name says, it create connection and execute query. Although I think I should make it static/singleton class. ...
0
votes
0answers
33 views

Message construction dispatching and generation

This is going to be long on descriptions and a little shorter on code–my apologies, but I can't get too specific for various reasons. In some existing code that I did not write there are two main ...
2
votes
1answer
70 views

Basic CRUD application for Product, Category & Location with SQLite

I improved the code from my previous question. At this moment, the 3 entities have not yet a connection with each other. They should only be available for CRUD actions in a SQLite database. I would ...
3
votes
0answers
50 views

Decorator for setting up bracketing rootfinding functions

I'm looking for comments on the use of decorators for the following problem (validating initial guesses for bracketing rootfinding methods), as well as any other comments you might have on the design ...
2
votes
0answers
51 views

Flux & async communication with websockets

I want to arrange async server-client communication with websockets and vanilla flux architecture. There is an excellent article about "Async Server-Side Communication with the Flux Architecture". I ...
1
vote
2answers
62 views

Enumerate all items to find those that match a complex condition

Currently, I have a big for..loop with many if..else inside the loop. I just wonder is there any design pattern or other ...
2
votes
2answers
52 views

Library Class: Point - Follow up

This is a follow up of this post. Changes: I tried harder to make my code readable yet concise. All Point instances are immutable and unique. New, useful ...
2
votes
1answer
74 views
4
votes
2answers
73 views

ProductManager: a basic CRUD for products with SQLite

I would like to have a review of this basic CRUD application so I can improve and learn from your experience. The code can be found here. Design pattern/coding principles improvement that could be ...
2
votes
1answer
57 views

A selection pattern for C++11

In simulating physical equations (such as fluid dynamics) it is common to write an application that deals with 1, 2, and 3 dimensions. A common C/Fortran approach is to make all vectors (for example) ...
2
votes
2answers
64 views

C++ Optional Implementation

I haven't done much programming in C++, so I figured I'd try making an Optional class. I'm mainly concerned that I didn't follow good conventions or that I didn't ...
2
votes
0answers
46 views

Ember.js blog app architecture

I decided to create simple blog app by using Ember.js which should has the following interface For this purpose I created ...
1
vote
0answers
104 views

Simple Router class

I made a simple routing class that I like to get reviews for, mostly because I do not know how to make it SOLID, since I even made this class separate from the HTTP response/request for the sake of ...
3
votes
0answers
17 views

Monkey patch data in dictionary

The chart data is stored in a nested dictionary struct @line_charts, and I need to convert the prices to target currency with the function ...
3
votes
0answers
66 views

Event Aggregator Pattern Decoupling

I have an Android application that is using an EventBus architecture with publishing and subscribing events. Usually this is ...
4
votes
2answers
72 views

Printing gitignores

I have written a simple program in Java 7 to write the .gitignore of different file types: ...
1
vote
1answer
31 views

Input field that dynamically monitors model value

This question is regarding my approach to the following implementation requirement. Can you suggest a better alternative that doesn't suffer from the issues I'll point out in my implementation? ...
13
votes
3answers
1k views

RPG Character Builder

This implements a builder pattern for RPG game characters. Is this a valid builder pattern implementation? There are 3 characters: Paladin, Wizard and Elfo. There are 3 items: Potion, Sword, Arch. ...