design-patterns

What is the best way to manage Form state?

I'm developing a form in a C# .NET 2.0 application that contains complex logic regarding the state (enabled/disabled) of various controls on the form. (The design is a symptom of a business analyst's poor understanding of UI best practices.) What would be the best way to go about managing the "state" of the form? Normally, I've seen...

DDD: Saving Changes to Model and accessing Repository

I have a Question object thats the root of the Question Aggregate. THe question has associated Answer Entities in its aggregate . When a new Answer object is created, the changes will be saved to DB via repository. Can I call a repository method SaveAnswer(Question ID) or must I call a SaveQuestion(QUestionID) and have the Repository det...

DesignPatterns: Which is most appropriate to use for a wizard style user interface?

I am implementing a Wizard style user interface. As a user flows through the wizard, clicking next, depending on the choices they have chosen on each screen, the user will have to go through a certain set of wizard screens. This is being built in ASP.NET MVC. I am wondering what design pattern would be best suited to implement the l...

What's the best design pattern for this problem?

Currently I am trying to implement a system or a way to create types but also get the type name when created. So say I have actions like these, that can be created by the user of the app: Blur Contrast Sharpen Diffuse Invert ... So how should I extract their name when they are created through the UI. So say you have seperate UI butto...

Java: Dependency Injection on foreign-constructed objects?

Hello! I'm a huge fan of D.I. I'm currently developing a not-so-small project which uses D.I. everywhere (classic and beautiful D.I. by hand). From my point of view there are following advantages: It's intuitive when you got used to it, doesn't affect readability in negative way (in fact, it gets even better), but the most importan...

Is there an open source equivalent to FlexLM?

I am interested in studying license management patterns and coding techniques in detail. ...

Is it possible to have an open source implementation of DRM software?

I am curious to know if anyone has figured out a way to create the server portion of DRM in an open source manner while allowing for DRM clients to be closed. I understand that if the client were open source, it would be easy to remove the DRM checks, but I believe the server doesn't suffer from the same challenge. ...

How much autonomy do you give developers in applying patterns?

I get to work with a number of companies, mostly with architects/lead developers and sometimes directly with the developers. One thing that comes up often is that when architects prescribe an application pattern, they want it to be followed consistently every time with little to no room for variation. Presentation Model/M-V-VM A good ...

User-adjustable data structures

Hi all, assume a data structure Person used for a contact database. The fields of the structure should be configurable, so that users can add user defined fields to the structure and even change existing fields. So basically there should be a configuration file like FieldNo FieldName DataType DefaultValue 0 ...

How you would you describe the Observer pattern in beginner language?

Currently, my level of understanding is below all the coding examples on the web about the Observer Pattern. I understand it simply as being almost a subscription that updates all other events when a change is made that the delegate registers. However, I'm very unstable in my true comprehension of the benefits and uses. I've done some go...

Mapping Linq Entities and Domain Objects and object tracking

If I map my Domain objects to linq Entities will I now not be able to track changes when saving my domain objects? So for any change in my model that i wish to make, once I map the object to linq entities for submission to db, all object values will be submitted to the db by linq since it it goes through a mapping first? Or would the obj...

What's the accepted way to implement export functionality in a document-based Cocoa app?

I have a simple document-based Cocoa app that acts as a viewer for .wav files, to do a bit of frequency analysis. I'd like to be able to export the data gleaned from opened files to CSVs for further analysis in other programs. The document-based application framework in Cocoa lets you override - (NSData *)dataOfType:(NSString *)typeNam...

Activator.CreateInstance - Explain it so I can understand

So I am looking at some sample code, and I am not sure what to make of this: Private Shared _instance As PollsProvider = Nothing Public Shared ReadOnly Property Instance() As PollsProvider Get If IsNothing(_instance) Then _instance = CType(Activator.CreateInstance( _ Type...

what is context object design pattern ?

what is context object design pattern ? ...

Handling collections with mixed POJOS, with different handler for each POJO

I'm trying to find an elegant OOP solution for the following problem. Assume we have a collection of POJOS, events in this case, where each POJO is possibly different class. We need to process this collection, using different rules for each POJO class (or type). A basic assumption is that we can't decorate the POJOs with appropriate h...

What's the proper "C++ way" to do global variables?

I have a main application class, which contains a logger, plus some general app configurations, etc. Now I will display a lot of GUI windows and so on (that will use the logger and configs), and I don't want to pass the logger and configurations to every single constructor. I have seen some variants, like declaring the main class ext...

Why does VS2005/VB.NET implement the IDisposable interface with a Dispose(disposing as boolean) overload?

Recently I needed to compare a suggested pattern for IDisposable and object finalization with the auto-generated one we which VS2005/VB.NET provide. We have used the auto-generated one a fair bit, but after looking it the two side by side I had a number of questions about the VB.NET implementation... For reference, here is the IDE's im...

Implementing a save function in a C# image manipulation app

I started thinking about how to handle the save functionality of my app, and thought about 2 options: The application has nodes like: Blur Contrast Sharpen Invert ... 1. Interpreting the saved file, like: Blur name:"Blur01" Amount:5 ... 2. Having the saved file in a self executable format, like: Blur blur = new Blur (); blur.Name...

3-Tier .NET applications resources

Hi, A friend of mine doesn't have much experience on 3-Tier applications design and development and he would like to broaden his knowledge on this subject. Can you point me to good online resources or books on it? It would be great if they started from the principles. I was thinking of this tutorial as a good starting point. What resou...

Backup utility design suggestions

I'm currently learning Qt and have decided to write a little application to backup important documents each month to DVD. My current design makes use of the 7zip library along with cdrtools (mkisofs and cdrecord) to compress the directories into a spanning zip archive comprising of zip files each the size of a DVD and then use mkisofs to...