Tagged Questions
2
votes
1answer
64 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
89 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
127 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
329 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
88 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
202 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
401 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
350 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
127 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
94 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
154 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
241 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
289 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
173 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 ...