design

avoiding type switching

If you're in a team and a programmer gives you an interface with create, read, update and delete methods, how do you avoid type switching? Quoting Clean Code A Handbook of Agile Software Craftsmanship: public Money calculatePay(Employee e) throws InvalidEmployeeType { switch (e.type) { case COMMISSIONED: ...

How do you wrap and access the config files from your applications?

Well, the question speaks for itself. I use to have a static Config class in my project that lazy-load the data from the config file like this : private static string _foo; public static string Foo { get { if (string.IsNullOrEmpty(_foo)) _foo = ConfigurationManager.AppSettings["fo...

Are concept-mapping tools useful for software analysis and design?

I've become interested in abusing concept mapping (Wikipedia article, explanation by the inventor) as a technique for analyzing the design of moderately large software systems. (The systems are two compilers: One is about 25,000 lines with a 1,000-line runtime system; the other about 200,000 lines with a 90,000-line runtime system. Nei...

What is considered a fast or slow load w/ respect to a web page...

I just built a web page that is employing several different javascript elements. I am just curious as to what is considered a fast vs. a slow load time. Mine is coming out to be about 490ms w/ four different javascript pieces. Is that good, bad or average? Wondering if I need to optimize my js elements or not. ...

Is it good programming to have lots of singleton classes in a project?

I have a few classes in a project that should be created only once. What is the best way to do that?, They can be created as static object. Can be created as singleton Can be created as global. What is the best design pattern to implement this? I am thinking of creating all classes as singleton, but that would create lot of singlet...

Web interface pattern for associating two entities from data-sets without javascript

Hi All I am writing an ASP.Net MVC application. I have two entities - patients and treatments - which belong to large datasets with more than a thousand of each. The user needs to be able to easily create an association between the two - say add a treatment to a patient. I cannot use ajax or javascript. The list of treatments would ...

What do people use to make websites?

Well, I know a little HTML, and I'm just interested in playing around with it. I was wondering, though, do people usually write websites from scratch, or do they use templates, or do they use WYSIWYG editors? To me, it seems like writing from scratch is unnecessary, nowadays, with the editors and templates we have, but maybe I'd be bett...

Advice on Application Architecture

I am about to build a system that will have its own engine, as well as a front end user interface. I would like to decouple these two as much as possible. The engine should be able to accept commands and data, be able to work on this data, and return some result. The jobs for the engine may be long, and the client should have the abil...

Make a td fixed size (width,height) while rest of td's can expand.

Hi all, Do you know, how to fix the size of a td Width and Height in a table allowing the rest of td on table to expand as needed? Thanks. The problem is that when there is data inside of td's it will not shrink more than the data, but if is empty it will shrink all the way, if you expand the window the td will expand. I would like t...

Compile-time interface implementation check in C++

I'm using pseudo-interfaces in C++, that is, pure abstract classes. Suppose I have three interfaces, IFoo, IBar and IQuux. I also have a class Fred that implements all three of them: interface IFoo { void foo (void); } interface IBar { void bar (void); } interface IQuux { void quux (void); } class Fred : implements ...

Why does the client have no reference to the invoker in the Command pattern?

Link to command pattern Why does the client have no reference to the invoker when it has references to receivers and concretecommands? public static void main(String[] args) { StockTrade stock = new StockTrade(); BuyStockOrder bsc = new BuyStockOrder (stock); SellStockOrder ssc = new SellStockOrder (stock); Agent agent...

C++ checking the type of reference

Hi Is it bad design to check if an object is of a particular type by having some sort of ID data member in it? class A { private: bool isStub; public: A(bool isStubVal):isStub(isStubVal){} bool isStub(){return isStub;} }; class A1:public A { public: A1():A(false){} }; class AStub:public A { public: AStub():A(true){} }; E...

Windows standard for mnemonics

Are there any mnemonic standards for Windows? For example -- the menu bar, actions on the menu bar (e.g. Alt+f to file menu but ctrl+s to do the save under the file menu), and controls. I'm asking because we have a search screen with many controls and we're trying to decide shortcut keys to get to fields and such described above. Is t...

Sharepoint Branding

Hello everyone. I'm just tasked by my boss to create a Sharepoint solution for the scenerio below. (I'm a total newbie to Sharepoint. So please forgive me if i use the terminology wrong) The portal should open in a custom look than the default Sharepoint design and it should have links to the products. Every product page should have di...

Core Data - Storing Images (iPhone)

I have an application where I allow the user to add an image for their account. I wish to know how to store an image (obtained from the camera or photo library) using Core Data, as I may offer a backup facility for the user and would be looking to transfer the image data to a server. I have come across the design suggestion of creatin...

API design - allocate output?

Is it a good idea for C API functions to allocate their output, or to have the user specify the output buffer? For example: BOOL GetString( PWSTR *String ); ... PWSTR string; GetString(&string); Free(string); vs BOOL GetString( PWSTR Buffer, ULONG BufferSize, PULONG RequiredBufferSize ); ... // A lot more code...

Help with header image displaying twice...

http://neighborrow.com/viewProfileCSS.php?profileID=771# ...

When is it appropriate to take a direct dependency on the IoC container itself?

I'm just about to create a WorkQueueService that can handle different type of WorkItems. For each type of WorkItem, I will have an implementation of IWorkItemProcessor. I'm using IoC, so all the IWorkItemProcessor implementations will be registered in the container. My WorkQueueService will need to obtain the appropriate Processor for ea...

Library design quandary

Ok so I am writing an open source library. A section of this library deals with moving an entity in a two and three dimensional space so it will have functions that manipulate the rotation, position etc. Now ideally I would like my library to work well with other libraries, in particular things like Papervision3D and other Flash 3D engi...

Points to be considered while designing or coding for lesser footprint deliverables

Please post the points one should keep in mind while designing or coding for lesser footprint deliverables for embedded systems. I am not giving compiler or platform details, as I want generic information. But, any specific information on Linux based OS is also welcome. ...