design

Secondary Message Loop vs Separate Input Thread

I am talking about a Windows desktop application. I am looking to write a function such as SelectObject (for example) which blocks the caller till the user clicks on an object in the application's client area. Once the user has selected an object, the function returns a pointer to it. One way to do this is to run a small message loop an...

Why IsNan is a static method on the Double class instead of an instance property ?

The question is in the title, why : return double.IsNaN(0.6d) && double.IsNaN(x); Instead of return (0.6d).IsNaN && x.IsNaN; I ask because when implementing custom structs that have a special value with the same meaning as NaN I tend to prefer the second. Additionally the performance of the property is normally better as it avoid ...

Should unauthorized actions in the UI be hidden, disabled, or result in an error?

This is a perennial question for me that I've never really resolved so I'd like your input. If I have actions that I know a user will not be able to perform due to insufficient privileges or object state, should the UI elements for those actions be hidden from the user, visible but disabled, or visible and result in an error if attempte...

Best Practices - Design before coding.

I'm curious How do you people think ? (I mean a way of thinking) about design architecture of your Libraries, Systems, Frameworks, etc. before start coding it. I recently find my self feeling pain in what I've done, and practically every time I want to start everything from scratch.. I do design before, painting some schemes on the pap...

Protecting image media in an web application

Hi there, we are maintaing a database of image media in a large scale webapplication. The high resolution jpgs are big (> 15MB) and must not be made available for download in any way. Now we need to provide access to the details (crops) of the images to the clients (like a zoom-in function). The client should see a downskaled version of...

API Design: Expose XML or Objects #2

I recently asked this question: Expose XML or Objects - thanks all for the responses. One point to clarify. The API will always be accessed remotely (i.e. as a service), most probably via webservices or WCF. I agree that in theory a strongly typed API exposing objects as the inputs/outputs is the right way to go. However, I feel th...

Where to initialize a java Properties object?

I inherited an application which uses a java properties file to define configuration parameters such as database name. There is a class called MyAppProps that looks like this: public class MyAppProps { protected static final String PROP_FILENAME = "myapp.properties"; protected static Properties myAppProps = null; public st...

Inversion of Control in Compilers

Has anyone out there actually used inversion of control containers within compiler implementations yet? I know that by design, compilers need to be very fast, but I've always been curious about how IoC/DI could affect the construction of a programming language--hot-swappable syntaxes, anyone? ...

API design terminology, I just can't remember the word!

There's a word that's used in API design that relates to the coupling between two entities. If one entity can vary without impacting the entity they are said to be _ _ _ _ _. For example given the declaration class Point { public int X; public in Y; } members X and Y could be said to exhibit this behaviour, as a change to X...

A beginner's guide to SQL database design

Do you know a good source to learn how to design SQL solutions? Beyond the basic language syntax, I'm looking for something to help me understand: What tables to build and how to link them How to design for different scales (small client APP to a huge distributed website) How to write effective / efficient / elegant SQL queries ...

How do I indicate success and failure with colour?

I need to make a Java component that turns the background a certain colour when a process passed, and another colour when the process failed. My first thought was: green for success, red for failure. But then I read that 10% of males can't differentiate between these two colours. What would be a better combination of colours? (For the...

Scaling a rich domain model

Domain Driven Design encourages you to use a rich domain model. This means all the domain logic is located in the domain model, and that the domain model is supreme. Persistence becomes an external concern, as the domain model itself ideally knows nothing of persistence (e.g. the database). I've been using this in practice on a medium-s...

Idiomatic asynchronous design

Are there any sorts of useful idioms I can make use of when writing an API that is asynchronous? I would like to standardize on something as I seem to be using a few different styles throughout. It seems hard to make asynchronous code simple; I suppose this is because asynchronous operations are anything but. At the most basic level, th...

To Use GOTO or Not?

Hi Currently I am working on a project where goto statements are heavely used. The main purpose of goto statements is to have one cleanup section in routine rather than multiple return statements. Like below BOOL foo() { BOOL bRetVal = FALSE; int *p=NULL; p = new int; if(p==NULL) { cout<<" OOM \n"; goto Exit...

Good pattern or technique for webforms with 100s of fields

At my job, I have to implement web forms for loan applications with sometimes up to a hundred different input fields, and then save the application into the database for later retrieval. The person whom I replaced created a sql table with 100s of columns where each row represents a loan application and there is a column for every field....

Custom app using Winsock vs IIS Server design

I have a server application developed using C++ running on Windows platform. This server uses Windows sockets to communicate with clients using TCP. The socket server architecture inside the application is quite simple. The application pools 'x' number of threads during startup. Whenever a new client connects to the server, one of the th...

IE's Default CSS Values

I have a web application that I'm working on for work and its not very Firefox friendly (design was made 2 years before I started with the company). There are some CSS issues that I am having problems with and I can't use a CSS Reset because the page design is pretty much set in stone and it would cause more work then I need right now. ...

Best interface for selecting a set of many objects from another set of many objects?

Suppose you're designing a tourism site and you want to let your users compile a list of "Potential Destinations" so that you can send them hot deals for only those places. This list consists of an arbitrary number of cities picked from the universe of cities. The universe has (say) 1000 cities, and the average list will consist of (say...

Separate Class vs Method

Quick design question. ClassA has a method called DoSomething(args) In DoSomething(), before it can actually do something, it needs to do some preparatory work with args. I believe this should be encapsulated within ClassA, (as opposed to doing the prep work outside and passing it in) as nothing else needs to know that this prep work ...

Teaching systems analysis and design - how much programming experience is needed?

I teach a one semester University course in systems analysis and design. Topics include design patterns, UML, OOP, software development lifecycles, and the history, benefits and drawbacks of various methodologies (such as Agile/SCRUM/BDUF/Waterfall.) Students who enter the course should have some exposure to programming, but in reality ...