patterns

Using a callback instead of returning state object

In my application, I'm executing a transaction which can be in three different states at the end of the execution: Success Failure Pending Depending on the state, the application client will want to perform different actions. In the case of success, they will want to retrieve the transaction result (a Widget). In the case of failur...

TDD: Unit testing focus

Could TDD be oriented to another kind of testing different from unit testing? ...

Which of these is a repository pattern?

My domain entities are lined up like a tree: Root - Child 1 -- Child 1.1 -- Child 1.2 - Child 2 -- Child 2.1 -- Child 2.2 We ended up with 2 (rather strong) opinions on how a repository should be designed around these domain objects: Opinion 1: I need 2 repositories Child1Repository & Child2Repository which gets managed by a RootFac...

How to write a Large WinForms application?

I'm going to write a rather big/complex WinForm application such as Paint.NET, SharpDevelop, etc. I think one of the most important things to build such an application is to structure the project properly to increase maintainability and control the complexity. So what kind of patterns or practices show I use? Any blog posts, papers, op...

Is this modified C# singleton pattern a good practice?

I'm developing a blog application shared by non-profit organizations. I want each organization to be able to change their own blog settings. I have taken a singleton pattern (from BlogEngine.net) and modified it. (I understand that it is no longer a singleton pattern.) I have tested this approach and it seems to work fine in a developme...

Is there a, kind of, 'Crystal Ball' OOP Design Pattern?

With regards to design patterns such as GoF, is there a pattern to decribe when one object needs to observe another object that is not even in existance yet? i.e. $crystalBall = new crystalBall(); $futureDependent = new FutureDependent(); $futureDependent->attach($crystalBall); ... then much later .... $importantObject = new Importa...

Design/Architecture question: rollbacks with remote services

Hi, For example, there's remote API with the following calls: getGroupCapacity(group) setGroupCapacity(group, quantity) getNumberOfItemsInGroup(group) addItemToGroup(group, item) deleteItemFromGroup(group, item) The task is to add some item to some group. Groups have capacity. So first we should check if group is not full. If it is,...

Asp.Net Web Framework for Asp.net 2.0 and Visual Studio 2005

I am working on re-factoring of an existing Asp.Net 2.0 web site. I am looking for a framework/pattern to modularise the application. As there is no WCSF for Visual Studio 2005 I can't use it and I also can not upgrade it to Visual Studio 2008 for reasons beyond my control. I can use Mono-Rail but I would loose the existing controls func...

Alternatives to Model View ViewModel for WPF

I've just been reading Josh Smith's MVVM article and am working on a WPF application at the moment. I'm umming and ahing about transfering my work so far to MVVM but find the idea of working purely through databinding and ICommands without any UI event handlers, a little daunting in the sense that it could take a while to convert what I...

What are the pros and cons of using a Data Services Layer?

This is a discussion that seems to reappear regularly in the SOA world. I heard it as far back as '95, but it's probably been a topic of conversation long before that. I definitely have my own opinions about it, but I'd like to hear some good, solid arguments for having a Data Services Layer, and likewise for arguments against having ...

Considering the actual data in a db, how would I choose between a RDBMS and a DocDBMS?

I'm not looking for a holy war here, I am thinking through a distributed architecture and would like input on How do I choose between a RDBMS vs. a DocDBMS? We cannot deny the power that can be had by using a RDBMS (i.e. MySQL, PostgreSQL, MS Sql Server, etc), they have been in development for more than 30 years and many issues have bee...

Is there a good jQuery pattern for managing initialization?

Basically I want to do something like this: $(document).ready(function() { if ($(body).attr("class") === "HomePage") { HomePage.init(); //bind events for home page (Crockford's module pattern) } else if ($(body).attr("class") === "AboutPage") { AboutPage.init(); //bind events for about page } }); ...

Pros/Cons on Lists with subsidiary objects

Hi, I'm again in the position to figure a way out to handle lists with subsidiary objects on our business objects. Actually, our code often looks like this: public class Object { private List<SubsidiaryObject> subsidiaryObjects = null; public List<SubsidiaryObject> SubsidiaryObjects { get { if (...

How can I convert a text-file outline list into a recursive collection of objects?

How can I convert this text file content into a recursive collection of objects that I can bind to a TreeView? i.e. I want to end up with a collection of 3 objects, the first one called countries which has a collection of three child objects: france, germany, italy, and so on... ANSWER: thanks to all who helped out on this, here's my co...

Repository Pattern and multiple related core entities or business objects - one repository or more?

Hi, I am looking at implementing the repository pattern (since what I came up with was 90% an implementation of it anyway), and have come across a design question - where I have two or more core business objects (for example, Business and Contact in a CRM app), the BO's can be strongly related or not related at all. In this situation, ...

What's the Best UI Design pattern for designing large-scale application ?

We have a large M.I.S system which contain 12 sub systems. Version 1.0 is completly finished and We decide to change the User Interface in Version 2.0. So We are looking for some good UI design pattern for large-scale web based system. If you know any good UI Design Patterns, please let us know ? Also if you think we should consider so...

C++ templated class implementation of the multiton pattern

I implemented the multiton pattern using a templated class in C++. #ifndef MULTITON_H #define MULTITON_H #include <map> template <typename Key, typename T> class Multiton { public: static void destroy() { for (typename std::map<Key, T*>::iterator it = instances.begin(); it != instances.end(); ++it) { de...

How best to encrypt/decrypt SQL Server data to prevent even developers from seeing it?

Here's an interesting problem, and I'm looking for a pattern that will keep it all workable. I am building a smart-client app for a school system. It will contain information about students including their report cards, sick days, and so forth. it will generate student-level reports, including their report cards, each rich with very p...

Large domain model in memory

I'm working on a project which has a large object graph in memory. The domain objects are really 'wide' and contain a whole load of data which is normally extraneous. I'm thinking about implementing some sort of lazy loading model. I'm currently thinking along the lines of having attributes on each of the properties that are lazy. ...

What is a good PHP design (pattern?) for my testing-application?

I want to write a simple class (PHP5) that can 'run' an unknown amount of subclasses. These subclasses are best translated as 'checks'; they all will more or less do the same thing and give an answer (true / false). Think of it as system startup checks. Over time new checks (subclasses) will be added to a directory and they should autom...