design

Using SOA principles over OOD in non-service code

Our architect has spoken about using SOA techniques throughout our codebase, even on interfaces that are not actually hosted as a service. One of his requests is that we design our interface methods so that we make no assumptions about the actual implementation. So if we have a method that takes in an object and needs to update a propert...

Is an "infinite" iterator bad design?

Is it generally considered bad practice to provide Iterator implementations that are "infinite"; i.e. where calls to hasNext() always(*) return true? Typically I'd say "yes" because the calling code could behave erratically, but in the below implementation hasNext() will return true unless the caller removes all elements from the List t...

Design help for service and repository layers

I've been running into some problems with my design. Here is what I have now... Controller ... <AcceptVerbs(HttpVerbs.Post)> _ Public Function Edit(ByVal id As Integer, ByVal dryShots As Integer, ByVal clock As Integer) As ActionResult Dim job As Shift_Summary_Job = _shiftSummaryJobService.GetShiftSummaryJob(id) _shiftSummaryJ...

Design question: Holding class metadata for dynamic lookup.

I have a couple of base/interface classes each of which has several derived classes. I have a need to store metadata on each derived class that has a lot of overlap, but different values. I also have a Factory class for creating instances of the derived classes that's implemented as a singleton and has a few macros. For example, you'd: ...

What programming shortcuts do you end up regretting or backing out?

I saw this question and it reminded me of AutoGenerateColumns in the old DataGrid. The few times I've used them, I ended up backing it out because I needed data formatting past the standard "spit out the Data Source columns." Likewise, with toggle, it sounds like it would save time, but then you end up needing to keep track of state or s...

How to store a numeric value which can have other statuses in a database?

I need to store a set of numbers in a database which are imported from a spreadsheet. Sometimes a number is just a number. But in other times, a value can be "missing", "N/A", or blank and these all represent different things. What would be a good approach to store these numbers in the database? Originally I only had to account for N...

Exploring the Factory Design Pattern

There was an article here: http://msdn.microsoft.com/en-us/library/Ee817667%28pandp.10%29.aspx The first part of tut implemented this pattern with abstract classes. The second part shows an example with Interface class. But nothing in this article discusses why this pattern would rather use abstract or interface. So what explanation (a...

Pattern for UI configuration

I have a Win32 C++ program that validates user input and updates the UI with status information and options. Currently it is written like this: void ShowError() { SetIcon(kError); SetMessageString("There was an error"); HideButton(kButton1); HideButton(kButton2); ShowButton(kButton3); } void ShowSuccess() { Set...

How to use a DHT for a social trading environment

I'm trying to understand if a DHT can be used to solve a problem I'm working on: I have a trading environment where professional option traders can get an increase in their risk limit by requesting that fellow traders lend them some of their risk limit. The lending trader can either search for traders with certain risk parameters which ...

Inset selection in gimp? Reverse drop-shadow?

I'm wondering how to achieve this effect that Apple uses. It looks as though the button is depressed into the bar, can't figure out how to do the same effect for my graphics. Thanks! ...

Avoid Guests accessing files without .htaccess.

We have some applications up and running. We have implemented an Access Control List (ACL) in order to control, which users can do what (guests included). And here is the trouble: Whenever we disallow a guest to see something, the usual procedure for our software is to set a .htaccess and copy users/passwords from the ACL to the .htacce...

Adding a Flash MovieClip to different parents, should have error?

On a project I spent an hour trying to fix a bug with MovieClips not appearing. The cause was that I was adding one MovieClip first to one parent and then to another. Flash allows this, but since display objects can only have on parent, it silently removes the MovieClip from the first parent. Not getting any error information, I didn't ...

Measuring time spent in application / thread

I am writing a simulation in Java whereby objects act under Newtonian physics. An object may have a force applied to it and the resulting velocity causes it to move across the screen. The nature of the simulation means that objects move in discrete steps depending on the time ellapsed between the current and previous iteration of the a...

Using non primitive types in ServiceOperation for WCF Data Service (3.5SP1)

Is there any way at all to create a "mock" entity type for use in a WCF Service Operation? We have some queries we do that we need to optimize by exposing as a ServiceOperation. The problem is in order to do so we would result in a very long list of primitative types... Ex SomeoneHelpMe(int time, string name, string address, string...

WebForms Text Input => Doubles & Strings & Booleans

Is there a better way to do "input forms" in WebForms? I always end up with code like this: Double d = 0; // chuckle inside if(Double.TryParse(myNumberTextField.Text, out d)) { myObject.DoubleVal = d; } Is there a better way to process free-form "numeric" input. ...

What strategies are efficient to handle concurrent reads on heterogeneous multi-core architectures?

I am tackling the challenge of using both the capabilities of a 8 core machine and a high-end GPU (Tesla 10). I have one big input file, one thread for each core, and one for the the GPU handling. The Gpu thread, to be efficient, needs a big number of lines from the input, while the Cpu thread needs only one line to proceed (storing mul...

Database design suggestions for a configurable product eshop

Hello, I am biulding an e-shop that will have configurable products. The configurable parts will need to have different prices and stocks from the main product. What database design would be best in this case? I started with something like this. Features id name Features Options id id_feature value Products id name price P...

Have problems designing input and output for a calculator app

Hello! I am writing a button calculator. I have the code split into model, view and a controller. The model knows nothing about formatting, it is only concerned with numbers. All formatting is done in the view. The model gets its input as keypresses, each keypress is a part of an enum: typedef enum { kButtonUnknown = 0, ...

C++ Object Design issue: efficiently and safely construct objects and save/load with database

my English is not good enough to explain my problem. But I will try my best. I used to be a Java programmer but have been using C++ more than a year. The one thing always bothers me is the strategy of creating business objects from network(like through SNMP, Web Service or other data sources...) and save it to database and load it when...

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...