Design in programming is the act of making particular choices about how best to structure a program, to achieve goals of reliability, maintainability, correctness or ease of use.

learn more… | top users | synonyms

0
votes
1answer
17 views

Custom template iterator on CSV reading class

I made myself this code to read CSV files as I want to delve into machine learning. I do think that my code design is poor but I can't quite see why. The syntax of it does not feel right. I want to be ...
3
votes
1answer
50 views

Very simple implementation of observer pattern in C++

I'm reading on design patterns for a software engineering class. I am doing small implementations of some I find the most interesting / applicable to better understand them. I'd like a code review on ...
3
votes
2answers
96 views

Looking for a better solution to my OO code

I would like if this could be kept to a post providing concrete examples of how I could solve my problem better, and not about which one would be "best" as such :) I would simply love some insight to ...
3
votes
2answers
80 views

Does this violate the SRP?

I just finished (re)reading Clean Code, and one of the ideas I learned was the SRP. However, I am not quite sure on what defines a "Single Responsibility." In the piece of code below, I have a Note ...
-1
votes
0answers
11 views

Design for recurring workorder system [closed]

I'm hoping for advice on designing a workorder system that has to support recurring workorders. For example, An administrator needs to be able to set a workorder to repeat in a unit of time like every ...
3
votes
1answer
52 views

framework design review (SOLID)

I'm developing a php framework for educational purposes, I have learned a big deal about design patterns and MVC. I've been thinking a lot on how to have a nice design and so far I've come up with ...
0
votes
0answers
38 views

How to implement MVC on the application scale?

I'm developing a simple conferencing app with a Swing standalone client which connects to enterprise java beans. Users can create "sessions" (conferences) on the server, and then can join those ...
2
votes
2answers
83 views

How to design interface of deep-copy behaving pointer containers?

I want to make a container which manages big objects. which performs deep copies on copy construction and copy assignment. I also like the interface of the std containers, so I wanted to implement it ...
-1
votes
0answers
30 views

my failed solution for sales tax calculator [closed]

Recently I have been on the last stage of an interview process where I was asked to provide a solution to this tax calculator problem ...
2
votes
1answer
39 views

Applying DocumentListener on multiple JTextField

Say I have 5 JTextField: jTextField1, jTextField2... Now I want them to behave the same on DocumentListener, so I decided to make only one DocumentListener and set it to the 5 components. Meanwhile ...
1
vote
1answer
86 views

A database schema for an online rental store

I am creating an online rental store using the following: JSF 2.1 Hibernate 4.2 Spring 3.2 MySQL 5.5 Below is my database schema design: Link in case image not displayed. The rental user has ...
1
vote
0answers
20 views

Skeleton SASS Feedback and Review

recently I have been developing a SASSified version of Dave Gamache's Skeleton CSS front-end framework. I have publicly posted the code on github which can be found here as well as a live demo. What ...
6
votes
3answers
509 views

Which of these two java class designs is better and why?

Example 1: public interface Adder { public int getSum(); } public class AdderImpl implements Adder { private int v1; private int v2; public AdderImpl(final int v1, final int v2) { ...
1
vote
0answers
38 views

Design issue with decoder class

I'm designing a C++ Decoder class for decoding a format, and would like some feedback on my design choice: I want the user to be able to provide input to the decoder by either supplying an array, a ...
2
votes
1answer
76 views

How to create a simple stateless cache class in PHP

i need to create a cache class to avoid making the same calculations more than needed. My idea was something really basic like class transient_cache { static private $cache = array(); static ...
6
votes
2answers
215 views

python: design of a simple game

I am trying to code Battleship. It should be a text one-player game against computer where computer and human player take turns in shooting at opponent's ships. I decided to start implementation with ...
1
vote
1answer
30 views

Designing a RESTful API for a 3D Printer

I'm implementing a REST API to manage a 3D printer, it will add a layer to the system so instead of sending GCode commands (the language the controller understands) directly to the controller (an ...
1
vote
2answers
49 views

A Generic NHibernate wrapper with transactionality

My team and I wrote the following Nhibernate wrapper which gives generic retrieval and save/update functions and a possibility to send a function as a paramater which may contain several save/update ...
6
votes
2answers
119 views

Generic wrapper for equality and hash implementation: Is there a way I can make it more efficient?

I was writing an answer in another thread and came across this challenge. I'm trying to have a generic class so that I can delegate the routine (and tiring) Equals and GetHashCode implementation to it ...
1
vote
1answer
64 views

How to simplify code for display member functions?

For my display functions in my Blackjack game, I want to control each player's stats output based on whether a turn is in progress or has ended. Normally, you could only see one card that your ...
2
votes
1answer
135 views

Is this implementation of Kruskal's algorithm maintainable and efficient?

Update I've posted some updated code and included the definition of Vertex and Edge to try to answer as many questions as I could. To summarize what's changed: I've followed the advice here to ...
0
votes
3answers
95 views

I need help improving this design for easy unit testing - C#

I am very new to unit testing, I only read a few chapters from 'Art of Unit Testing' and know how to write basic unit tests. I have a deadline for a project so I plan to read 'Professional Test Driven ...
2
votes
1answer
88 views

Improve Program Design

I am new to C++ and looking to expand my knowledge. Below is a simple program that I made. I would like to know how it could be improved, in any way. The introduction of new ways to do things is what ...
1
vote
0answers
34 views

How do I structure my entities for easier persistence?

I am learning ORM using Hibernate by creating a movie rental application. Currently, I have the following three entities for persistence: User Movie Rental (composite element for many-to-many ...
3
votes
1answer
184 views

asp.net (vb.net): handling of open database connection and calling shared function from web api

I'm working on an ASP.NET project using VB.NET that uses Dapper and the code as implemented so far runs fine with just me testing. In the example below, Dapper calls a stored proc. But my I am ...
0
votes
3answers
47 views

Implementation of an UniqueIdentifier class

I have a requirement to implement a generic UniqueIdentifier which can cover identifiers like OrderId, TrackingID, scannableId and other Ids. The ids, as they are now, are either Long or String. Below ...
5
votes
2answers
190 views

Efficent way of synchronizing between data

I'm currently working on a project where I have a punch of raw data and multiple components that use that data for various tasks. I would like to separate the raw data from the components as much as ...
1
vote
0answers
23 views

Is this a good approach for a BayeuxClient class?

Is this a good approach for a BayeuxClient class? Reading cometd reference book, Chapter 6 Java Libraries, I created this BayeuxClient class. As a newbie to cometd, I would like to know if this ...
1
vote
2answers
92 views

Multi-threaded Winforms Conventions for Main()

I'm trying to find a good pattern for new applications (and for refactoring old ones). Maybe it's just me, but I dislike spawning my main logic thread from inside my main form thread (so far I always ...
1
vote
2answers
110 views

Database calls with Python Flask and SQLAlchemy

I am creating a Python Flask webservice and this is basically how I am doing all of my database calls if a webservice needs to interact with the database: @event.route("/somepath/<value>", ...
4
votes
4answers
211 views

Command line Contact Management

Can you please review the following code and give any suggestions for improvment? Class ContactList.java import java.io.*; import java.util.*; public class ContactList { public static void ...
0
votes
1answer
60 views

Appropriate separation of concerns for this case?

This is a method that calls a web service, it uploads an audio file and fetches metadata back. While the advantage is that there is only one method to call there are a few concerns about it : There ...
8
votes
0answers
227 views

Thoughts on my brain fart interpreter?

Had some free time this weekend and I hacked together a small Brainfuck interpreter, with the sole intention of explaining PHP's flavour of OO to a friend. This is a bit over-engineered on purpose, ...
1
vote
2answers
49 views

Simple SPI Master

I wrote a simple SPI Master implementation to send characters to a LCD screen. Only the output is actually implemented in this so there is no rx register. This only sends a character out when write is ...
2
votes
1answer
51 views

Is there a better way to translate a string into methods?

So I create 3D tree like structures using L-systems. Basically this means I generate a string like this: "FFFFFFFF-[[FFFF-[[FF-[[F-[[X]+X]+F[+FX]-X]+F]]]]]" This string is then interpreted by a ...
-1
votes
1answer
132 views

design classes for a JAVA swing application [closed]

I am very new in making JAVA swing applications.. My problem statement is to make a library management application,for which i designed classes as below. Please tell me whether my design of classes ...
0
votes
0answers
18 views

Design for tree data illustrated by a tree view with edit feature

I have a tree data structure, which is implemented with composite design pattern. I want to show it by a tree view in a GUI. By some event (such as double clicking a leaf in the tree view), a dialog ...
1
vote
2answers
132 views

Basic PHP comment form: what ways can I improve security, efficiency/cleanliness, or conventionality?

I am a programming novice. I've written this simple PHP script to run a very basic comment form and would appreciate any feedback, especially on these three topics: Efficiency (not sure the right ...
3
votes
3answers
101 views

Test Driving Interface Design

I have been doing TDD since I have started my first job out of university (about 5 months ago), most of which is working with legacy code. I started a personal project today and thought I would TDD ...
1
vote
2answers
99 views

Shortening System.out - which is better? [closed]

Oftentimes people will shorten System.out to just out and make an analog called in (e.g. Scanner in = new Scanner(System.in);). I've seen two methods of doing this Method 1: import static ...
0
votes
1answer
127 views

Review algorithm of this code

In this piece of code i have to display some set of data in serpentine order.In an experiment there are Replication,range,plot Replications contain range,plot.A range contains plot. if there is 2 ...
0
votes
0answers
117 views

Simple Node.JS server

I am in the process of writing a simple Node.JS webserver. I am about half-way there in terms of functionality. Please see the full code in this pastebin (the client-side code is not shown as I want ...
1
vote
1answer
93 views

wordpress - simple theme options in array

I am created a wordpress theme options using array, and it is working. There are 5 type of input text,textarea,checkbox,select and upload. Kindly check this function and give suggestion and tweks. ...
3
votes
2answers
93 views

Nice design of my hash service class

I would like to know, if my design of this class is good OOP. Should I implement for every hash algorithm a separate class? I'm asking this, because the HashService can be used with a ...
8
votes
1answer
207 views

Is splitting to small classes good?

I have materials. class Material {...}; class ConcreteMaterialA : public Material {...}; class ConcreteMaterialB : public Material {...}; I want it has a name class WithName { public: const ...
2
votes
2answers
183 views

Reusable user control (ascx) design for multiple web application

My company's web application projects are heavily based on user controls. One common case is like we want to reuse the UI visual elements but note the packaged original logic . I have read some very ...
0
votes
2answers
89 views

A sample java class for review

Let's say the method foo() has lot of code and it also includes doing something for bar1, bar2 and bar3, maybe setting some status or print something or something else which is being done in just one ...
1
vote
1answer
104 views

Builder & decorator patterns together, am I doing this right?

Little background: payload is the representation of a message being send, using a specific transport. The builder pattern is used to build different representation (as array, or as a Swift_Message ...
0
votes
2answers
125 views

C++ interface design - does this look logical as base message handling class

I am designing a program which encodes / decodes protocol messages to/from various bits of hardware. //base protocol class - interface only //ref_type is a smart pointers class - not really so ...
4
votes
1answer
138 views

Hangman: Is this small Haskell game clean and idiomatic Haskell code?

I hope this question isn't too general. I've been learning Haskell, and a while ago I created this Hangman game. I've been working on using a library for terminal output, so no more hardcoded escape ...

1 2 3