Questions about problem solving and planning for a solution through software design.

learn more… | top users | synonyms (1)

197
votes
16answers
14k views

Started wrong with a project. Should I start over?

I'm a beginner web developer (one year of experience). A couple of weeks after graduating, I got offered a job to build a web application for a company whose owner is not much of a tech guy. He ...
164
votes
18answers
62k views

How can one manage thousands of IF…THEN…ELSE rules?

I am considering building an application, which, at its core, would consist of thousands of if...then...else statements. The purpose of the application is to be able to predict how cows move around in ...
135
votes
20answers
10k views

How do quick & dirty programmers know they got it right?

If you ask programmers why they should write clean code, the number one answer you get is maintainability. While that's on my list, my main reason is more immediate and less altruistic: I can't tell ...
87
votes
11answers
11k views

The modern way to perform error handling…

I've been pondering this problem for a while now and find myself continually finding caveats and contradictions, so I'm hoping someone can produce a conclusion to the following: Favour exceptions ...
86
votes
17answers
23k views

Is it a good idea to design an architecture thinking that the User Interface classes can be replaced by a command line interface?

In Code Complete page 25, it's said that it's a good idea to be able to easily replace the regular user interface classes by a command line one. Knowing its advantages for testing, what about the ...
83
votes
21answers
7k views

Is OOP hard because it is not natural?

One can often hear that OOP naturally corresponds to the way people think about the world. But I would strongly disagree with this statement: We (or at least I) conceptualize the world in terms of ...
78
votes
18answers
4k views

Design flaws and dealing with humiliation from it [closed]

Have you always been fundamentally correct in the software designs you proposed? When you give out some design that was fundamentally wrong, you tend to lose the respect of your fellow team members. ...
76
votes
11answers
5k views

Why should main() be short?

I've been programming for over 9 years, and according to the advice of my first programming teacher, I always keep my main() function extremely short. At first I had no idea why. I just obeyed ...
75
votes
16answers
14k views

Is premature optimization really the root of all evil?

A colleague of mine today committed a class called ThreadLocalFormat, which basically moved instances of Java Format classes into a thread local, since they are not thread safe and "relatively ...
75
votes
16answers
4k views

Should we design programs to randomly kill themselves? [closed]

In a nutshell, should we design death into our programs, processes, and threads at a low level, for the good of the overall system? Failures happen. Processes die. We plan for disaster and ...
73
votes
7answers
6k views

Is this a violation of the Liskov Substitution Principle?

Say we have a list of Task entities, and a ProjectTask sub type. Tasks can be closed at any time, except ProjectTasks which cannot be closed once they have a status of Started. The UI should ensure ...
69
votes
7answers
9k views

Should I follow the normal path or fail early?

From the Code Complete book comes the following quote: "Put the normal case after the if rather than after the else" Which means that exceptions/deviations from the standard path should be put ...
68
votes
11answers
5k views

Advice on designing web application with a 40+ year lifetime

Scenario Currently, I am apart of a health care project whose main requirement is to capture data with unknown attributes using user generated forms by health care providers. The second requirement ...
66
votes
16answers
15k views

Is it wrong to use a boolean parameter to determine behavior?

I have seen a practice from time to time that "feels" wrong, but I can't quite articulate what is wrong about it. Or maybe it's just my prejudice. Here goes: A developer defines a method with a ...
63
votes
16answers
11k views

Do I really need oop for my kind of job? After 10 years I think I don't [closed]

After 10 years of writing something like business logic for my company I realized that for 95% of my code I just don't need any special OO techniques. For years I tried to get better with all that OO ...
62
votes
10answers
7k views

Are design patterns really essential nowadays?

I was reading "Coders at Work" and have faced the fact that some of the professionals interviewed in the book are not so enthusiastic about design patterns. I think that there are 2 main reasons for ...
59
votes
6answers
6k views

How to manage accidental complexity in software projects

When Murray Gell-Mann was asked how Richard Feynman managed to solve so many hard problems Gell-Mann responded that Feynman had an algorithm: Write down the problem. Think real hard. Write down the ...
58
votes
11answers
5k views

“Everything is a Map”, am I doing this right?

I watched Stuart Sierra's talk "Thinking In Data" and took one of the ideas from it as a design principle in this game I'm making. The difference is he's working in Clojure and I'm working in ...
57
votes
5answers
32k views

When do you use a struct instead of a class?

What are your rules of thumb for when to use structs vs. classes? I'm thinking of the C# definition of those terms but if your language has similar concepts I'd like to hear your opinion as well. I ...
55
votes
12answers
14k views

What is the ideal length of a method? [closed]

In object-oriented programming, there is no exact rule on the maximum length of a method , but I still found these two qutes somewhat contradicting each other, so I would like to hear what you think. ...
55
votes
5answers
3k views

Why were Java collections implemented with “optional methods” in the interface?

During my first implementation extending the Java collection framework, I was quite surprised to see that the collection interface contains methods declared as optional. The implementer is expected ...
53
votes
10answers
3k views

My proposed design is usually worse than my colleague's - how do I get better? [closed]

I have been programming for couple of years and am generally good when it comes to fixing problems and creating small-to-medium scripts, however, I'm generally not good at designing large scale ...
52
votes
10answers
3k views

What is meant by, “A user shouldn't decide whether it is an Admin or not. The Privileges or Security system should.”

The example used in the question pass bare minimum data to a function touches on the best way to determine whether the user is an administrator or not. One common answer was: user.isAdmin() This ...
52
votes
15answers
2k views

Is it normal to think about a design problem for days with no code written? [closed]

Sometimes I stare blankly into space or sketch ideas and write some pseudo codes on paper. Then I scratch it out and start again, then when I think I have the correct solution for the problem I begin ...
52
votes
12answers
3k views

Getting out of my head

I've spent the last year as a one-man team developing a rich-client application (35,000+ LoC, for what it's worth). It's currently stable and in production. However, I know that my skills were rusty ...
49
votes
9answers
36k views

Why use partial classes?

In my understanding, the partial keyword does nothing but allow a class to be split between several source files. Is there any reason to do this other than for code organization? I've seen it used for ...
49
votes
12answers
4k views

Is it bad practice to pass instances through several layers?

In my program design, I often come to the point where I have to pass object instances through several classes. For example, if I have a controller that loads an audio file, and then passes it to a ...
48
votes
4answers
10k views

What is inversion of control, and when should I use it?

I am designing a new system and I want to know what inversion of control (IOC) is, and more importantly, when to use it. Does it have to be implemented with interfaces or can be done with classes?
46
votes
19answers
7k views

Servicing background tasks on a large site

We're dealing with an interesting problem on StackOverflow. We've got a whole bunch of little "needs to be done soon-ish" tasks. An example is updating "Related Questions" lists. What we've done in ...
43
votes
11answers
43k views

SQL: empty string vs NULL value

I know this subject is a bit controversial and there are a lot of various articles/opinions floating around the internet. Unfortunatelly, most of them assume the person doesn't know what the ...
42
votes
12answers
4k views

Are there problems with using Reflection?

I don't know why, but I always feel like I am "cheating" when I use reflection - maybe it is because of the performance hit I know I am taking. Part of me says, if it is part of the language you are ...
42
votes
7answers
29k views

When to use abstract classes instead of interfaces with extension methods in C#?

"Abstract class" and "interface" are similar concepts, with interface being the more abstract of the two. One differentiating factor is that abstract classes provide method implementations for derived ...
41
votes
12answers
3k views

Develop fast and buggy, then correct errors or be slow, careful for each line of code? [duplicate]

Possible Duplicates: Frankly, do you prefer Cowboy coding? Prototyping vs. Clean Code at the early stages Good design: How much hackyness is acceptable? Does craftsmanship pay off? ...
41
votes
6answers
3k views

How safe are hidden AJAX requests that fake performance?

What is a hidden AJAX request? I've noticed an increase in the usage of hidden AJAX requests designed to make a user's action appear to happen immediately. I'll refer to this type of AJAX request as ...
38
votes
7answers
3k views

Can a system be 100% Data Driven?

My new boss has been working on this project for many years. I've only been here a few weeks, but I am not sure it's possible. He would like to design a system that is "100% data driven". So if we ...
38
votes
7answers
3k views

How do I stop designing and start architecting this project as suggested by my lead? [closed]

I'm a junior developer (~3 years' exp.) and at my job we're in the process of architecting a new system. My lead developer will be the principal architect, however he's challenged me to try ...
37
votes
9answers
4k views

Do we need Logging when doing TDD?

When doing the Red, Green & Refactor cycle we should always write the minimum code to pass the test. This is the way I have been taught about TDD and the way almost all books describe the process. ...
37
votes
12answers
2k views

Documentation in OOP should avoid specifying whether or not a “getter” performs any computation?

My school's CS program avoids any mention of object oriented programming, so I've been doing some reading on my own to supplement it -- specifically, Object Oriented Software Construction by Bertrand ...
37
votes
9answers
4k views

Code Smell: Inheritance Abuse [duplicate]

It's been generally accepted in the OO community that one should "favor composition over inheritance". On the other hand, inheritance does provide both polymorphism and a straightforward, terse way of ...
36
votes
19answers
4k views

Overused or abused programming techniques [closed]

Are there any techniques in programming that you find to be overused (I.E. used way more excessively than what they should be) or abused, or used a bit for everything, while not being a really good ...
36
votes
5answers
1k views

What's the right way to work with a graphic designer?

Recently, we worked with a graphic designer (arranged by the client) to provide the skin for a Django+Bootstrap application we had built. The designer provided a series of static images of the new ...
35
votes
14answers
12k views

Isn't MVC anti OOP?

The main idea behind OOP is to unify data and behavior in a single entity - the object. In procedural programming there is data and separately algorithms modifying the data. In the ...
35
votes
10answers
2k views

Clarify the Single Responsibility Principle

The Single Responsibility Principle states that a class should do one and only one thing. Some cases are pretty clear cut. Others, though, are difficult because what looks like "one thing" when ...
34
votes
7answers
2k views

What makes a piece of software an Engine? [closed]

The descriptor 'Engine' gets thrown around a lot: graphics engine, RegEx engine, AI engine, etc. but what actually makes a piece of software an Engine? Design, Input/Output, Purpose, Size?
33
votes
16answers
4k views

Should I continue my self-taught coding practice or learn how to do coding professionally? [closed]

Lately I've been getting professional work, hanging out with other programmers, and making friends in the industry. The only thing is I'm 100% self-taught. It's caused my style to extremely deviate ...
31
votes
18answers
2k views

Should a developer argue against unnecessary or harmful features?

What is a good attitude from developers when discussing new features, and namely, non critical/questionable features? Say you are developing some sort of Java like language, and the boss says: "We ...
31
votes
6answers
6k views

Should I use Dependency Injection or static factories?

When designing a system I am often faced with the problem of having a bunch of modules (logging, database acces, etc) being used by the other modules. The question is, how do I go about providing ...
30
votes
15answers
2k views

What can programmers learn from the construction industry? [closed]

When talking with colleagues about software design and development principles, I've noticed one of the most common sources for analogies is the construction industry. We build software and we ...
30
votes
7answers
2k views

What if I have no good ideas to implement a feature? [closed]

I'm working on my own application and I'm stuck. I have to implement a feature but I can't find a good approach to implement this feature. I was thinking about it for a couple of days, and no good ...
30
votes
10answers
10k views

Is catching general exceptions really a bad thing?

I typically agree with most code analysis warnings, and I try to adhere to them. However, I'm having a harder time with this one: CA1031: Do not catch general exception types I understand the ...