1
vote
1answer
107 views

Choosing between the view and the controller for my code

I'm aware there are a lot of topics about MVC design but it's hard to find good explanations: what I should do, what are the consequences of the different possibilities... So I'm working on an ASP ...
2
votes
2answers
247 views

Reduce number of if statements through design pattern

I had a loop through object Process, each process instance can be of a different type, derived from Process base class (e.g.: Process1, Process2,...). Each derived type of Process has different ...
2
votes
2answers
131 views

Refactoring sought for replacing shared data types in .NET component

I am in charge with updating a software product that is made up of two components the Controller process and the UI process. The Controller and the UI communicate via XML messages. Furthermore, the ...
2
votes
6answers
333 views

Design pattern for method to accept one of several static items in C#?

I want to illustrated my question by way of a (hopefully) representative example. Lets say I have a situation where I am developing a class library in C# to be used in some simulations. I want to ...
0
votes
3answers
161 views

Is the Adapter the correct design pattern for this situation?

I have an instance of a class UntouchableClass of which I need to access the member variables to use in my DotLiquid template. Problem is, UntouchableClass has to inherit from Drop if I want to use it ...
0
votes
2answers
148 views

Whats an Ideal way to pass rules/options to methods that build SQL

We're trying to come up with a way to handle code that builds dynamic SQL for our application, which is very database centric. Things like Linq to SQL and Entity Framework are out of the question, so ...
2
votes
2answers
206 views

Pattern for multiple datasources

I've already read this question on CodeReview. I was hoping for general advice. I'm writing a service which will go to numerous data sources. Each source requires getting copious amounts of data ...
0
votes
3answers
170 views

Is it ok for services to reference one another?

I have a service that needs information implemented by another service in the same layer. Is it good practice for one service to take a dependency on another service in the same layer?
4
votes
3answers
577 views

Extension method naming convention [closed]

We are using some utility methods in our company to simplify programming. So we have following string extension: public static bool IsNoE(this string s) { return string.IsNullOrEmpty(s); } ...
0
votes
1answer
223 views

Anemic domain models - what sort of methods a domain object might need?

This question might seem strange, but it's something I've faced sometimes. I've been trying to adopt DDD, however I'm always facing the problem of anemic domain models. The problem is that when I ...
-1
votes
1answer
471 views

Is this a design pattern?

I have following C# code. It helped me to avoid some code repetition in a good way. The ExecuteQueryGenericApproach<T> method receives a Func generic delegate as argument. The delegated method ...
4
votes
4answers
577 views

.NET Programming and POCO classes

I was having a think tonight while pondering over some application I need to change and it got me thinking. Entity Framework Entities are POCO (Plain old CLR Objects) and models used in ASP.NET MVC ...
0
votes
1answer
501 views

State design pattern: best implementation for my case?

Me and a mate have a discussion about what would be the best way to implement the pattern state for managing several screens for an application we are developing. We have a ScreenManager (I guess the ...
2
votes
7answers
492 views

Is there a pattern to restrict which classes can update another class?

Say I have a class ImportantInfo with a public writable property Data. Many classes will read this property but only a few will ever set it. Basically, if you want to update Data you should really ...
3
votes
2answers
624 views

Validation and data persistence in a domain model

My (first and current) workplace (a .NET shop) suffers from an over-abundance of anemic domain models, to the extent that I don't really know how validation and data persistence should be handled in a ...
1
vote
1answer
230 views

Task Consumer/Processor architecture

PROBLEM We have various tasks in our system which can take up to 20 minutes. These tasks are generally started from the web interface and run on a new thread. This is obviously a terrible solution ...
13
votes
9answers
4k views

Are too many if-else statements for validation bad? [duplicate]

From the book Professional Enterprise .Net, which has 5 star rating on Amazon that I am doubting after having a read through. Here is a Borrower class (In C# but it's pretty basic; anyone can ...
0
votes
1answer
139 views

How should I implement “queueing” of approval on my objects?

I have a list of objects that will need to go through an approval process. I am curious if it would be best to simply add some properties to my object, like ApprovedBy, and ApprovedOn. Another ...
4
votes
2answers
370 views

Hide or Show singleton?

Singleton is a common pattern implemented in both native libraries of .NET and Java. You will see it as such: C#: MyClass.Instance Java: MyClass.getInstance() The question is: when writing APIs, ...
4
votes
4answers
538 views

Pattern to use for different Stages in a software

I am developing a software for a laboratory to test some devices. To test each device there are multi subtests which should be done to reach to the final result.To perform a complete test, the ...
2
votes
3answers
440 views

Is it completely impossible to have total separation without leakage of any kind in a design? [closed]

For the past week I have been attempting to write a proof-of-concept project using dependency injection, a service layer, unit of work pattern + repository. I am looking to design something that can ...
1
vote
1answer
76 views

Extracting domain logic from the forms to which they are coupled?

Many applications do nothing to separate the interface from domain logic. I’ve been programming for a couple decades and have worked at more than a dozen shops and none of them have taken any measure ...
0
votes
1answer
2k views

Best place to write SQL queries

I've been working on this project for my company. Currently I am embedding my SQL statements inside the program itself as and when they are needed. I do have two seperate classes - QueryBuilder ...
3
votes
4answers
506 views

Are Compiler Directives an Antipattern?

I'm working on a legacy system that has a helper class that is symbolically linked into many different .Net projects within a solution. The logic is riddled with compiler directives that change it's ...
4
votes
2answers
536 views

Acceptable placement of the composition root using dependency injection and inversion of control containers

I've read in several sources including Mark Seemann's 'Ploeh' blog about how the appropriate placement of the composition root of an IoC container is as close as possible to the entry point of an ...
2
votes
2answers
156 views

Exposing a Disposing event

I'm implementing a .NET class which implements IDisposable. After being disposed, the object's state is invalid and so nobody should be accessing it, of course. There are some situations where two ...
1
vote
2answers
250 views

Client Server .NET application with queuing message

I am new, so forgive me if my question is mistaken or anything, just give me an alert and I'll be glad to fix it. Me and my team is about to develop a system where the database is located in a ...
5
votes
2answers
308 views

Which design pattern is illustrated by inheriting IStructuralComparable interface?

We know that some design patterns are found so useful that they become features of the language itself. For instance, the interface IEnumerator which is implemented by Array object. This helps in ...
10
votes
2answers
581 views

.Net developer trying to learn ruby on rails

I am a .NET developer and I just had the chance to play with Ruby on Rails this weekend. In .NET we separate layers of the application by creating separate class library projects. From the design ...
11
votes
3answers
559 views

Is using unit tests to tell a story a good idea?

So, I have an authentication module I wrote some time ago. Now I'm seeing the errors of my way and writing unit tests for it. While writing unit tests, I have a hard time coming up with good names and ...
2
votes
2answers
274 views

What are the caveats of the event system built on Messenger rather than on classic .NET events?

MVVM Light and PRISM offer messenger to implement event system. the approximate interface looks like the following one: interface Messanger { void ...
4
votes
4answers
200 views

Help identify the pattern for reacting on updates

There's an entity that gets updated from external sources. Update events are at random intervals. And the entity has to be processed once updated. Multiple updates may be multiplexed. In other words ...
1
vote
2answers
219 views

Is it better to define all routes in the Global.asax than to define separately in the areas?

I am working on a MVC 4 project that will serve as an API layer of a larger application. The developers that came before me set up separate Areas to separate different API requests (i.e Search, ...
3
votes
4answers
2k views

C# Open Source software that is useful for learning Design Patterns [closed]

In college I took a class in Expert Systems. The language the book taught (CLIPS) was esoteric - Expert Systems: Principles and Programming, Fourth Edition. I remember having a tough time with it. ...
0
votes
2answers
156 views

Implenting ActiveRecord with inheritance?

I recently converted an old application that was using XML files as the data store to use SQL instead. To avoid a lot of changes I basically created ActiveRecord style classes that inherited from the ...
11
votes
0answers
228 views

Return magic value, throw exception or return false on failure? [duplicate]

Possible Duplicate: Return magic value, throw exception or return false on failure? We've all seen these: a string format error, end of stream, item not found. While coding a class library ...
28
votes
7answers
7k views

Return magic value, throw exception or return false on failure?

I sometimes end up having to write a method or property for a class library for which it is not exceptional to have no real answer, but a failure. Something cannot be determined, is not available, not ...
-1
votes
1answer
551 views

Design Pattern for building a Budget

So I've looked at the Builder Pattern, Abstract Interfaces, other design patterns, etc. - and I think I'm over thinking the simplicity behind what I'm trying to do, so I'm asking you guys for some ...
2
votes
2answers
270 views

.Net Application & Database Modularity/Reuse

I'm looking for some guidance on how to architect an app with regards to modularity, separation of concerns and re-usability. I'm working on an application (ASP.Net, C#) that has distinctly generic ...
3
votes
4answers
298 views

As a tooling/automation developer, can I be making better use of OOP?

My time as a developer (~8 yrs) has been spent creating tooling/automation of one sort or another. The tools I develop usually interface with one or more API's. These API's could be win32, WMI, ...
0
votes
1answer
2k views

Implementing a ILogger interface to log data

I have a need to write data to file in one of my classes. Obviously I will pass an interface into my class to decouple it. I was thinking this interface will be used for testing and also in other ...
9
votes
4answers
346 views

Does an iterator have a non-destructive implied contract?

Let's say I'm designing a custom data structure like a stack or a queue (for example - could be some other arbitrary ordered collection that has the logical equivalent of push and pop methods - ie ...
18
votes
5answers
8k views

What's the best way to build a factory using NInject?

I am pretty comfortable with dependency injection using NInject in MVC3. While working in an MVC3 application, I developed a custom Controller Creation Factory using NInject, so any controller that is ...
3
votes
1answer
185 views

Exposing warnings\errors from data objects (that are also list returned)

I'm exposing Data objects via service oriented assembly (which on future usages might become a WCF service). The data object is tree designed, as well as formed from allot of properties.Moreover, ...
2
votes
4answers
269 views

Is there a pattern for subscribing to fired events/messages at specific intervals?

I'm not sure if this a common scenario or not, but I have a need along the following lines: I have an object (I'll call it node) and this object has methods X, Y, and Z. I want to be able to have ...
4
votes
6answers
842 views

How can I improve upon this “pattern”?

I have a series of method calls that all share similar qualities. The basic layout is public void CallDataBase() { Utility sqlHelper = new Utility(); StringBuilder query = new ...
1
vote
6answers
513 views

What do you call this pattern/technique?

Lately I've used this technique a few times, and I'm trying to figure out if it has a name, if it's one of the patterns, etc. In complicated situations where I might normally have a number of giant ...
4
votes
8answers
1k views

What do you consider to be the essential design patterns? And do you use them? [closed]

It seems to me that programmers have an increasingly uphill task of staying up-to-date. In my efforts to improve my programming ability, I am in search of the essential design patterns that are ...
14
votes
2answers
3k views

What are the main practices and design patterns every .NET guy should know?

In my brief time as a professional programmer I've seen lots of applications written by programmers who's entire education appears to have been reading the first couple of chapters in a .NET 2.0 book. ...
8
votes
2answers
498 views

Which GOF design patterns are already implemented as first-class language features in C#?

(This question was closed on Stack Overflow due to being "too broad" and "not a real question" so maybe it's more appropriate here?) Inspired by this question. We know events are a language-level ...