design-patterns

What type of pattern do the Web User Controls in ASP.NET fall into?

I'm just curious to know what type of pattern do the Web User Controls in ASP.NET fall into? ...

c# 4 observer implementation

i want a button that when it's pushed a new string is showen in the textboxes what am i doing wrong can somone inlight me why doesnt this code works ? ... namespace WindowsFormsApplication1 { public partial class Form1 : Form { public event Startdelegate StartEvent; myButton button; newTb[] tb; ...

How to convince people that a single class with 11975 lines of code is bad? (isn't it?)

I have a dejavu feeling when reading [What to do about a 11000 lines C++ source file?] post, but I don't think I can start taking action on my own since I do not have the authority to take action. So I think the first step is to convince people in the organization that big lump of code is bad. I have a similar situation where there is a...

What should be the best design approch

We have a simple table with employee data containing a 100k records. We want to display them using pagination on a simple JSP page with helper class/bean. On one page we'll display 50 records. Shall I fetch 50 records as per the page number & display them/ Use some other alternative? What should be the best design approach to this pro...

Extending a class: doing this within the class or using observers?

I need to extend a class (in C++, but this question is language-agnostic I think), with functionality that can be implemented in two different ways: by simply adding the logic to the class itself by adding observer logic to the class and putting the logic in an observer, outside the class There are advantages and disadvantages in bot...

Where/what level should logging code go?

I'm wondering where logging code should go. For example, should my repository log it's own errors? Or should I log all errors from the UI/controller? Are there any general deisgn principles about this, or does anyone have link to a good article or somesuch. ...

Priority of learning programming craft and other suggestions

Hello, As I am in my starting career year in software development (C++ & C#) I now see my flaws and what I miss in this sphere. Because of that I came into some conclusions and made myself a plan to fill those gaps and increase my knowledge in software development. But the question I stumbled upon after making a tasks which I need to do...

Why two appoaches of implementing interface ( view and presenter) used GWT-MVP tutorial ?

My question is based on GWT Tutorial http://code.google.com/webtoolkit/articles/mvp-architecture-2.html Here we have two pair of view and presenter In EditContactPresenter we are defining the view interface inside the presenter class EditContactPresenter implements Presenter{ public interface Display { HasClickHandlers getS...

Limitations of SunRPC mechanism as a Client-Dispatcher-Server architecture and comparison with Broker

I am reading a book on design patterns (an old edition) "Pattern-oriented software architecture". In the chapter dedicated to Client-Dispatcher-Server, SunRPC is cited as a Client-Dispatcher-Server architecture, with portmapper acting as Dispatcher in the Client-Server negotiation. I never used SunRPC practically, although I know more or...

Building a JSON Structure to Store Rules for Web Requests

I'm trying to store rules for web requests in a JSON object and am having trouble thinking of a good structure. Here are some examples of my rules: Possible Conditions the user must be logged in the user must belong to an account of type [____] the user must belong to an account named [___] the user must have a username [___] the user ...

Using Generics in a non-collection-like Class.

Hi, I'm working on an engine which is meant to be configurable by the user (not end user, the library user) to use different components. For example, let's say the class Drawer must have an ITool, Pencil or Brush, and an IPattern, Plain or Mosaic. Also, let's say a Brush must have an IMaterial of either Copper or Wood Let's say the effe...

How to avoid multiple nested IFs

I am currently trying to restructure my program to be more OO and to better implement known patterns etc. I have quite many nested IF-statements and want to get rid of them. How can I go about this? My first approach was to get it done with exceptions, so e.g. public static Boolean MyMethod(String param) { if (param == null) throw n...

Best design pattern to insulate child object methods contained in parent object array

Hello, I'm trying to figure out the best design pattern to insulate a child object from knowing too much about the parent object it is contained in. For instance, with a parent class like this... class Airplane { var seats:Array ... function removeSeat(seat:Seat) { // find seat object in seats array and remove it } } c...

Which design pattern is this?

In a current (C#) project we have a 3rd party assembly that contains a non-interfaced connection object. Using IoC, etc we can inject this concrete instance into our code, but it is proving a nightmare to unit test, etc. We are using MoQ as our mocking framework so ideally could do with an interface to work off and we don't want to go ...

Qt Flowchart Application Architecture

I want to build a flowcharting application in Qt to get some practice modeling GUI applications. All it has are draggable boxes and circles that can be connected with straight lines. As this is my first GUI application, I am unsure how one typically designs such a project. Here are my two designs. 1) Build a bunch of model classes (Bo...

Should a ViewModel in MVVM reference the View?

In the MVVM (Model-View-ViewModel) pattern should the ViewModel reference the view. I would think that it should not. But how should the following scenario be handeled? I have a view that has a tab control as the main container, the viewmodel for this view impliments a command to add a new tab to the tab control. The easy way would be to...

dispatch design pattern?

Suppose I have a class hierarchy in Java: interface Item { ... }; class MusicBox implements Item { ... }; class TypeWriter implements Item { ... }; class SoccerBall implements Item { ... }; and I have another class in the same package: class SpecialItemProcessor { public void add(Item item) { /* X */ } } where I...

Factory and non-factory design pattern differences

Hi, There is both an abstract and factory pattern. What exactly is the difference between these and why one be used over another? Thanks ...

Codeigniter: Best way to structure partial views

How would you structure the below page in Codeigniter? I thought about creating seperate controllers for each section Left nav Content nav Login name Leaderboard Excluding the content section (as this changes depending on the link on the left nav and content nav used as a kinda sub-menu). All the other sections remain roughly the ...

"Procedural" Design Pattern for DoThis->ThenThis->AndThenThis

I'm trying to find a useful design pattern that simulates something like this following: DoThis()->ThenThis()->FinallyDoThis() then print "Hello world" ThenThis() doesn't run unless DoThis() passes. And FinallyDoThis() won't run unless ThenThis() and DoThis() both pass. If all the methods methods pass, then it prints "Hello world". I...