patterns

C# Auto Property - Is this 'pattern' best practice?

I seem to be using this sort of pattern in my code a lot , I know that it is not a simple Autoproperty any more as that would be: public IList<BCSFilter> BCSFilters { get; set; } The code I have been using is this: private IList<BCSFilter> _BCSFilters; /// <summary> /// Gets or sets the BCS filters. /// </summary> ...

Template pattern violates encapsulation?

Hi guys, Please take a look at this piece of code I came up with. abstract class Command { public void Execute(string[] commandParameters) { CommandResult result = ExecuteCommand(commandParameters); PrintResult(result); } public abstract CommandResult ExecuteCommand(string[] commandParameters...

Caching ideas anyone?

Hi, I have the following, very interesting class... pubilc class Thing{ public Thing() { DoSomethingThatTakesALongTime(); } pubic boolean CheckSomething(string criteria) { return criteria == "something"; } } In my ASP.Net MVC application, I need to call make a call to CheckSomething, very frequently. As you can see, the constru...

creating API using adapter pattern

I am working on an API for several web services, which all return a list of products. However, the objects returned are quite different. They have some overlap in member variables and methods, but also a number that are either conceptually different or slightly different. What would be the best way to structure the API? I think this is t...

Understanding hibernate internals

Hi, Im trying to understand how hibernate works under the hood, how it manages lazy load, transactions, data mappers, unit of work, identity maps, etc. I wrote a small object model, and im downloading hibernate's source code for debbuging it. Im kind of lost, is this the best approach? Does documentation on these issues exist out ther...

A better design? Same object, different possible states

Hello, I have a very simple application which consists of an ASP.NET front end site, with a WCF Windows Service doing the heavy lifting back-end logic. The user has one simple page where he selects some parameters and pushes a 'submit' button. The page calls the WCF service and passes it the parameters. The service instantiated an inst...

Does anyone know of a computer programming work patterns site?

There are all those Design Patterns wikis -- you know, with Singleton, Iterator and all that. I'm not looking for that. I'm looking for one level up from that: computer programming working patterns. Such as "Debugging", "RetreatAndSolveSmallerProblemFirst", and the like. EDIT: Clarifying that I'm interested in individual work patterns r...

Pattern name for create in constructor, delete in destructor (C++)

Traditionally, in C++, you would create any dependencies in the constructor and delete them in the destructor. class A { public: A() { m_b = new B(); } ~A() { delete m_b; } private: B* m_b; }; This technique/pattern of resource acquisition, does it have a common name? I'm quite sure I've read it somewhere but can't find ...

Difference between a factory, provider and a service?

What is the difference between the terms factory, provider and service? Just getting into nhibernate and its repository pattern (POCO classes, etc). ...

is it possible to use MVP pattern with Codesmith Ntier or PLINQO Template

Currently we are working on ASP .net application and i would prefer to go ahead with MVP pattern (for UI) due to several advantage it provides, But the con of going ahead with that approach is too much of hand coding which will eat up time. I already identified that it is possible to generate DAL with any template or by using LINQ to S...

Pull-up refactoring, Objective-C

I have two similar classes, MultiSlotBlock and SingleSlotBlock. They have started to share a lot of common code so I have decided to do some refactoring and pull some of the methods up to a new superclass, let's call it Block. Now one of the methods that I pull up, simplified for the example, looks like this: // (Block.mm) - (void)...

Where should django manager code live?

This is a pretty simple django patterns question. My manager code usually lives in models.py, but what happens when models.py is really huge? Is there any other alternative pattern to letting your manager code live in models.py for maintainability and to avoid circular imports? A question may be asked as to why models.py is so huge, but...

What's a pattern for getting two "deep" parts of a multi-threaded program talking to each other?

I have this general problem in design, refactoring or "triage": I have an existing multi-threaded C++ application which searches for data using a number of plugin libraries. With the current search interface, a given plugin receives a search string and a pointer to a QList object. Running on a different thread, the plugin goes out and s...

HTML: table of forms?

I frequently find myself wanting to make a table of forms -- a bunch of rows, each row being a separate form with its own fields and submit button. For instance, here's an example pet shop application -- imagine this is a checkout screen which gives you the option to update the quantities and attributes of the pets you've selected and sa...

Calling ThreadPool.QueueUserWorkItem from Global.Asax Application_Startup

Is it a good pattern to call ThreadPool.QueueUserWorkItem from Application_Startup in Global.Asax . My intention is to call some Lucene indexing tasks. ...

ValueListHandler dependencies

Was just struck by a thought after looking through the ValueListHandler JEE pattern on the corej2eepatterns site: Why does the valuelisthandler require a reference to a data access object? Based on what is said, the ValueListHandler's job is to pretty much do the non-functional stuff (cache, sort, search traverse) with a list containing...

Any patterns for high availability of a Windows Service?

Situation I have a windows service which I would like to make highly available. I have two unclustered servers (Windows server 2003 standard edition). The question is: What options do I have to make my service highly available in an automated way? I can think of the asymmetric master-slave option which consists of keeping the servic...

Is it possible to make a pattern for a CGContext Path using a png

I want to make a path that has a png as it's pattern, or if you could or think it would be easier to make my own pattern, then tell me that also. I will be greatful to anyone who can put up some code. Thanks in advance ...

Singleton or not

Hi there.. I have a windows service running.Inside this service I have hosted some service (WCF). I need to have some kind of a "in memory data holder" class. The purpose of this class is to hold not-persistant data as long as the windows service is running. This class must be accessible thru the WCF services. They put some values in t...

Linux patterns and practices for hosting web application

I work mostly on desktop application on Windows platform. Now I am focusing on Linux platform to host web applications. While hosting the application on Linux, I don't follow any procedure. I simply CHECKOUT the files from SVN and run the application on home directory. I don't know where to store the application data (example: mysql/p...