I currently represent my Business Layer and Data Layer in a single project in my application. I have very good separation of concerns between the two sets of classes. However, My Data Layer classes take as parameters and return my business objects. So I will have code that loosely resembles (please don't be too critical of this code, m...
I am now trying to understand some code and I have found a pattern, which seem a bit strange to me. There is a user's control class with 'EditorOpen' event. At first, I thought this name is incorrect, because it does not end with '-ing' or '-ed', as MSDN suggests. However, later I have found out, that this event does not INFORM about som...
I'm refactoring a large legacy web application that has some complicated forms.
These forms use javascript to display or hide fields on the basis of other entered fields. E.g ticking a checkbox for "second address" reveals a set of other fields to enter.
The current validation for this consists of lots of deeply nested if statements. S...
Basically I want to implement a simple Rails extension to define the seriousness of methods in my controller so that I can restrict usage of them appropriately. For example I'd define the default restful actions as so in an abstract superclass:
view_methods :index, :show
edit_methods :new, :create, :edit, :update
destroy_methods :destro...
I have a class "Shape" which is a supertype of many other "shapes" in my app.
I have lots of empty methods on the Shape class which are declared as virtual / overridable, so there is not really any default bahaviour. Of course, some sub-shapes implement these methods.
I am really just using it so that I can treat all my shapes as Shape...
I have an application settings page with a bunch of checkboxes. How should I choose the default checked state of the checkboxes?
I see the following options:
Always set the default state to unchecked, but this leads to negative statements in the checkbox text (like "Don't automatically show due schedules"), which is sometimes hard to ...
Say, You have an application which lists down users in your application. Ideally, if you were writing code to achieve this in Java, irrespective of what your UI layer is, I would think that you would write code which retrieves result set from the database and maps it to your application object. So, in this scenario, you are looking at yo...
A while ago I had a discussion with my colleagues about the persistence of Domain Models and whether we should enforce foreign-key constraints at the database level.
My first reaction was that the very use of a relational database implied the enforcement of such constraints, but some argued that the database should be seen as nothing bu...
What is the best website for design patterns?
I really like the format of http://ajaxpatterns.org
Are there other sites for general programming patterns organized in the same way?
...
What would a skeleton design look like for a repository able to support multiple database layers using ASP.NET MVC and C#? I want to see what a design would look like if I support both LINQ to SQL and NHibernate. How would I create my database object, and call a method on it in my BLL layer?
...
Here's the situation: I've got a class that is doing too much. It's mainly for accessing configuration information, but it also has the database connection. It's implemented as a singleton, so this also makes unit testing it difficult as most code is pretty tightly coupled to it. This is even more problematic as it creates an import-...
Here is an easy question.
How does the industry refer to storing mulitple boolean value state in one integer?
The SetWindowPos api is an example.
SWP_NOSIZE DEFINE 1
SWP_NOMOVE DEFINE 2
SWP_NOZORDER DEFINE 4
SWP_NOREDRAW DEFINE 8
SWP_NOACTIVATE DEFINE 16
If the integer is 11 then 1, 2 and 8 (SWP_NOSI...
This question is regarding object oriented design. It may fit into community wiki.
Usually , when one design a set of classes which communicate with each other through interfaces , he ask himself , what Interfaces should I make? How to abstract various sub-components in the system in order to achieve the design goals.
If we put aside p...
Consider a verbatim copy of Bloch's Builder pattern (with changes made for C#'s syntax):
public class NutritionFacts
{
public int ServingSize { get; private set; }
public int Servings { get; private set; }
public int Calories { get; private set; }
...
public class Builder
{
private int ServingSize { get; set; }
priva...
I've read a lot of books on software design, and more and more I'm wondering if what I learned about separation of concern between business object and serialization makes me more productive.
I'm influenced by Domain Driven Design, so when I design my business classes I don't think about persistance. The only objects who are coupled to m...
I must have implement MVC dozens of times in the context of various toolkits. I've noticed there are a few things that keep cropping up in the implementation which I'm not completely comfortable about. I was wondering if these are indeed things I should be looking to avoid.
For instance
The eternal Model instance - In an Single documen...
Is there a way to watch an object graph for changes on any object, and do something based on that change?
Lets say I have the following:
public class Main:INotifyPropertyChanged
{
public ObservableCollection<Foo> FooItems { get; }
public ObservableCollection<Bar> BarItems { get; }
}
public class Foo:INotifyPropertyChanged
pub...
Although obviously not all scenarios can be covered by a single design, is it generally felt now that ORM classes should be passed to and fro between the presentation and business layer (either local or remote), replacing the need for data transfer objects? As far as I can see, using ORM classes presents problems of unnecessary eager loa...
Hey folks,
I have a question about singletons that I think I know the answer to...but every time the scenario pops-up I kinda second guess myself a little so I would like to know the concrete answer.
Say I have two classes setup as so...
public class ClassA
{
private static ClassA _classA;
public static ClassA Instance { ...
MVC is used a number of popular frameworks. To name just a few, Ruby on Rails, ASP.NET MVC, Monorail, Spring MVC.
Are there any equivalent frameworks using any variant of MVP?
Most of the examples I've found online seem to be custom implementations of the pattern rather than reusable frameworks.
Suggestions need not be specific to an...