Tagged Questions

An indicator within a codebase that possibly indicates a deeper problem.

learn more… | top users | synonyms

2
votes
5answers
859 views

Is wrapping third-party API calls a design smell?

Five methods within my API call the same third-party method. In trying to abide by DRY, does it make sense to wrap this call in a private method?
8
votes
2answers
576 views

Is it a code smell if an object knows a lot of its owner?

In our Delphi 2007 application we are using a lot of the following constructs FdmBasic:=TdmBasicData(FindOwnerClass(AOwner,TdmBasicData)); The FindOwnerClass travels the Owner hierarchy of the ...
7
votes
5answers
349 views

What to do when your work colleague doesn't understand the design trying to be maintained

A software project that I am working on involves me and another programmer. The project involved an engine backend with an MVC front end. Initially I did alot of the work on the project and so setup ...
6
votes
3answers
416 views

Is having a switch to turn mocking on or off a code smell?

I have a method that looks like this: def foobar(mock=False, **kwargs): # ... snipped foobar actually makes several calls to Amazon S3 and returns a composed result. In order to make this ...
8
votes
5answers
383 views

When developing on an old code base, should I use Best Practices or go for Consistency [duplicate]

Possible Duplicate: Code maintenance: keeping a bad pattern when extending new code for being consistent, or not ? As my experience in programming increases with each project, I look back ...
53
votes
17answers
4k views

How to train yourself to avoid writing “clever” code?

Do you know that feeling when you just need to show off that new trick with Expressions or generalize three different procedures? This does not have to be on Architecture Astronaut scale and in fact ...
2
votes
2answers
247 views

Does this pattern disregard the DRY principle, and can I modify the pattern to fit?

I just started working at a company and we're currently in a fairly intensive (full-days most work days) training program to bring us up to speed on the way the company does things, and train us in ...
5
votes
6answers
309 views

How to keep a project easy to understand and intutive?

I am working on this project, which will soon contain loads of packages, projects etc. (Java). So, from the start I need to keep track of the high level package and class structure, monitor which ...
5
votes
5answers
732 views

Nested languages code smell

Many projects combine languages, for example on the web with the ubiquitous SQL + server-side language + markup du jour + JavaScript + CSS mix (often in a single function). Bash and other shell code ...
21
votes
5answers
2k views

Is code ownership a code smell?

This is something I've been thinking about ever since I read this answer in the controversial programming opinions thread: Your job is to put yourself out of work. When you're writing ...
7
votes
4answers
422 views

What “code smells” are there that are a symptom that an event listener model is required?

What are the symptoms in a code base that indicate that an event-listener approach is required? It seems to me that when there are classes that need to be called by multiple, not defined at ...
7
votes
4answers
854 views

Are iframes a design smell?

We have some pretty old, clunky .Net 1.1 apps in our business that - rather than be forcably upgraded - just get an iFrame added so that new functions can be dropped in. It's become such a well-known ...
46
votes
12answers
3k views

If your unit test code “smells” does it really matter?

Usually I just throw my unit tests together using copy and paste and all kind of other bad practices. The unit tests usually end up looking quite ugly, they're full of "code smell," but does this ...
5
votes
3answers
370 views

Is “3 or more use a for” a good rule of thumb?

When do repetitive operations become a code smell? I read this article by Charles Petzold where he suggested this and was wondering what people thought.
1
vote
6answers
2k views

Static classes and/or singletons — How many does it take to become a code smell? [closed]

In my projects I use quite a lot of static classes. These are usually classes that naturally seem to fit into a single-instance type of thing. Many times I use static classes and recently I've started ...
0
votes
2answers
130 views

Should I re-architect client's web app?

I've inherited a project that's accrued, layer upon layer, like a pearl over the last six years. It started out as a web page to let the client check the status of their work in production, and has ...
5
votes
1answer
389 views

Code smells in Android?

This question arises from seeing code where I feel like something is wrong but I can't put my finger on it while developing Android. What are some red flags in Android development that says your ...
5
votes
1answer
3k views

If you have a piece of logic that needs to be shared between two controllers where do you keep it?

I have a set of single purpose functions that I need in two separate controllers. Right now I just have duplicate code and I want to get rid of it. This code is part of the controller and doesn't ...
14
votes
6answers
582 views

Do abstractions have to reduce code readability?

A good developer I work with told me recently about some difficulty he had in implementing a feature in some code we had inherited; he said the problem was that the code was difficult to follow. From ...
16
votes
5answers
12k views

Multiple classes in a single .cs file - good or bad?

Is it advisable to create multiple classes within a .cs file or should each .cs file have an individual class? For example: public class Items { public class Animal { } public class ...
59
votes
16answers
9k views

Are #regions an antipattern or code smell?

In C# code it allows the #region/#endregion keywords to made areas of code collapsible in the editor. Whenever I am doing this though I find it is to hide large chunks of code that could probably be ...
6
votes
3answers
548 views

Why it is not recommended to have set-only property?

Today at work one of my colleague reviewed my code, and suggested me to remove set-only property and use method insted. As we both were busy with other stuffs, he told me to look at Property Design ...
27
votes
7answers
1k views

Are there architecture smells?

There are tons of resources on the web referring to and listing code smells. However, I've never seen information on architectural smells. Is this defined somewhere, and is there a list available? ...
14
votes
9answers
718 views

How can I tell if software is highly-coupled?

I am familiar with the term "highly coupled" but am curious if there are signs (code smells) that can indicate that code is highly coupled. I'm currently working with Java EE but this can apply to ...
6
votes
6answers
293 views

Is code maintenance typically a special project, or is it considered part of daily work?

Earlier, I asked to find out which tools are commonly used to monitor methods and code bases, to find out whether the methods have been getting too long. Most of the responses there suggested that, ...
2
votes
2answers
187 views

Unit testing code paths

When unit testing using expectations, you define a set of method calls and corresponding results for those calls. These define the path through the method that you want to test. I have read that unit ...
7
votes
10answers
2k views

Property-coalescing operator for C#

The null-coalescing operator in c# allows you to shorten the code if (_mywidget == null) return new Widget(); else return _mywidget; Down to: return _mywidget ?? new Widget(); I ...
18
votes
9answers
4k views

Is there any reason to use “plain old data” classes?

In legacy code I occasionally see classes that are nothing but wrappers for data. something like: class Bottle { int height; int diameter; Cap capType; getters/setters, maybe a ...
8
votes
5answers
612 views

How much redundancy/robustness should complex software implement?

The focus of this question: Some software performs "extra work" in order to increase the chance of a "eventually successful/satisfactory" outcome, despite one or more internal errors in the software, ...
3
votes
3answers
628 views

Refactoring code smells in ASP.NET Web Forms Code Behind Files: Is it risky? Is it wise? Is it a waste of time?

Given a long method with Pac-Man ifs, would it be wise to: Break down code blocks into regions. Then refactor code blocks into methods. Or would it be best to leave it alone? Would it be risky? ...
20
votes
11answers
3k views

My coworker created a 96 columns SQL table

Here we are in 2010, software engineers with 4 or 5 years or experience, still designing tables with 96 fracking columns. I told him it's gonna be a nightmare. I showed him that we have to use ...
12
votes
8answers
1k views

What was the worst piece of code you fixed that you are proud of? [closed]

I have had a few that I am proud of and some of them were written by myself few years ago. It doesn't have to be necessarily buggy, just bad code.
18
votes
16answers
542 views

Best way to relate code smells to a non technical audience?

I have been asked to present examples of code issues that were found during a code review. My audience is mostly non-technical and I want to try to express the issues in such a way that I convey the ...