Tagged Questions
1
vote
0answers
37 views
Best practices in implementing service methods
Consider the following architecture: ASP.NET MVC Application having controllers which depend on service classes (MembershipService, EmailService etc.) which in turn depend on data access context ...
1
vote
1answer
45 views
It there a pattern used to process a same function but assign the result to a different variable regarding to a different condition?
Say I have a code snippet like this
if(string.Compare(isStandardFlag,"STANDARD",true)==0)
{
hearingID = centreSession.standardID;
centreSession.standardOutcomeID
...
2
votes
2answers
67 views
Sequential Execution: Orchestrator Pattern
I built a code piece that makes it easy to execute a set of sequential operations, that might depend on the same parameter value (passed across the execution) or might need a particular parameter.
...
3
votes
2answers
108 views
Design Pattern Question/Violating OCP
Is there a design pattern I can use for a situation like below. This is an example I made up to try and explain the situation I'm dealing with currently. I keep having to add new DeviceScript ...
1
vote
1answer
105 views
Code review for an abstract repository implementation
I have a repository abstract class that encapsulates pretty much all of the CRUD functionality:
public abstract class DataRepository<T> : IRepository<T>
where T : class
{
public ...
6
votes
2answers
130 views
Handle static objects using custom adapter
I have read some articles discussing about why static is bad, some of them refering static as not-testable, non-mockable, has state (non-stateless) and everything else.
However I have encountered ...
4
votes
1answer
144 views
How do I make this code unit-testable?
I have a functionality that imports data into a database, based on an Excel workbook and some meta data (both user-supplied). The functionality implements interface IFunctionality which essentially ...
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
76 views
Single Responsiblity Principle with polymorphism question [closed]
So I'm somewhat new to the Model View Presenter design for testing my GUI. So far I really like it because now I can actually test my GUI's behavior instead of just having the "test" open up a ...
3
votes
1answer
71 views
Encapsulated double for type safety
Link to a full functional solution.
I'm working on a physics based algorithm, and I find myself working a lot with functions of style
double GetSpeed(double acceleration, double angle, double ...
-1
votes
2answers
66 views
Repository per associated collection? [closed]
Should I create a repository for each associated collection?
Lets say we have (for simplicity lets say a book has a single Author).
Authors [1] ---- [*] Books [1] ---- [*] Pages
Now I have created ...
2
votes
2answers
150 views
Reduce nested for loops and if statements using Iterator Blocks?
Is it possible to reduce this long nested for loops and if conditions to increase its readability and to optimize it for future reference.
While writing code for my scheduling app, I ended up with a ...
2
votes
1answer
156 views
Is this correct usage of the “Decorator” Pattern?
I have a model class Product that gets populated from a service DTO object (using AutoMapper). The service is used to power many different applications and for each one the Product Model might need ...
0
votes
1answer
59 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 ...
-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 ...