design

Interfaces and Coupling

From a design and loose coupling standpoint. Is it a good idea to have an interface for each class in a project that might be part of a composition model? I have a project where I'm doing this, but now I'm getting rather a lot of interfaces, in an attempt to keep things relatively loosely coupled. ...

"Value" member field can be one of four different types - best design?

I have a class called "DataModel" or something, which is basically a unit of data which can be either a string or a number or a date or a boolean with various (identical) attributes. What is the best way to write this model? Have the value be of type Object interface DataModel { Object getValue(); // cast to whatever is needed ...

WCF Service Design Question

Hi, I have to create a WCF service that will accept thousands of requests every 5 minutes, which each request passing a small (1-5KB) text file. The service will pass the file contents to another assembly, which will process the lines and insert some records into the database. Nothing too heavy on this side. I need help on the followi...

Design Pattern problem involving N states and transitions between them

Hi All, I have a problem at hand and I am not getting which design pattern to use. The problem goes as such: I have to build a system which has 'N' states and my system has to do a transition from any state to any other state depending on some conditions. Ex: On condition 1, movement from State 1 to 3 and on condition 2 from state 1 ...

Controller <-> Service component interaction

UPDATED: I have a desktop application, with the following components interacting: Winforms UI. Service (in-process C# class that contains business logic to actually do stuff). Controller (C# class that coordinates events raised by the UI and calls service methods). If a controller asks a service to do something, but that service nee...

How important are design patterns in web development?

What are the design patterns that I should be completely familiar with? And what is one easy example that each can be used for? I am a web developer (I use Django, and is familiar with separation of logic), but I work at a Desktop-app company. They are always talking about singletons, and I forget...but it leaves me no clue! ...

Multiple "ID" columns in SQL Server database?

Via this link, I know that a GUID is not good as a clustered index, but it can be uniquely created anywhere. It is required for some advanced SQL Server features like replication, etc. Is it considered bad design if I want to have a GUID column as a typical Primary Key ? Also this assumes a separate int identity column for my clustering...

jQuery plugin design pattern (common practice?) for dealing with private functions

Hey all, I've been developing jQuery plugins for quite some time now, and I like to think I know how to design one well by now. One issue keeps nagging me though, and that is how to deal with private functions in a powerful yet elegant manner. My plugins generally look something like this: (function($) { $.fn.myplugin = function(.....

WCF service for handling SQL queries - advice please

Following on from this question, would it be a wise idea to place a WCF service at the server side, between client and database to handle queries? The idea being that you take load of the network and reduce round trips to and from a database. I would use the Entity Framework to query the database in the service, and just send results t...

What fonts are available on Android?

I know that android has a collection of fonts specifically designed by Ascender for Google, but what other fonts are available? I'm looking for a list like this one or even better this one. ...

General frameworks for preparing training data?

As a student of computational linguistics, I frequently do machine learning experiments where I have to prepare training data from all kinds of different resources like raw or annotated text corpora or syntactic tree banks. For every new task and every new experiment I write programs (normally in Python and sometimes Java) to extract the...

Storing Developer API Key/Secret on the server

Amazon's API requires you to have a signature which is a combination of many elements one being the secret. The sever checks this signature by matching the API key passed in the parameters with a secret it has stored in the database. My question is, how does amazon match the api key and secret, wont doing a query every time overload th...

Difference between event handlers and callbacks

Can someone please explain to me what is the difference between an event handler and a callback function? ...

Exception in static initialization block

Why doesn't Java allow to throw an exception from static initialization block? What was the reason behind this design decision? Any help would be greatly appreciated. Thanks. ...

Using classes for Django views, is it Pythonic?

I'm currently learning Python and coming from a strong C# background. I keep hearing about doing things in a Pythonic way to take advantage of the dynamic nature of the language and some of it I get and some I don't. I'm creating a site with Django and my approach to views is to use classes. My current thinking is to have a base class...

Returning from a multimap search with equal_range without being error-prone

I'm about to refactor some duplicated code. Two functions both search in a multimap using equal_range(). In a for loop after the call to equal_range() there is a for loop that sets an iterator to equalRange.first with the condition it != equalRange.second. If the correct value is found, the two functions differ. What I would like to do...

Is there a better design pattern/method to use?

Hello: I've currently completed one of two phases of a project that required I write database information to XML using C++. While use of a third party tool was used to do the actually formatting of XML tags and data, I still had to design a model along with business logic to take the database tables and map them into XML structures. F...

ViewHelper newable/injectable dilemma

I'm trying to design an application following Misko Heverys insights. It's an interesting experiment and a challenge. Currently I'm struggling with my ViewHelper implementation. The ViewHelper decouples the model from the view. In my implementation it wraps the model and provides the API for the view to use. I'm using PHP, but I hope th...

MVP (Model View Presenter) or MVC (Model View Controller)

I already know the difference between MVP and MVC. Then also after going through the SRS of an application i get in a Fix which one need to be picked, applied and followed as Applcation Architecture. As per my understanding I would pick MVP where there is the chances of using the Same Business Logic, from more than 2 GUIs. Like for a app...

UI Design: Ideas For User Look-Up / Selecting User

I'm trying to design an interface for a web-based application that allows the user to look-up people (in my case it's patients for their medical records). I'm trying to think of very fast but accurate ways to search for users by their name. I was thinking of typing the patient's name and it will match both first and last name, ordering ...