design

How to design this using OOP

I have an object called User, with properties like Username, Age, Password email etc. I initialize this object in my ado.net code like: private User LoadUser(SqlDataReader reader) { User user = new User(); user.ID = (int)reader["userID"]; // etc } Now say I create a new object that inherits from User, like: public...

Is it better to disable or omit context/popup menu options?

My application is context-sensisitve and I dynamically build menus for the main window / context/popup, and other places. I typically know if a given menu command will be valid given the current state of the application. Is it better practice to DISABLE/GREY the menu options which currently do not apply OR since I'm generating the menu a...

MVC How to keep a model skinny

After watching this video, I am wondering if I am using my controllers wrong. What exactly should a controller contain? For my blog, I have a post controller which has methods: create show list loadPost like dislike Whereas my post model only has a few access rules, validation rules and relation information. Are there any examples of a...

Nested Class Conundrum

For simplicity let's say I have two classes: a class called Car and a collection class called Tires. Tires is a nested class inside the Car class. I want to give my clients access to the collection - i.e. they should be able to iterate over it: foreach( var tire in car.tires ) ... and access each tire's properties. But I don't want...

C# How to split the following large complex class.

I've managed to program the following THWorkingMemory class, into a antipattern, the God Object. I planned it to be a fairly small class with around 20 methods, but now it's packed with queue handlers, timers, threads, callbacks, powershell queue callbacks, event handlers, lock handlers and about 50+ methods, i.e. the lot. The class has...

Complexity of Exceptions

I am playing around with C++ code in my spare time, working on putting together a library that could be used somewhat generically for building RPG type games. Mostly it is focusing on the underlying data structures and functions. I am still a long ways off from working with graphics. My question is this: How complicated should except...

How to plan a project...

I am about to embark on a project mostly using C# that will involve client and server communication. I'm wondering how to plan out a project like this. I usually just jump into smaller projects and figure things out as I go because I have a diagram in my head. How do I design a complex project before knowing everything it will require...

How To create a UML diagram for Source Code Files?

I have one scenario That our program output will generate two source code files as ABC.c (1 code file) ABC.h (1 header file) these two files will be added to many other external programs and exe of those programs will be created Now my issue is for drawing a deployment diagram for those source code files, how can i display this sce...

Suggested Reading for Design and Development of Software Programs?

Hi, I am looking for suggested reading for Design and Development of Software Programs, currently I am reading Code Complete and want to continue my reading as it really helps to understand different aspects of Software Engineering and industry best practices. Guidance would be highly appreciated. Thanks. ...

Associating to static data using Entity Framework

Having a bit of a mental block about how this should work: I have two tables Location and Country. Within the Location table I have a FK to the Country table PK which is CountryCode. The Country table is filled with static data and each time I add a new location I will link to the Country with the appropriate countryCode. I can do ...

Should every field in an Oracle database have a check constraint if possible?

If I know the correct format of fields, should I create check constraints for all of those fields, or will this affect the performance of inserts/updates too much? Would it be a good idea to use regular expressions for complex rules, or should I only use simple constraints like case and length? The fields are already being validated at ...

Linq to SQL Design question

Often I need to combine data from multiple tables and display the result in a GridView control. I can write a Linq query inline in the Page_load event, return an anonymous type that combines all the fields that I need, and databind the result to the GridView control. Problem: I use 'helper methods' as described by Scott Guthrie on hi...

If we could rewrite ALSA from scratch, what would it look like?

Many people agree that ALSA is probably the biggest weakness of the GNU/Linux operating system. ALSA is massive, poorly understood, and badly documented. Some design decisions that it took early on also proved to be fatal. The reason is simple: historically, soundcards didn't behave predictably (in fact, some of them included hardware mi...

Can we make this snippet groovier?

Hey, are there any improvements where i can improve this code? Maybe there are some groovy language features? This snippet flattens a xml file to: node/node/node def root = new XmlParser().parse("src/your_xml.xml") root.depthFirst().each { n -> def name = n.name() while(n?.parent()){ name = "${n?.parent()?.name()}/${name}"; n =...

How to change an object's interface based on its state?

Given a fairly complex object with lots of state, is there a pattern for exposing different functionality depending on that state? For a concrete example, imagine a Printer object. Initially, the object's interface lets you query the printer's capabilities, change settings like paper orientation, and start a print job. Once you start ...

Should I use scripting or some other means to perform complex formulas?

Background Imagine a purchasing system where people place orders. Now those orders can represent a large amount of cost to the company, so we try to calculate an estimated cost to have an idea of our expenses without having to wait for an invoice. Formulas or something else? One of these costs on the order is very complex. Each vend...

Need simple system design problems for interviews

Hi All - I am interviewing senior developer candidates and would like to have them think through a design problem as part of the interview. I would like something that involves front end, middle, and database. It should have some a data modeling challenge and more. What do you think? ...

Core Data: Design questions. Object wrappers or not?

I'm designing my first project using Core Data (for iPhone) and Im having some issues that might be related with my design approach. I'm doing an application that allows the user to create an Order (let's say for a restaurant). I'm using the graphic designer to model my persistence object (i.e. OrdeMO). I add MO to the ead of each name ...

DIY intellisense on XPath - design approach? (WinForms app)

I read the DIY Intellisense article on code project, which was referenced from the Mimic Intellisense? question here on SO. I wanna do something similar, DIY intellisense, but for XPath not C#. The design approach used there makes sense to me: maintain a tree of terms, and when the "completion character" is pressed, in the case of C...

website analysis tools

As a web developer who also designs web-forms using JS,CSS, etc. I am generally stuck with finding tools that will tell me - total size of my js being used for the page. - total size of CSS being used for the page. - total traffic to-and-fro I have come across YSlow, but that is for firefox only.Nothing that works for IE. Funny thing i...