Tagged Questions
2
votes
1answer
69 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
92 views
Should I use inheritance in my case? [closed]
UPDATE - I write in C#. The code is added below.
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 ...
0
votes
2answers
138 views
Constructor with too many arguments [closed]
We have a Transaction class that's very loaded; so loaded that I originally ended up passing almost 20 argument to the ctor. After extracting a few value objects, there are still 12 arguments left, ...
12
votes
7answers
1k views
How can I improve this OOP design? Is it even valid?
I designed this object for a "bread formula".
[Bread formulas use a concept known as baker's percentages, but you don't need to understand the math to help with the object design.]
I designed it as ...
7
votes
3answers
332 views
Class with a sometimes unused property
From times to times I stumble over the following situation:
I have got a class with a property that's only used if another property has a particular value, for instance:
public enum ...
3
votes
2answers
91 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 ...
6
votes
5answers
207 views
Handling null exception when having multiple variables
I have a lot of variables that I need to check for exceptions and output the empty field in case of a null returned value (I am reading a calender list from Sharepoint and my program is supposed to ...
5
votes
1answer
414 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 ...
3
votes
1answer
375 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 ...
3
votes
1answer
128 views
Divide List into groups
I have a set of Service, and I want to partition them into ServiceClass, and have a reference from a Service to the Service class its belong.
I am storing the reference in Dictionary<Service, ...
3
votes
1answer
95 views
How to refactor a verbose datatype?
This morning I decided to write this question: Are there problems if I have a verbose datatype?
I don't really explain my scenario about how am I accesing through the nested dictionaries. I decided ...
0
votes
1answer
157 views
Is it proper TPT Inheritance
I have following model and database created using Entity Framework. Is it proper TPT Inheritance?
Is it possible to make the base class as abstract?
Model
Database
CODE
namespace LijosEF
{
...
3
votes
2answers
247 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
<Rental>
<Customer>
<FirstName>test</FirstName>
...
3
votes
1answer
293 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
176 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 ...
1
vote
1answer
79 views
Please Review the following code
public class Bank
{
public int Id { get; set; }
public static IDictionary<int,Customer> Customers { get; set; }
static Bank()
{
Customers = new Dictionary<int, ...
3
votes
2answers
564 views
Is the solution design optimal? C# 3 - Tier
I have the following solution structure. This is a business domain (for an amount transfer operation in bank account) which will be called by a WCF service. Is the solution structuring correct?
...
3
votes
1answer
793 views
C#: Simplfy code using Interfaces + business rules / validation
I have a workflow; within the workflow I can have many stages. I want to open and close a stage based on some business rules. E.g., stage 7 cannot be opened, because stage 5 + 6 need to be closed ...
2
votes
1answer
130 views
Best way to Structure class + Instantiation
Is this a good way to design a class so I can prevent values being changed/ the state must remain as it was when it was intantiated...
This code would be normally instantiated after a call from the ...
2
votes
2answers
332 views
Getting validation from inherited classes
I'm building some code with an inheritance heirarchy, and I want to validate the resulting instances. At present I have a method in the base class can override to return a list of the problems (see ...
3
votes
3answers
333 views
Can I get some constructive criticism on this code?
I'm just looking for some opinions on this code. Is there a more efficient way to do what I've written so far? My goal is to make the code as efficient and small as possible while still being ...
5
votes
4answers
467 views
C# general programming question
This code is part of one of the methods. I'm pretty sure it is really bad programming. The third if statement is supposed to be called if all 4 variables were set. Is another method needed? How would ...
6
votes
3answers
822 views
New to OOP; is this a good class design?
I have a few different classes in my application, but this specific class is the one I'm interested about. Please review for good practices and potential problems.
using ...
6
votes
0answers
381 views
How can I manage different problems in Math Quiz?
Ok, this will be the first question for this project.
This is a Math quiz system. Always must generate different problems for each problem, but at the same time, I have to generate the same exam for ...
1
vote
1answer
271 views
Can someone help me to improve this code?
Here is the project which currently I'm working.
http://www.megaupload.com/?d=NGJWS9C3
Sorry guys if the code is a mess. I'm a beginner, I'm still learning from you, and for that reason, I need a ...
3
votes
0answers
235 views
Is this an acceptable implementation of a OpenGL VertexArrayObject class?
It seems to play up sometimes, I'm not sure if this is due to the class itself or the way I'm using it. Can someone confirm that this is a 'good' implementation of a VertexArrayObject class?
//The ...
4
votes
1answer
172 views
Sorting Visitors
I started to write a code with top-down tests.
My first version, grow to something like this:
public class Worker
{
public void Execute(Foo foo)
{
//Do X on Foo
//Do Y on Foo
//Do ...