Tagged Questions
0
votes
0answers
23 views
Outsourcing substeps to helper classes [on hold]
I understand that the following is a broad question. In my opinion, code quality is very subjective and healthy discussions are an effective way to share knowledge.
When a class performs a ...
0
votes
0answers
16 views
Re-factoring restrictions validation functions for proper OOP design in MVC framework
I am aware that code review is for refactoring code from an existing code. Let me first to say that the following code works but inefficiently and its very convoluted, so I would like to apologize if ...
5
votes
1answer
39 views
Secure Functions in a Database Class
I am trying to solve as many issues as possible with my Database Class and bind statements as far as possible without actually doing it in the front-end. The goal is to do all of the heaving lifting ...
0
votes
1answer
41 views
Factory Pattern to Abstract Factory Pattern [closed]
My Product Factory
public interface IProdctFactory
{
void Drive(int miles);
}
My Vehicle Factory
...
9
votes
2answers
191 views
Decoration Freak, or OCP in action?
I'm writing C# code to read and eventually parse VB6/VBA code modules. I have an interface like this:
...
8
votes
2answers
369 views
3 tier architecture ado.net application
I would like to develop a student management system with repository pattern using ado.net (no EF or MVC).
I decided to create the model (business objects) and interfaces as one project ...
0
votes
1answer
31 views
Where the validation should be done in a 3 layers Entity-Repository-Service application? [closed]
I am struggling to define where the validation process would be better placed in the different layers of the application? (I am not talking about user input validation here, I'm really talking about ...
11
votes
1answer
530 views
Problem: Traffic Flow
I have the following task:
The Shallow Alto city council has organized a special committee to
review the traffic situation in the city. Despite the fact that there
is nothing whatsoever to do ...
1
vote
1answer
42 views
Checking sensors in an environment
I have the following diagram (did this only to ask here, it's obviously missing details):
From the diagram you can see I have to check if all sensors in an environment are respecting the ...
0
votes
1answer
104 views
Is my first MVC architecture set up to standards?
I just started learning about the MVC architecture. And I started to create my own MVC framework to how I like it the most.
Here I've got the index.php, indexcontroller.php and view.php. I'm not too ...
1
vote
2answers
193 views
Tic-Tac-Toe implementation where computer should not lose
I have implemented Tic-Tac-Toe so that human can play with the computer, where the computer should never lose. I did a simple analysis before implementing, and I found out that there are certain ...
3
votes
1answer
73 views
Redunancy Issues in PHP Class
I've been studying PHP for a while now and decided to dive into OOP. Most of my code was a mess and I've begun to refactor much of the website to OOP; however, I'm having an issue with redundancy in ...
7
votes
1answer
67 views
Making a FileHandler more OOP friendly using SOLID
I have a class created for the sole purpose is to help handle files.
The class holds a path(folder) that contains a single file at a time. Some extra properties to this class are: age of a file and ...
0
votes
0answers
33 views
Classes to iterate over millions of records, performing calculations and comparisons on each
I'm converting a PHP written with a lot of procedural loops to classes. There is a hierarchy of nested information represented in nested associative arrays. The actual records are from currency ...
1
vote
1answer
51 views
Is this a model? What is controlling it (controller?) and how does the data get to the view?
My goal is to instantiate a class based on the request and call a method on it based on the request verb. The classes I'm referring to will have methods such as ...
10
votes
3answers
388 views
Design pattern for implementing multiple data sources
I've written a program to populate a particular object from multiple data sources, however I'm not convinced I'm going about this in the right way:
I have no idea which (if any) design pattern I ...
9
votes
2answers
365 views
Implementation of the Strategy Pattern using an interface, abstract class and delegate
The following class was designed to help create a more detailed error message than what's provided by the repository when a user tries to insert text into a column that is > the column max length. The ...
3
votes
1answer
114 views
Use of the composite pattern
Assume the following requirements:
Is it a good idea to use the Composite design-pattern for this, taking into account that there will be:
Only 1 TestPlan
a ...
6
votes
7answers
686 views
One instance per method call or multiple method call per instance
I have the following class designs, and I'm looking for the best practices, aligned to the OOP design principles/patterns.
The ParameterParser will be used inside ...
2
votes
1answer
245 views
Best design pattern to approach http handler with multiple methods
I'm building an http handler at work which has about 6 methods and I'm trying to figure out what design pattern will work the best for my needs:
What's done already (Only an example to make this more ...
3
votes
3answers
106 views
1
vote
0answers
182 views
Basic structure of a simple php REST api
I've read plenty about php OOP design principles and patterns. I can work with classes and inheritance. My issue is with actually using classes for some purpose. In this case, I want to create a ...
6
votes
2answers
219 views
Sprite animation for a game
I'm just getting started with XNA and game development in general. I followed these instructions to create a basic game, then this article to get sprite animations working.
Now, I'm trying to ...
6
votes
3answers
292 views
Responsive module and tooltip module
Recently, I've noticed that my code looks so ugly because there were a bunch of functions and global variables. So, I started reading a little bit about design patterns. Now I come with something ...
3
votes
1answer
351 views
How to separate code into smaller classes using SOLID principles
I have a console application that basically retrieves xml content, writes to the xml file and sends the file to sftp site. This may seem long post but I believe it is simple stuff that need advise on ...
5
votes
4answers
463 views
0
votes
1answer
73 views
Searching for a better implementation to EnumBase
In a former question on SO I described a problem with a construct called 'EnumBase'.
As I sad there, I am not involved when basic implementation happened. So I'm not sure why the thinks are a they ...
2
votes
4answers
159 views
One or multiple classes? Better-looking way to create tetrominoes in game
Background
A few weeks ago, I started working with Java. To get more familiar with the language, I decided to make a Tetris clone.
So, as I finished the Tiles ...
5
votes
1answer
140 views
Simple taxi emulator
This app is a simple taxi emulator. The only feedback I've got on it was "bad internal architecture", that's why I would be grateful to receive more adequate and humiliating review.
Simply-speaking, ...
-1
votes
1answer
61 views
Box(x,y,X,Y), box(x,X,y,Y), box(x,w,y,h), box(x,y,w,h) or box(fromPos,toPos)? [closed]
Say you are representing a box, or creating a function that slices a 2d array, or whatever. How do you represent it?
0
votes
1answer
170 views
Q&A system model design [closed]
Now I am trying to build a Q&A website by myself.The models below is my model design.I have some questions about this.
1、class Category:
...
2
votes
1answer
173 views
Design with Context, Table and Functions
Each class of my project has several inputs and outputs. Each input, the same as output, depends on it's own set of value-datatype.
I need to provide a mechanism to forward data streams from one ...
-1
votes
1answer
110 views
Should I use inheritance in my case? [closed]
I have 2 classes that should run a service when calling their Start method, but before it they should:
Copy items to F folder
Open S service in remote server if ...
5
votes
2answers
228 views
Strategy Design Pattern in Python
I'm reading the awesome Head First Design Patterns book. As an exercise I converted first example (or rather a subset of it) to Python. The code I got is rather too simple, i.e. there is no abstract ...
0
votes
1answer
87 views
Instance of one class to contain arbitrary number of instances of another class in Python
I'm trying to see if there is a better way to design this. I have a class Animal that is inherited by Male and Female classes (Female class has an additional attribute). I also have a class called ...
2
votes
1answer
249 views
Have I implemented the command pattern correctly?
This is my command interface
public interface IConverter {
void convert();
}
This is my Receiver class
...
0
votes
1answer
97 views
Actionscript 3.0, good OOP?
I have been coding for some time (3 years I think), and have recently been wondering if my coding pattern is any good. Any kind of feedback is welcome:
EDIT: The thing that concerns me most is that I ...
1
vote
1answer
171 views
Factory pattern for getting xml data
i am trying to implement factory pattern for getting XML Document from server
(using javax.xml.parsers.DocumentBuilder)
I have the classes below for now, could you give your opinion ? Does the ...
3
votes
1answer
224 views
Optimize PHP Class
I'm looking for a better way to provide configuration options and improvements in general. I'm using the constructor injection pattern to get access to the Cache and Twitter class. ...
3
votes
3answers
212 views
Refactoring a class hierarchy to remove subclasses
I have the following class inheritances hierarchy:
First the abstract parent class:
...
5
votes
1answer
765 views
Basic OOP & Solution Design
I had an exercise as below for an interview. I used two design patterns: factory and decorator. I put my code at the end of it.
How could I improve the solution?
Basic OOD & Solution Design ...
4
votes
2answers
749 views
Validation Class - Feedback Welcome!
I have written a Validation and Form class in PHP.
Validation class allow you to define the ...
5
votes
2answers
155 views
When an object has different representations… what's the OO pattern?
I've an AbstractMessage object (a hierarchy, actually). It represents a small text message and can be sent using different transport methods: HTTP, REST and a ...
3
votes
1answer
851 views
A base class to handle mapping between entities and view models
I'm working on a fairly mundane ASP.NET MVC app that allows users to do basic CRUD operations on a number of different domain objects. I'm trying to minimize duplicate code and boring, monkey code as ...
4
votes
1answer
147 views
OOP: Need tips of my approach in .Net
I am looking for some different approaches to this following OOP scenario.
...
2
votes
2answers
488 views
Correct GenericDAO implementation?
I implemented a MVC Framework with Generic DAO and I would like know if is correct. I did not have developed yet the MySQLDAO.
My controller class
...
1
vote
1answer
809 views
What is the correct way to set up my classes in OOP programming in PHP?
Let me start with a little introduction. I am in the process of learning OOP in PHP. I have also researched Design Patterns but have not yet fully grasped the different types of concepts. I am at the ...
3
votes
2answers
382 views
How can I use object oriented principles in the following scenario?
I have 3 car rental agencies. Each agency requires the data in XML, but in a different format, for example:
Agency 1
...
3
votes
1answer
352 views
Does this code satisfy the Single Responsibility Principle?
I had code that violated the Single Responsibility Principle in a question on StackOverflow.
In order to overcome that problem, I changed the code as follows.
Is this a good practice in order to ...
3
votes
1answer
210 views
Repository Pattern Review
I have following code for a library management system.
Is the following code a proper implementation of the Repository Pattern?
How can I adapt this code to use generics?
Should I let ...