A variety of apps out there, like Firefox, Fring, Skype run on a variety of platforms. How do they manage their code? Do they have different UI for different platforms? As in, Firefox have to use Cocoa on Mac, WinForms or equivalent on Windows, QT equivalent on Linux. How is it possible for the same source code to show diff UI just by co...
Does anyone have any good links about a practical example of Unit of Work pattern with LINQ to SQL
...
Martin Fowler suggests using a service layer as a boundary between the domain model and and "Data Loaders". However, Rockford Lhotka suggests building validation into the business object itself and this is exactly what CSLA.NET does.
The benefits of abstracting this into a service layer is obviously that your service layer can coordinat...
I've been tasked with re-writing a fairly large web application for a company. This application provides certain financial/risk analysis to 3 clients that we currently have.
The huge issue around this app is each client is different and has slightly different data. They all log into the same website but after that their experience ca...
I am wondering about how to approach inheritance with View Models in the MVVM pattern. In my application I have a Data Model that resembles the following:
class CustomObject
{
public string Title { get; set; }
}
class CustomItem : CustomObject
{
public string Description { get; set; }
}
class CustomProduct : CustomItem
{
...
I think a classic example is that the Window class can have a Border decorator and a ScrollBar decorator in the GoF book.
What are some situations you think, know of, in which the Decorator Pattern solves the problem really well?
...
Update: Since we usually say, "the situation will determine if any Design Pattern is a good fit for the job"... will a coffee ordering system in real life be solved using the Decorator Pattern?
Is the Decorator Pattern too much for implementing a coffee ordering system? The Head First Design Patterns book use it as an example, but I t...
How important are Design Patterns really?
I think the earlier generation of programmers didn't use Design Patterns that much (people who graduated in the 80s and before mid 90s). Do the recent graduate know it in general and use it a lot more?
If you are interested, I also made a survery and you can view it here:
http://www.surveym...
I'm not sure if I'm using "standard" terms, but this is a basic OO question I'm trying to resolve.
I'm coding a windows form. I don't want logic in the form event handler, so I just make a call to a custom object from there.
At the custom object, there are two sets of logic.
The "controller" logic, which decides what needs to get ...
For performance reasons, I am using the the Curiously Reoccuring Template Pattern to avoid virtual functions. I have lots of small commands which execute millions of times. I am trying to fit this into the Command Pattern. I want to add tons of commands to a queue, and then iterate through them executing each one by one. Each Command...
I've noticed that on all the examples that illustrate the decorator pattern, there is a base class/interface and there is a decorator class that inherits/implements it, after which, all the decorated classes extend the decorator class. Something along the following lines :
Interface Window > WindowDecorator > WindowDecorator > VerticalS...
On one hand, I'm told that exceptions in C# are 'expensive', but on the other, I'm stuck on how to implement this.
My problem is this: I'm making a Stream derivitive, that wraps a NetworkStream. Now, the problem I'm facing is this: Read(byte[] buffer, int offset, int count). From the Stream docs for the function:
Returns:
... o...
Say I have one database, and this database has a set of tables that are general to all Clients and some tables that are specific to certain clients.
Now what I have in mind is creating a primary DataContext that includes only the tables that are general to all the clients, and then create separate DataContexts that contain only the tabl...
Soliciting feedback/thoughts on a pattern or best practice to address a situation that I have seen a few times over the years, yet I haven't found any one solution that addresses it the way I'd like.
Here is the background.
Company has 3 applications supporting 3 separate "lines of business" that are very much related to each other. Tw...
I'm in a situation where I'd like to instantiate an object of a type that will be determined at runtime. I also need to perform an explicit cast to that type.
Something like:
static void castTest(myEnum val)
{
//Call a native function that returns a pointer to a structure
IntPtr = someNativeFunction(..params..);
//determi...
Hi,
I wonder what's the pros/cons of using delegate vs OOP when implementing strategy design pattern?
Which one do you recommend to use? or what kind of problem does delegate solve? and why should we use OOP if OOP is better?
Thanks!
-tep
...
I am looking for an alternative to the visitor pattern. Let me just focus on a couple of pertinent aspects of the pattern, while skipping over unimportant details. I'll use a Shape example (sorry!):
You have a hierarchy of objects that implement the IShape interface
You have a number of global operations that are to be performed on all...
Hi all!
I have the following as an example:
public enum HttpRequestHeader
{
Accept,
AcceptCharset
}
public static class HTTP
{
public static Hashtable HttpRequestHeaderString
{
get
{
Hashtable returnHashtable = new Hashtable();
returnHashtable.Add(HttpRequestHeader.Accept,"Accept");
returnHashtable.Ad...
I'd like to collect statistical information, such as PageViews, Number of comments for each user, etc. I've thought about using the observer pattern. How would I implement this in ASP.NET MVC?
...
I've started to read about the Context design pattern. Here's what I understood from the text :
you have a map containing all your variables
you pass it around to whoever needs it, so that you won't have to send all the variables as method parameters
Did I "get" it?
...