design

Immutable struct with collection

I'm making an immutable struct in .Net which contains a read only collection of a different immutable struct (I have full control over the entire design). I don't need a non-mutating Add method. What's the best way to do that? I could make the outer struct have a reference to a ReadOnlyCollection containing the inner struct. Are ther...

What is the best book to get started with software design?

Possible Duplicates: What books do you suggest for understanding object oriented programming design deeply? What is the single most influential book every programmer should read? Best Java book you have read so far I am currently at university and am about to start a personal project, for both experience and hopefully to hel...

protocol development guidelines

We have a design like below and I would like to get opinions or protocol guidlines for the below error scenario. Layer1 --------------- | ^ ^ | (1) |(4) |(6) v | | ...

Shopping cart without breaking design

I have a fully designed website, but have now realized a need for a shopping cart. Can anyone recommend a shopping cart that lets you add elements to your pages, rather than design a template for? I don't want to lose the work/design i have/have done! APACHE/PHP, in particular, rockethost ...

Preferred way to "move" an object between lists

I have two separate lists of entities: class EntityCollection : IList<Entity> { //... } EntityCollection Foo; EntityCollection Bar; I want to implement an operation to move an object Qux that is on list Foo to Bar. What's the best way to implement it? As a MoveTo instance method on EntityCollection: public void MoveTo(EntityCo...

Python classes for simple GTD app

I'm trying to code a very rudimentary GTD app for myself, not only to get organized, but to get better at coding and get better at Python. I'm having a bit of trouble with the classes however. Here are the classes I have so far: class Project: def __init__(self, name, actions=[]): self.name = name self.actions = ...

What are some class names that would signal a need for refactoring?

I came across a few articles like this one, which suggest that some words should never be used as part of a class name. When a class has one of those words in the name, it means the code should be refactored or redesigned. Example: Manager Reason: Since almost all classes "manage" something and the meaning of "Manager" is very broad, ...

Designing a generic servlet which handles request dispatching

Hi! I have a design question :) I want to have multiple servlets but I dont want to configure a new servlet with a new name each time and extend the HttpServlet. I was thinking of having a generic servlet which dispatches different parameters to different specific classes that are actually handling the request. Ex: theese two calls w...

What would be the correct design approach?

Hi, I have following existing scenario. I have a Validator class containing validate( Command* ) function which validates the Command passed to it. class Validator { public: validate(Command* cmd) { // common validation logic } } I have three classes say WindowsExecute, SolarisExecute and AIXExecute. Member funct...

Void value as return parameter

I have this interface: public interface Command<T> { T execute(String... args); } it works fine for most uses. But when I try to model a command that have only side effects (e.g. without return value) I'm tempted to write: public class SideEffectCommand implements Command<Void> { @Override public Void execute(String... a...

To re-write or not?

This is a strategic question. I have a large piece of software, web based, that handles probably around 50 to 60 different tasks. The software uses about 100 MySQL tables, and can probably be considered as 3 big modules targeting 3 different sets of audiences. It runs very well. The software was started 5 years ago, and has gone through...

Efficiently record and store page view counts in the database?

Sites like StackOverflow count, save, and display the view counts for pages. How do you do it efficiently? Let's take view counts for StackOverflow questions as the example. I see the following options. Option 1. When the app receives a request for a question, increment the count in the question table. This is very inefficient! Th...

Composite pattern for GTD app

This is a continuation of one of my previous questions Here are my classes. #Project class class Project: def __init__(self, name, children=[]): self.name = name self.children = children #add object def add(self, object): self.children.append(object) #get list of all actions def actions(...

Coding Database web apps

This is somewhat confusing from my side to explain here.when i try learn new language i go on with some of these steps: 1) simple hello world programs, math programs, counter programs 2) interaction between pages, fetching data(RSS/Atom) from other websites using their API's. 3) storing or manipulating data(mysql/postgresql you can sa...

Where do you get pics for your designs?

And also, do you use pics found online in your projects? ...

ASP.NET page content - where does this belong?

I am working on a web application that has a single master page and several content pages. Each page will have a small sidebar to the right of the main content with some brief content. However, that brief content is specific to the page you are on. I can't decide whether to put that on each individual page, or in the master page in a ...

Same data, two different ways to store it

Hola, The two tables below can both hold the same data - a full year, including some arbitrary info about each month table1 (one row = one month) ------ id month year info table2 (one row = one year) ------ id year jan_info feb_info mar_info apr_info may_info jun_info jul_info aug_info sep_info oct_info nov_info dec_info Table A ...

Authorization System Design Question

I'm trying to come up with a good way to do authentication and authorization. Here is what I have. Comments are welcome and what I am hoping for. I have php on a mac server. I have Microsoft AD for user accounts. I am using LDAP to query the AD when the user logs in to the Intranet. My design question concerns what to do with that A...

Lookup Value - Persistant storage

Our application has 200+ screens. Each screen displays 2 to 10+ lists. List data are static information and are not subjected to change often. List types across screens are categorically similar with few specific lists. Such specific list contains more than 1000 entries. Intended dev. environment : win app. using .net 2005, ms sql ...

Where should I put the associated methods of a List<T> of datarows?

Preface: read this question. Let's say that I have all my stuff in a data structure described by Skeet. Now I want to write some methods dealing with this kind of data. This is what I have come up with: Ideally this kind of data should be in its own class. So I have decided to wrap the List of datapoints. public class MeteoDataPoint { ...