design

How to let an average user design a boolean expression graphically

In our application there's a list of customers, and a list of keywords (among other things). Each customer can have a number of keywords, but it's not mandatory. So for instance, one customer can have the keywords "retail" and "chain", one can have only "contractor" and a third can have none at all. I want to let the user make a selecti...

Dynamically specify the type in C#

I'm creating a custom DataSet and I'm under some constrains: I want the user to specify the type of the data which they want to store. I want to reduce type-casting because I think it will be VERY expensive. I will use the data VERY frequently in my application. I don't know what type of data will be stored in the DataSet, so my init...

how to share a variable between two threads

I just inherited some code, two threads within this code need to perform a system task. One thread should do the system task before the other thread. They should not be performing the system task together. The two threads do not have references to each other. Now, I know I can use some sort of a semaphore to achieve this. But my questi...

Proper Way to Create Standards-Compliant Webpage Structure

I have been working through projects involving packages that do all the web design stuff for me for the past few years. I will admit that I have not been able to focus any on actual web design. I was wondering what the standard is these days for website layouts. Are layout-tables looked down upon now? Or are all layouts done with div ta...

Service Oriented Architecture & Domain-Driven Design

I've always developed code in a SOA type of way. This year I've been trying to do more DDD but I keep getting the feeling that I'm not getting it. At work our systems are load balanced and designed not to have state. The architecture is: Website ===Physical Layer== Main Service ==Physical Layer== Server 1/Service 2/Service 3/Servi...

OOP vs PP for algorithms

Which paradigm is better for design and analysis of algorithms? Which is faster? Because I have a subject called Design and Analysis of Algorithms in university and have a time limit for programs. Is OOP slower than Procedure programming? Or the time difference is not big? ...

Design Question on when to save

Hi, I was just after peoples opinion on when the best time to save an object (or collection of objects) is. I appreciate that it can be completely dependent on the situation that you are in but here is my situation. I have a collection of objects "MyCollection" in a grid. You can open each object "MyObject" in an editor dialogue by dou...

Self-Configuring Classes W/ Command Line Args: Pattern or Anti-Pattern?

I've got a program where a lot of classes have really complicated configuration requirements. I've adopted the pattern of decentralizing the configuration and allowing each class to take and parse the command line/configuration file arguments in its c'tor and do whatever it needs with them. (These are very coarse-grained classes that a...

abstract method signature, inheritance, and "Do" naming convention

I'm learning about design patterns and in examples of code I've seen a convention where the abstract class declares a method, for example: public abstract class ServiceBase { ... public virtual object GetSomething(); and then protected abstract object DoGetSomething(); My question is on why these two methods exist, since they app...

Should you always write code for else cases that "can never happen"?

Take some code like if (person.IsMale()) { doGuyStuff(); } else { doGirlStuff(); } (Yes, I realize this is bad OO code, it's an example) Should this be written to explicitly check if person.isFemale(), and then add a new else that throws an exception? Maybe you're checking values in an enum, or something like that. You think ...

Design Pattern for Server Emulator

I wanna build server socket emulator, but I want implement some design pattern there. I will described my case study that I have simplified like these: My Server Socket will always listen client socket. While some request message come from the client socket, the server emulator will response the client through the socket. the response...

How to redirect page

Hi i created one java application in which i tried to open my company's standard login page and i planned to redirect the link to open my own design page. Standard login page is displayed, instead of going to my own design page as usual its going to mail page. After sign out the mail page i'm gettting my own design page. But my need is,...

Partial Classes - are they bad design?

Hello, I'm wondering why the 'partial class' concept even exists in C#/VB.NET. I'm working on an application and we are reading a (actually very good) book relavant to the development platform we are implementing at work. In the book he provides a large code base /wrapper around the platform API and explains how he developed it as he te...

Why isn't the Type class in the System.Reflection namespace?

Everything about Type is reflective in nature. Is it because Type is used more often than the rest of the classes in System.Reflection? Or because it functions more like a system class than a reflection class? In short, I've always wondered what the motivation behind the location of System.Type was. ...

Where should my "filtering" logic reside with Linq-2-SQL and ASP.NET-MVC in View or Controller?

I have a main Table, with several "child" tables. TableA and TableAChild1 and TableAChild2. I have a view which shows the information in TableA, and then has two columns of all items in TableAChild1 and TableAChild2 respectivly, they are rendered with Partial views. Both child tables have a bit field for VisibleToAll, and depending on ...

What elegant solution exists for this pattern? Multi-Level Searching

Hi, Assume that we have multiple arrays of integers. You can consider each array as a level. We try to find a sequence of elements, exactly one element from each array, and proceed to the next array with the same predicate. For example, we have v1, v2, v3 as the arrays: v1 | v2 | v3 ----------------- 1 | 4 | 16 2 | 5 | 81 3 ...

Why implement DB connection pointer object as a reference counting pointer? (C++)

At our company one of the core C++ classes (Database connection pointer) is implemented as a reference counting pointer. To be clear, the objects are NOT DB connections themselves, but pointers to a DB connection object. The library is very old, and nobody who designed is around anymore. So far, nether I, nor any C++ experts in the co...

How to limit setAccessible to only "legitimate" uses?

The more I learned about the power of java.lang.reflect.AccessibleObject.setAccessible, the more astonished I am at what it can do. This is adapted from my answer to the question (Using reflection to change static final File.separatorChar for unit testing). import java.lang.reflect.*; public class EverythingIsTrue { static void setF...

Thrift,.NET,Cassandra - Is this is right combination?

I've been evaluating technology stack for developing a social network based application. Below are the stack I think could well suitable for this application type of application: GUI -- ASP.NET MVC, Flash (Flex) Business Services -- Thrift based services One of the advantage of using Thrift is to solve scaling problems that will come i...

How to secure authorization of methods

I am building a web site in C# using asp.NET MVC How can I secure that no unauthorized persons can access my methods? What I mean is that I want to make sure that only admins can create articles on my page. If I put this logic in the method actually adding this to the database, wouldn't I have business logic in my data layer? Is it a ...