design-patterns

Application Services Vs WCF Services

Hi, What's the difference between Application Services and WCF Services ? In a distributed environment : Presentation => WCF => Application Logic => DataStore Should i consider Application Logic "Services" as also WCF Services, or may i create seperate WCF services that exposes some Application Logic "Services" to client with DTO <=>...

DataLayer in Linq with different version of Data model

Hi, I wanted to ask the SO community about this problem in my project. I have a Silverlight App Project in SL 3.0, which at the moment has a classic design with a business layer and a data layer in Linq2SQL. The problem is that the Data model can be in different version with some little changes in between. I have 2 solutions but neith...

What design pattern would you consider is most important to use?

What design pattern is most used? What design pattern should I learn first? ...

When can a design pattern make your software worse?

When can a design pattern make your software worse? I have seen a program where they used the facade pattern between the GUI and logic. They considered that no objects may be transported over this, so only primitive types were used which made it difficult to code. ...

How does one implement UI independent applications?

What are the fundamental techniques to make most part of my C# source code UI independent? For example, I would like to write my source code for Winforms desktop application which I shall be able to plug into asp.net web application or a WPF application with very minor changes. I.e. I shall be able to use the same source code irrespecti...

Singleton in go

How does one implement the Singleton design pattern in the go programming language? ...

Best way to design authentication in application?

I have design windows application that auto-generate menu items and authentication from database. First time authentication has only one property, so I decide to design to persist authentication in it Tag property. However this property growth to 3 properties, so I want to know is it good to still persist authority in Tag property or cr...

design pattern asking for advice: push model v.s. pull model

Hello everyone, My application has several workers (working on different things as different processes) and some resources (working unit). Different workers need to process on all working unites. For example, I have workers like W1, W2 and W3, working unit U1 and U2. Then W1 needs to process U1 and U2, the same as W2 and W3. The restric...

What design should I use so a class can query one of it's ancestors?

I'm creating an object hierarchy that is representing a table that is draw on a control. My hierarchy looks like this : Table has multiple pages Page has multiple lines Line has multiple cells Cell has multiple glyph I want to have an option (a parameter) on the table to filter the column (cells) displayed. The client code can do some...

Replace Switch/Case with Pattern

I have code very similar to this example three times in a code behind. Each time the switch is toggling off of an option that is sent to it. Each time the code inside the case is exactly the same except for a parameter based of off the case. Is using a switch/case and methods the best way to do this? Should I think of using sometype of...

"Swapping" a UIView Instance variable - cannot dealloc "previous" view

I want to organize somehow my iPhone game's level-views, but I simply cannot (without expanding Object Allocations). I made a really "skeleton" of my code (this game has 2 levels, the goal is to release the iPhone display). I just cannot dealloc the previous level, so Instrunments shows incrementing BGTangramLevel instances. Please, tak...

WCF/Client apps - where should business logic go?

Hi We're building a WCF Web Service using WSSF. The idea is that it will expose our main database via the service and allow us to build various applications and web sites on top of the service. At the moment I'm building a simple client app that will download some data from this service, manipulate it then give it to the user as a repor...

Where is the best place to verify form data ?

Question is simple . Where should I put form verification process in the mvc design pattern (Zend , Symphony, Cakephp, Codeigniter) . I ask this question because i have my own framework. But i can not decide where should i handle form verification . For example , i can write if statements in controller but this makes controller "fat" , o...

Is there a better way to implment Equals for object with lots of fields?

see also Hows to quick check if data transfer two objects have equal properties in C#? I have lot of Data Transfer Objects (DTO) that each contains lots of simple fields. I need to implement Equals on all of them (so I can write some unit tests off transporting them var WCF). The code I am using is: public override bool Equal...

Instantiating classes by name with factory pattern

Suppose I have a list of classes A, B, C, ... which all inherit from Base. I get the class name as a string from the user, and I want to instantiate the right class and return a pointer to Base. How would you implement this? I thought of using a hash-table with the class name as the key, and a function pointer to a function that instan...

What pattern fits between a façade and a DAO?

I'm in the process of designing part of my companies architecture for its JEE web applications. I'm pretty clear on the reasons to use a façade and one or more DAOs. The problem I have is this: There will be some logic that definitely belongs in the integration tier because it's all about keeping the data model consistent. Except the lo...

How to reduce the total memory hogging by compacting my Objects in Java?

I have a table with around 20 columns with mostly consisting of varchars and decimals. This table has almost 1.5M rows. But few things are common in them like column1 consists of only 100 distinct strings , column2 has almost 1000 and column3 has almost 500. Right now, I am storing all these column values in a map with Key as first 5 c...

Looking for design suggestion

Hi, We have a desktop application.We have master data which we want to keep in memory.Should we go for a class which has list of all collections(static) and is filled once the application starts.What are the alternate strategies? I would like to avoid 'static' based solutions. thanks ...

How to call a shared member on types with different types?

I have different sets of custom Winforms controls all deriving from Control such as: CalculatorPanel, GraphPanel, DisplayPanel, etc : Control I use a single Form to display one or more of these sets depending on what the user wants to see. All of them has a member called: Input where the type is different such as: CalculatorInput...

Resources of designing a website permission scheme

I am developing a site that needs an access permissioning scheme. I am uncertain how I want to structure the scheme, and I am having a hard time finding good resources on determining not just how to implement a permission scheme, but how to plan what the scheme should be capable of doing. I have lots of questions and not a lot of solid...