Let's say you have a .NET system that needs to send out email notifications to a system administrator when there's an error. Example:
try
{
//do something mission critical
}
catch(Exception ex)
{
//send ex to the system administrator
//give the customer a user-friendly explanation
}
This block of code gets called hundred...
I'm using Linq-To-SQL for a project with around 75 tables. We have to keep a cache of entire tables that we pull down because the entities are all interrelated and pulling them on demand takes way too long. So, to track all of these entities from all of these tables, we have a single class responsible for maintaining in-memory table refe...
I'm hoping to assemble a definitive and useful study guide. Please help!
I'll start:
Program to an Interface not an Implementation
Interface Separation Principle
DRY Principle (Don't Repeat Yourself)
Law of Demeter
Liskov Substitution Principle
Dependency Injection/Inversion of Control
Separation of Concerns
Loose Coupling
Open Clos...
I'm trying to find research/advice on a particular code refactoring pattern, but I'm finding it hard to locate, since I'm not sure whether there's a good name for it. It's very similar to factoring out repeated code, except the code wasn't repeated in the first place: it was just stashed away in a conditional branch of a larger function...
Currently in code i have used an object factory to return me a processor based of a string tag, which has severed its purpose up until now.
using Core;
using Data;
public static class TagProcessorFactory
{
public static ITagProcessor GetProcessor(string tag)
{
switch (tag)
{
case "gps0":
return new GpsTagProce...
Hi Folks,
I have more of a "what-would-you-do" question than an actual coding question.
It relates to a project I am currently working on. In this project,
we are tasked with combining several marketplace APIs into one interface. Each
API has its own unique way of categorizing products. The top-level
parent categories for all the API...
I am starting a project that involves coding a Black-Box Trading Bot for a strategy one of my friends created, and I was trying to think of what the best design pattern would be.
My current thought is that I should use the Actor model to allow for lots of concurrent calculation and information passing.
Anyone else have any ideas? Or ag...
I got an implementation of Parcelable working for a single class that involves no inheritance. I have problems figuring out the best way to implement the interface when it come to inheritance. Let's say I got this :
public abstract class A {
private int a;
protected A(int a) { this.a = a; }
}
public class B extends A {
priv...
I have one collection of objects that many of my forms (using WeifenLuo.WinFormsUI.Docking) need to interact with.
i.e. If the collection has an addition (or deletion) made in one form, then the other forms respond by refreshing their views.
Obviously, an observer pattern would be a good candidate here. However, I am having issues try...
I'm trying to get my head around the usage of the factory pattern, when I wish to disable features within an application.
Lets say for example I have a factory called LoggerFactory, which creates a logger instance.
If in the configuration logging is disabled in my application:
Should the logger factory pass back an instance of the log...
Hey everyone,
I'd like a few pointers as to a very specific situation i'm in regarding desigining and implementing a package in Java in an object-oriented manner. I hope i can get the idea across in a clear and not so sophisticated manner - or maybe not. Any ideas on useful design patterns to look at?
Here goes..
The outline of the pr...
Suppose you have an application that consists of two layers:
A: A data layer that stores all the data loaded from a database or from a file
B: A layer that shows the data in a nice user interface, e.g. a graphical report
Now, data is changed in layer A. We have 2 approaches to make sure that the reports from layer B are correctly up...
..where do you begin?
As a basis for any design - for instance a package - where do you as a developer start.
I start by mapping out the requirements and breaking them down into sub categories and from this objects and methods.
Usually takes a while before I start drawing it out by hand - then that goes through a few versions. But I a...
Hi, i'm trying to develop a simple multiplayer video game (2d) in C#, SDL.NET and obviously .NET.
Two, or more player over internet, can control a car (class CAR) who move on the screen with X and Y.
One PC is the server, others are client.
So, i think "The only value to 'pass' between Players are the value of variables X, Y, and so...
I have a list of events that i need to fire when a user takes an action and an event manager that fires these events.
Originally i used to fire the events explicitly in this way
EventManager.publish(new SendNotificationEvent())
Then i wanted to change that to something like
EventManager.publishSendNotificationEvent()
To do that,...
I've got an app that implements a command object pattern to get data from a server. Now I'd like to implement a client side cache and I need some pointers on how to deal with cache eviction invalidating.
The problem
To get an object I pass the GetObject(id) command and receieve a GetObjectResponse with the results for that id. I've go...
Hello!
This is probably a pretty novice design question. I'm trying to work my way through a number of requirements and give the users the experience they're looking for...
I've written a tool that does big calcluation-type things. It currently consists of a class library and command line tool (separate .NET projects.) We're using an...
I was looking for a book or msdn article for developing a framework/library which extends the .net framework like here. Where can I find good design guidelines?
...
All of a sudden I'm having a bit of an OO crisis. Over the last couple of years I've made quite good use of Singleton objects. I used them in many places.
For example, in designing an MVC Java application, I'd create a Singleton 'SystemRegistry' class to store the model and view classes (I've only worked on simple apps and the need for ...
This SO answer references "Small Boy With A Pattern Syndrome." Although I can infer some meaning by context, I don't fully understand.
What is a good definition for "Small Boy With A Pattern Syndrome"?
...