design-principles

What is an elegant way to track the size of a set of objects without a single authoritative collection to reference?

Update: Please read this question in the context of design principles, elegance, expression of intent, and especially the "signals" sent to other programmers by design choices. I have two "views" of a set of objects. One is a dictionary/map indexing the objects by a string value. The other is a dictionary/map indexing the objects by an ...

I've heard of DRY and KISS, what other maxims do I need?

Being a self taught programmer, I base most of what I do on KISS and DRY. For me they encapsulate complex ideas well and DO help me to write better code. What else should I know? ...

Does Scala's pattern matching violate the Open/Closed Principle?

If I add a new case class, does that mean I need to search through all of the pattern matching code and find out where the new class needs to be handled? I've been learning the language recently, and as I read about some of the arguments for and against pattern matching, I've been confused about where it should be used. See the followi...

What features any good application should care about 'By-Design'

I know that the default answer is "it depends", but I want to know the feature list you are working from in developing a good application. I'm particularly interested in features that need to be cared about at design time because adding them late will cost us a lot. Please list one feature per answer so we can vote for the most importa...

Why not all form controls could be rendered via HtmlHelper?

Does anybody know why could some HTML form controls be rendered using System.Web.Mvc.HtmlHelper (hidden, checkbox, password, textbox) and some couldn't and should be explicitly written in HTML (file, submit)? What is the principle of this separation? ...

Having trouble understanding User Controls in C#

I'm new to usercontrols, having only created one so far, so bear with me. I've been reading today that usercontrols are supposed to be self-contained and not rely on any information from the parent container. I get that part, but what I'm having trouble understanding is the "right" way to design my program around that principle. I'm ma...

what are "Meta-Data design principles"?

I'm looking at a job description that I'm considering applying for, and one of the requirements listed is "Familiar with Meta-Data design principles". Can some give a brief explanation? I'm probably familiar with the concept, but I've never heard that terminology before. I did Google to find more info, but didn't get good results. Ex...

OO Software Design Principles

I am a huge fan of software design principles such as SOLID and DRY. What other principles exist for OO software design? Note. I’m not looking for answers like "comment your code" but instead looking for OO design principles like the ones discussed by Uncle Bob. ...

UI Advice: how to design a form with a lot of data

I'm re-writing an app that is a data-entry tool. The existing app is in Access and consists of a form with multiple grids, with each grid containing many columns that requires the user to scroll horizontally in order to view columns. The current grids on the form are layed-out heirarchically in parent-child relationships. Top grid repre...

Which design option is more suitable for auto-correction on construction?

Trying to decipher an appropriate OO design to implement. The basic scenario is that you have a PstnNumber which is essentially a 10 digit phone number that always starts with 0 (e.g. 0195550000). A rule has been introduced to allow auto-correcting of a number if the leading 0 is missing (e.g. 195550000). START EDIT I realised the ori...

Is having Message Box in business class wrong?

Is having reference to System.Windows.Forms in a business class and using MessageBox.Show wrong? Currently have a event processing decorator class decorating a service class. When certain events fired decorator would like to ask user if they want to proceed processing certain functionality. Is it ok for this decorator class have these...

Newest Agile Design Methods for code construction

Hallo everybody Recently I've been reading the book: "Agile software development, Principles, Patterns and Practices" by Bob Martin The following (S.O.L.I.D) agile-design-principles are listed within the book: Single Responsibility Principle Open Closed Principle Principle Liskov Substitution Principle Interface Segregation Princip...

(Programming to an interface v/s working with concrete class) when there is just one concrete class

In an OO component, when you have only one implementation available for an class and that class is not 'published' to other components, is it still advisable to have an interface and work with the interface instead? I am fully aware of 'programming to an interface' design principle and also use it extensively. Lately, I have been obs...

When to stop DRYing up the code?

So DRYing up code is supposed to be good thing right? There was a situation in one of the projects I was working on where there were certain models/entities that were more-or-less the same except the context in which they were being used. That is, Every such entity had a title, descriptions, tags, a user_id etc and some other attributes....

Should software be designed with performance in mind?

Is it advisable to zero-in on design of a component or architecture of a software with performance in mind? What I mean is, how ready should the design/architecture be to used in a performance-intensive environment? While designing components, should we just follow good OO principles and just ensure that the component is 'extendable'. T...

Cohesion and coupling within a component

How important are coupling and cohesion within a component of an application? Here, I am talking about all those classes in a component that are not published. How important is it for them to have high cohesion and low coupling? The reason I am asking is that I used an eclipse plugin to find out the design defects for a fairly simple pr...

Strategy Pattern - multiple return types/values

We are working on an image processing project using C# and EmguCV. Our team is composed of 3 people. To make faster progress, the 3 of us work on different sub-problems or experiment with different algorithms at the same time. Currently each of us creates a function that contains the major code we are working at and all of us make chang...

Liskov substitution principle - no overriding/virtual methods?

My understanding of the Liskov substitution principle is that some property of the base class that is true or some implemented behaviour of the base class, should be true for the derived class as well. I guess this would mean when a method is defined in a base class, it should never be overrided in the derived class - since then substit...

Rules Engines User Interface Design

Hi, At work, we have optimization engines, and one of the inputs used by these engines are business rules, which we create and edit with a proprietary rule editor. These rules are of our own proprietary format, because the existing rule engines were not capable of representing the business rules of the complexity we required. Anyhow, ...

Specify the supertype of a class upon instantiation/declaration?

Is it possible to specify the parent of a class when I instantiate/declare that class? For example, can I do something similar to this: MonitoredDevice<DeviceTypeToExtend> device = null; And then from that statement, the MonitoredDevice class would extend from the type parameter DeviceTypeToExtend. Now, I know that you can't use type ...