design-patterns

Design pattern needed

Hi, I am going to develop a tool that will do the following: collect the files from remote server - periodically every few minutes. Export the collected files into a one single file. From the client, it sends a request to the server every 5 or 10 mins. Then server then sends a list of files. This part is called 'collection'. Afte...

Is it a good idea to create a custom type for the primary key of each data table?

We have a lot of code that passes about “Ids” of data rows; these are mostly ints or guids. I could make this code safer by creating a different struct for the id of each database table. Then the type checker will help to find cases when the wrong ID is passed. E.g the Person table has a column calls PersonId and we have code like: ...

How to override a Dispose method with diposedValue being Private?

Hello, I must add some Dispose code to a class that inherits from a class that already implements IDisposable so I tried to do an Override of the Dispose method but I have not available the disposedValue because it is declared as private. How can I add the new Dispose statements? Protected Overridable Sub Dispose(ByVal disposing As Bo...

Is there a common design pattern for making a collection class page-able?

I've run across this design issue a number of times and was wondering if there is a common OOP design pattern that addresses it. Design Issue: I need to implement a class that represents a collection of objects that can get quite large. For performance reasons, the presentation layer will present the data in individual pages requesting...

Standard Pattern for Iterating Over Loop and Printing Start and End Tags

Hello all, This is a problem I have run into before and I have yet to find an elegant solution, so I thought I would ask for SO's help. I am iterating through an array and printing off some information from that array and having trouble figuring out how to print my start and end <div> tags. Below is an example table and the desired out...

What are your thoughts on page scrolling in a business application?

Let's say you are designing a web application for internal business use. Should a page be designed to not scroll, and either use paging or have scrollable sub-sections (tables, grids, etc) or is it better to allow the page to simple scroll. What happens when you have a long page that requires a Save/Cancel button or other such buttons. ...

Linq-to-SQL Design question!

What if you need to create POCO objects from a dbml file? Do you use a generator and who? You write the POCO's manually? Say you like to make your objects Persistent Ignorant and share to clients, then create a DAO pattern for the communication between Client - DAO - L2S Objects, this is a question for disconnected design using Linq 2 SQ...

Design Question: Which is Better practice? (part 2)

Hello, I've got a web interface from which I will gather user data (username,pass,email,etc..) and the backend has to provision these data into 3 other systems (SystemA, SystemB, SystemC). The provisioning is being done by 3 different APIs one for each system (A,B and C). My current design in the backend looks something like this: ...

Is it better to have more number of dll's

Hi, I'm designing an application. I found that to make it more modularize, the number of dll's getting increased. Is it a better design to have more number of dll's? Regards ArunDhaJ ...

Design Patterns Video Tutorial

Where can I find a good video/screencast tutorial that will explain and give code examples on Object oriented design patterns - ideally using c#? Many thanks ...

robocode engine: how to design (write) the runtime engine -- the robot world

IBM has (had) a free learn-Java program called RoboCode, in which custom robots could be written that would then do battle in a 2D space. I would like to write the environment that supports such robots, but don't know what pattern or design to use. Each robot is a thread. Each thread is given a certain (indeterminate) amount of run-ti...

Trying to understand the wikipedia strategy pattern example using new Func<int, int, int>

I was looking at this, http://en.wikipedia.org/wiki/Strategy_pattern and I understand the concept of the strategy pattern, but could someone explain the C# example a bit. I dont really get the how and why of the definition of 'Strategy' in the Context class, why is it Func<T, T, T> but then just two params are passed in eg 8,9 ? static...

What Is Utility Services ?

Hai, I need some information about Utility Services Layer. Can someone Please help me in getting information on that as I am supposed to give a presentation on Utility Services Layer. Thanks in advance... ...

My DAO's are starting to look the same, suggest a remedy design pattern?

I've noticed that having a data access object (DAO) interface and implementation is really starting to add up: public interface ForceDAO{ public void store(Force force); public void delete(Long forceId); public Force findById(Long forceId); public List<Force> findAll(); public void deleteAll(); } I have this same i...

When to use Abstract Factory and when to use Factory Method?

Could someone give me clear samples on when it's best suit to use de AF rather than the FM design pattern? AF:Abstract Factory FM:Factory Method Best, ...

Combination of values and appropriate Design Pattern

Greetings, I would like to ask what kind of design pattern will be the best in the scenario described below: I have a two combobox: option1 option21 option2 option22 option3 option23 option4 option24 there should be a specific combinations of those two comboboxes - only specific values should be displayed in...

State Pattern with Memory

I was using State Pattern in a normal state machine. I wanted to be able to go from [A -> B], [B -> C], and [A -> C]. Now our domain has a new rule, now i need to go from [C -> A] also,but only if i have never been in B before. So we have states with memory. There are two possible solutions: Create a new State CB wich means C after B...

Which Design pattern

Hello I have a program which models manufacturing process. In each stage of the process , objects are created. Specific objects can be created only in certain stage . The objects created in later stage, are using the objects created in earlier stages i.e output of previous stage is input to later stage.Which design pattern to use to mod...

Refactoring help...property-based object or lots of member fields?

I'm currently refactoring a class which currently looks something like this: class SomeModel { private String displayName; private int id; private boolean editable; private int minimumAllowedValue; private int maximumAllowedValue; private int value; // etc. etc.... a bunch (10+) of other fields... // an...

"Value" member field can be one of four different types - best design?

I have a class called "DataModel" or something, which is basically a unit of data which can be either a string or a number or a date or a boolean with various (identical) attributes. What is the best way to write this model? Have the value be of type Object interface DataModel { Object getValue(); // cast to whatever is needed ...