design-patterns

Is REST suitable for large 3NF models

There are many examples of using REST with simple data models. For example a customer with 5 properties and a collection of orders with 6 properties. However I have a hard time visualizing using REST against a model that is more complex -- that you may find in government procurement, finance, medical records management etc. Are there ...

Restore of data replicated with erasure-coding

I need your help on the design of the restore-procedure in a backup system I'm building. The prerequisites are the following: A restore can be made of one or several files. A file consists of 1 or more data-blocks (on average 16mb in size, minimum 4mb maximum 64mb). A data-block is replicated using erasure coding into replication-bloc...

Factory Pattern: Enums or Types?

When implementing a factory or simple factory, what would go against using a Type instead of an Enum to specify the class to instantiate? For example public class SimpleFactory { public static ITest Create(Type type) { if (type == typeof(ConcreteTest1)) return new ConcreteTest1(); if (type == typeof(ConcreteTest2)) return n...

Principles, Best Practices and Design Patterns for functional programming

Are there any known principles, best-practices and design patterns that one can follow while writing code in a functional programming language? ...

RollBack or Commit (Enterprise Library Transaction) over classes when other class get result in C#

I have a class which is mirror of table. public class Patient { public int Patient_id { get; set; } public string Name { get; set; } public string Address { get; set; } public bool Sex { get; set; } public Patient f_UpdatePatient(Patient _patient) { string QUpdate = " ...

WPF MVVM : Commands are easy. How to Connect View and ViewModel with RoutedEvent

Hi Suppose I have a view implemented as a DataTempate inside a resource Dictionary. And I have a corresponding ViewModel. Binding Commands are easy. But what if my View contains a control such as a ListBox, and I need to Publish an application wide event (Using Prism's Event Aggreagtor) based on the Item being Changed on the List. if L...

Is it better to externalize object creation from XML or to do it from the constructor?

Hi I have some PHP classes I am creating from XML config. What I would like to know is this: Am I better off (from an object-oriented standpoint) having factory methods to create those classes from XML or passing in XML to the constructor to create the classes? The factory approach has the advantage of separating construction from usa...

Null vs Value Not Set

We've written a web service which uses a simple entity translator to map the values of DTO back on to "real" server side business objects. As part of this excercise. We have come across an "interesting" distinction between explicitly set null values and clients having not set a value. The problem is essentially that we want to set a def...

Design Pattern Help: Pool of unique objects

I'm looking for a design pattern to manage a pool of objects. A thread can request an object, in my case an object representing a remote host. If the host-object does not exist it is created, added to the pool and a reference returned. If another thread or object requests the same (remote host) object it too is given the reference. If ...

Command buttons position - UI design

Which design do you use? What is the size of a button? In which order? Do you prefer A=OK B=Cancel or A=Cancel B=OK Do you use "Windows" button size: 80x24 px or your own? ...

Design patterns for web services?

Hi, I am developing web service in C#, .NET 2.0. What are the proven design patterns for a web service? If possible please provide me the link about these design patterns? ...

C# 2.0 Design Question - Creating sublists from a larger list

I am looking for a good design/alogrithm/pattern for the following: I have a large list of TODO tasks. Each one of them has an estimated duration. I want to break the larger list into smaller sublists, each sublist containing a max of 4 hours of work. My current algorithm is something like this: while( index < list.Count ) { Li...

How would the mvc work in the following case -C#

K so last year I made a family tree program in java as a group project and we used MVC but I really forget how it works, and the notes aren't online anymore. To make things worse, since our project wasn't huge the prof said to combine the Model and Controller. So now that I'm trying to make a sweet project to add to my employability port...

Why did Microsoft choose MVC for ASP.NET?

In addition to being a 30 year pattern, MVC was never meant for current applications. MVP was its successor and designed to handle event based apps coming out in the 90s. Passive View and Supervising Controller seem to have risen to the top. For those two, it almost isn't necessary to talk about MVC/MVP. Specifically, is the controll...

Best practices for developing refactor friendly code

Being a Java developer in an agile development cycle, I have learnt that it is essential to make sure I design my classes in a manner that I can refactor them easily without much of a pain. I want to know, what are the best practices that you follow in your daily design/development cycle that helps you to perform refactoring easily. For ...

Implementing the Strategy Pattern

When implementing the Strategy Pattern, where does one put the code that determines which strategy to use? Some sample pseudo-code would help. ...

Designing loosely coupled components in .NET - Provider Pattern

I have been told that the Provider pattern is a way to design loosely coupled components. I am working on designing an API. Could you please point to links where Provider pattern is explained. I found one here, are there any more that describe provider pattern using .net as the framework ...

webform linq to sql and repository pattern sample project

can anyone provide a webform linq to sql and repository pattern sample project link ...

Is Bridge Pattern same as the Provider Pattern?

Is the Bridge Pattern same as the Provider Pattern. I did not see the Provider Pattern listed in the GoF book ...

What design pattern should I use to pass information between multiple dialogs in a desktop app?

I am working on a CRUD application using .NET and I have about 10 or so dialogs I must implement. The user will enter information on one dialog and be sent to another dialog depending on the information being passed. This application basically mirrors what Spring MVC and JSF do when passing information between JSP pages. Is there a de...