An indicator within a codebase that possibly indicates a deeper problem.
0
votes
1answer
149 views
Is there a name for CSS code smell that can be seen in class names like “float” or “white”?
I noticed some code in our projects using CSS class names such as red, black or float.
I want to provide some information for people so they know to avoid it.
Is there a common name for that code ...
2
votes
1answer
100 views
Less code or less operation
Sometimes I hesitate between "More code to avoid unnecessary operations" and "less code but with redundant operations". Let me just take an example (Win32 API):
I try to paint some controls manually ...
0
votes
2answers
208 views
Is $.proxy a code smell?
I've been writing most of my javascript applications in an OO style close to what I would use for most other languages. However, this means that most callbacks need to have a reference to an object, ...
2
votes
1answer
290 views
How can I deal with a team member who duplicates code? [duplicate]
One of our team member duplicates code. Code duplication causes confusion among my team members reading his code, it causes bugs down the line when the duplicated segment is fixed in one location and ...
5
votes
4answers
402 views
Hating your own code - for good or bad, how do you deal with it? [closed]
Have you ever had this feeling that your code is bad, the whole project is a mess, and you just want to step off? On your daily job you can explain this feeling away with your coworkers, asshole boss, ...
2
votes
1answer
89 views
What does the “4” in LCOM4 mean?
I know that methods in a class should have high cohesion which roughly translates to having all the methods use all the instance variables directly or indirectly. I know that LCOM4 (Lack of ...
2
votes
2answers
106 views
Should I check integrity in my application code or defer to the database? [duplicate]
At work we have a lot of code like this (pseudocode):
response form_submit(string username, string password) {
if ( username == ""
|| username.contains(invalid_chars)
|| password.length ...
4
votes
2answers
428 views
How do I handle having so many SQL queries?
I have an MVC3 project that uses SQL Server.
I use data from the SQL database all the time and I often find that I'm reusing/duplicating some SQL queries. I thought I'd solve this problem by creating ...
8
votes
4answers
790 views
Is this a test smell or is it even worse?
I have recently been looking at some testscripts which looks a bit like
...
try {
receiveSomething();
// something was received even though it shouldn't
failTest();
} catch (TimeoutException e) ...
5
votes
3answers
428 views
At what point/range is a code file too big?
I'm finding lots of 2-3k line files, and it doesn't really feel like they should be that big.
What is a good criteria to objectively call a source code file "too big"?, is there such thing as a ...
6
votes
5answers
457 views
Is having 'Util' classes a cause for concern? [closed]
I sometimes create 'Util' classes which primarily serve to hold methods and values that don't really seem to belong elsewhere. But every time I create one of these classes, I think "uh-oh, I'm gonna ...
23
votes
10answers
2k views
Are flag variables an absolute evil?
I remember doing a couple of projects where I totally neglected using flags and ended up with better architecture/code; however, it is a common practice in other projects I work at, and when code ...
1
vote
4answers
242 views
Is extensive documentation a code smell? [closed]
Every library, open-source project, and SDK/API I've ever come across has come packaged with a (usually large) documentation file, and this seems contradictory to the wide-spread belief that good code ...
3
votes
3answers
360 views
Is there a limit on how many global consts are used before an application is considered bad programming?
Basically, I develop websites, some large with many crud operations, etc...
However I've gotten into the habit of storing re-usable data as a constant in my PHP applications
I currently have 44 ...
8
votes
2answers
438 views
Unit Testing: “It's a code smell if you're refactoring and there are no collaborators”?
I'm reading The Art of Unit Testing by Roy Osherove. I'm at section 7.2 Writing maintainable tests where the author has this note about code smell:
NOTE: When you refactor internal state to be ...