patterns

A good design pattern for almost similar objects

Hello, I have two websites that have an almost identical database schema. the only difference is that some tables in one website have 1 or 2 extra fields that the other and vice versa. I wanted to the same Database Access layer classes to will manipulate both websites. What can be a good design pattern that can be used to handle that ...

NHibernate transaction management in ASP.NET MVC - how should it be done?

I am writing a simple ASP.NET MVC using session per request and transaction per request patterns (custom HttpModule). It seems to work properly, but.. the performance is terrible (a simple page loads ~7 seconds). For every http request, graphical resources incuding (all images on the site) a transaction is created and that seems to delay...

Messaging pattern question

Process A is calculating values for objects a1, a2, a3 etc. and is sending results to the middleware queue (RabbitMQ). Consumers read the queue and process these results further. Periodically process A has to send a snapshot of these values, so consumers could do some other calculations. Values for these objects might change independent...

MVVM pattern: ViewModel updates after Model server roundtrip

I have stateless services and anemic domain objects on server side. Model between server and client is POCO DTO. The client should become MVVM. The model could be graph of about 100 instances of 20 different classes. The client editor contains diverse tab-pages all of them live-connected to model/viewmodel. My problem is how to propaga...

Video Synthesis - Making waves, patterns, gradients...

I'm writing a program to generate some wild visuals. So far I can paint each pixel with a random blue value: for (y = 0; y < YMAX; y++) { for (x = 0; x < XMAX; x++) { b = rand() % 255; setPixelColor(x,y,r,g,b); } } I'd like to do more than just make blue noise, but I'm not sure where to start (Google isn't help...

wpf command pattern

I have a wpf gui which displays a list of information in separate window and in a separate thread from the main application. As the user performs actions in the main window the side window is updated. (For example if you clicked page down in the main window a listbox in the side window would page down). Right now the architecture for th...

Domain-Driven-Design question

Hello everyone, I have a question about DDD. I'm building a application to learn DDD and I have a question about layering. I have an application that works like this: UI layer calls => Application Layer -> Domain Layer -> Database Here is a small example of how the code looks: //****************UI LAYER************************ //Us...

Are all of the core J2EE patterns still good in context of JEE?

With the arrival of JEE and EJB 3, have any of these Core J2EE Patterns become obsolete, or stand deprecated in light of (better) alternatives? Are there any new patterns that one could use? Thanks... ...

WPF: Master/Detail situation

I have an area on the left with selectable items, and depending on what type of item is selected, I want to show one of three or four different forms on the right. It would be nice to make some type of control so the main form can be less of a mess. What's the best pattern for this in WPF? I'm a WPF newbie, and I've spent some time g...

Arranging VS2008 generated LinqToSql/EntityFramework data models/contexts in assemblies.

What pattern should I use for data-access in case of VS2008 generated L2s or EF DataModels? Repository-pattern or what? As we know VS2008 generates Data-Models and DataContexts/ObjectContexts in the same file, then, how should I arrange my VS2008 assemblies in my VS2008 solution to achieve a layered design? If I use repository pattern,...

PHP OOP Design Patterns: Should I Create two seperate classes for registration and form validation?

So here's my problem: I have two types of registration, registration A and registration B, each will have some of the same fields and some different fields. I was going to create abstract class registration and both A and B would have their own classes that extend from registration. My question is, should I create a seperate Validatio...

Scala's tuple unwrapping nuance

I've noticed the following behavior in scala when trying to unwrap tuples into vals: scala> val (A, B, C) = (1, 2, 3) <console>:5: error: not found: value A val (A, B, C) = (1, 2, 3) ^ <console>:5: error: not found: value B val (A, B, C) = (1, 2, 3) ^ <console>:5: error: not found: value C ...

Pattern for GUI applet for sound control

Writing a sound control applet with GUI that communicates with a device via USB. There are several type of controls being used, faders, knobs, on/off switches. Although there are functional similarites there are often different calcualtions, ranges and settings for each, though ultimately everything gets funneled into a big structure and...

Design pattern for extending Android's activities?

While programming on Android, I end up writing a parent activity which is extended by several others. A bit like ListActivity. My parent activity extends Activity. if I intend to use a Map or a List, I can't use my parent activity as superclass - the child activity can only extend one activity obviously. As such I end up writing my paren...

Question About Classic MVC

Hello, In classic MVC the model notifies the view about changes made on it. In C# this means I have to subclass the View I'm interested in and in the subclassed class register to the model's event. For example, if I were to implement MVC using C# and Winforms, I had to subclass TextBox class and then register inside the MyTextBox's cons...

Which book should I choose?

Hi guys, I'm looking for a good read on object oriented design. The two books I'm currently looking Head First Design Patterns and Head First Object object-oriented analysis & design. They seem very similar when looking at the contents and browsing through available sample text. Which one would be the best choice? About myself: I have ...

differences between facade pattern and other patterns

Hi,I have a question about patterns.I have really problems with design patterns Can you tell me the difeerences between facade pattern with builder,factory and abstract factory pattern? ...

MSMQ - Message Queue Abstraction and Pattern

Hi All, Let me define the problem first and why a messagequeue has been chosen. I have a datalayer that will be transactional and EXTREMELY insert heavy and rather then attempt to deal with these issues when they occur I am hoping to implement my application from the ground up with this in mind. I have decided to tackle this problem b...

Linq to XML lessons learnt

Hi guys I'm just starting a project which requires some pretty hardcore linq to xml to be used and I am just wondering what people consider best practice and lessons learnt. For instance, I am worried about all the nulls that are possible all over the place... This is something that I am using but how do other people deal with it: ...

set width height by a set a parameter in html

i need to set a image at 128*128px on a html page. i know the way width="128px" height="128px" but are i can do it by write a parameter on image like param="128px" then he set width and height 128px; ...