design-patterns

Design Patterns: What's the antithesis of Front Controller?

I'm familiar with the Front Controller pattern, in which all events/requests are processed through a single centralized controller. But what would you call it when you wish to keep the various parts of an application separate at the presentation layer as well? My first thought was "Facade" but it turns out that's something entirely diff...

Recommend .NET data access layer/middle tier

Hi, I'm currently creating an MVC application that will likely to expand to include a silverlight, wpf and possible windows phone all using the same data. So I've created a class library to keep all my objects in and I've created the MVC app. My question is what would be the best way to access the data? Taking into account possible ex...

Rails Many to Many Relationship with occasional Nested Routes

As I am learning more about rails, and breaking my design thinking from ASP.Net days, I was considering a scenario this morning but did not know if it was possible to do. Practitioners have many Treatments through services - and vice versa In my control Panel I have an area for Practitioners to edit their details (names, contact info e...

Design pattern to use instead of multiple inheritance

Coming from a C++ background, Im used to multiple inheritance. I like the feeling of a shotgun squarely aimed at my foot. Nowadays, I work more in C# and Java, where you can only inherit one baseclass but implement any number of interfaces (did I get the terminology right?). For example, lets consider two classes that implement a common...

Graduating from ASP.Net Webforms anti-patterns

On my current project, I'm stuck in an ASP.Net 2.0 Webforms anti-pattern quagmire. I am aware of the myriad of anti-patterns we're using (huge code-behinds, no separation of concerns, untestable code, and on and on). Now, I'm not interested in rescuing this application from this situation as it's too far gone. Instead, my focus is on ...

Design Patterns in Rails

I remember, I have a GoF book back in college about design patterns which helped me a lot with my C and C++ programming, since my jump ship to Rails I was trying to use those design patterns I learned previously, Rails is a relatively new paradigm to me, plurals, verbs, REST, DRY.. Can you give me a recommended book for Rails that I can ...

How can i implement the NULL Object Design Pattern in a generic form?

Is there a way to implement the null object design pattern in a generic form so that i don't need to implement it for every buisness object. For me, there are two high level classes you'll need for every business class. One for a single record and another for a list. So i think there should be a way to implement the NULL Object design p...

How implement the Open Session in View pattern in NHibernate?

I'm using ASP.NET MVC + NHibernate + Fluent NHibernate and having a problem with lazy loading. Through this question (http://stackoverflow.com/questions/2519964/how-to-fix-a-nhibernate-lazy-loading-error-no-session-or-session-was-closed), I've discovered that I have to implement the Open Session in View pattern , but I don't know how. ...

Are Design patterns specific to Language or Technology?

Question over here is are design patterns specific to a programming language or technology, Like you can do composite pattern only in C#,Java but not in VB6.0.Is that true, If yes that what are pattern that can't be implemented with out object oriented programming languages. ...

MVC Pattern in Java Swing ?

Hi, Please give me an example for MVC pattern used in Java SWING package ? ...

What Patterns Should I Consider For a Html Widget Generator?

I'm looking to see if I can design a HtmlHelper extension method that will generate the Html for different types of widgets I want to produce. Each different type of widget implements functionality to get and prepare any data it needs to render. Can anyone suggest any patterns I could refer to for approaches to take? I know there are ...

overflow-x AND Middle Mouse Button Moving

My Page is 980px in Width, but I have a few design elements (which belong with the background). I positioned them with position: absolute;. This creates a horizontal scrollbar for those who have a =< 1024 resolution. I disabled that scrollbar with overflow-x:hidden on (and for IE7 and etc). However, when I hold my middle mouse button,...

How do I write user-specific configuration into a rails app?

Hi all, What is the current practice like to write user-specific configuration settings into a rails application? For example, privacy settings in a social networking application. I know application-wide settings can be stored in a .yml file in config/ but what about users? ...

Program Structure Design Tools? (Top Down Design)

I have been looking to expand my methodologies to better involve Unit testing, and i stumbled upon Behavioral Driven Design (Namely Cucumber, and a few others). I am quite intrigued by the concept as i have never been able to properly design top down, only because keeping track of the design gets lost without a decent way to record it. ...

Factory Pattern - when do you say you need a specialised factory

Hi, I am having a little design crisis, I am making a Plane class, which is made of an engine 2 wings and N seats The engine takes in a engine size, and the wings have a span. would this still be feasible to have a PlaneFactory, when the factory may have to take in multiple parameters to setup the plane (wings, engine, no of seats)...

Routing redirection decision

I have really no idea why I'm asking this as this a really completely irrelevant question for which I should have figured out an answer within milliseconds, yet I'm doing it. So in my project I have a Router class which splits up the request and selects the right page to be loaded. Fine so far. Now I have a page displayed when the user...

PHP: Best solution for links breaking in a mod_rewrite app

I'm using mod rewrite to redirect all requests targeting non-existent files/directories to index.php?url=* This is surely the most common thing you do with mod_rewrite yet I have a problem: Naturally, if the page url is "mydomain.com/blog/view/1", the browser will look for images, stylesheets and relative links in the "virtual" directo...

How to refactor method which performs multiple steps (dependent on each other)?

What is the best way to refactor a method which has many steps in it? For example, a method which setups some objects, creates several objects (Eg a database table), and so on - basically, one method which does a set of related steps. Would this be best suited to the command design pattern? Thanks ...

Factory Method Pattern clarification

My understanding of Factory Method Pattern is (Correct me if i am wrong) Factory Method Pattern "Factory Method allow the client to delegates the product creation (Instance Creation) to the subclass". There are two situation in which we can go for creating Factory Method pattern. (i) When the client is restricted to the product (Inst...

Grasp Controller, Does it really need a UI to exist?

I have a Domain model which can be in multiple states, and if these states go out of a given range it the domain should automatically react. For example I have a Car which is made of multiple things which have measurements the Engine - Rev counter and Temperature the Fuel Tank - capacity Is is plaseable to have a CarStateController,...