Questions tagged [bad-code]
The bad-code tag has no summary.
28 questions
13votes
6answers
5kviews
Is it bad practice create "alias" variables to not use globals or arguments with long names in a method?
Is it OK to create a variable which only purpose is to increase readability? Example: public class Example { private final HowLongCanARepositoryNameReallyBeRepository ...
0votes
1answer
141views
Is a "concrete function" over "generic function" a good implementation?
I want to know others opinion about this approach that I use in a lot of projects, for example, I can show the last time that I use it: public class DataStorageService { private enum Keys { ...
10votes
4answers
3kviews
is this way of calling a function a bad practice?
I have the following code: public void moveCameraTo(Location location){ moveCameraTo(location.getLatitude(), location.getLongitude()); } public void moveCameraTo(double latitude, double ...
3votes
1answer
330views
if null is bad how we justify the "rfc" nullable for php language?
I do not understand how you think about it:https://wiki.php.net/rfc/nullable_types when It is widely confirmed, that using nulls is bad practice Where am I wrong? thanks. I'm not criticizing !. I ...
107votes
11answers
22kviews
What kind of bugs do "goto" statements lead to? Are there any historically significant examples?
I understand that save for breaking out of loops nested in loops; the goto statement is evaded and reviled as a bug prone style of programming, to never be used. Alt Text: "Neal Stephenson thinks it's ...
3votes
1answer
352views
Use a template to get alternate behaviour?
Is this a bad practice? const int sId(int const id); // true/false it doesn't matter template<bool i> const int sId(int const id) { return this->id = id; } const int MCard::sId(int ...
102votes
10answers
56kviews
Why is "Select * from table" considered bad practice
Yesterday I was discussing with a "hobby" programmer (I myself am a professional programmer). We came across some of his work, and he said he always queries all columns in his database (even on/in ...
34votes
3answers
62kviews
Is it OK to return HTML from a JSON API?
On my current project I am responsible for the implementation of a service which involves the consumption of newly created RESTful APIs, documented as solely supporting JSON. The client consistently ...
4votes
4answers
2kviews
What can I do to maintain respect for a poorly written codebase? [duplicate]
In my job I have to maintain a poorly written codebase which is both hard to understand, has tons of comments that are just plain wrong, has a bunch of weird decisionmaking going on in it and a whole ...
10votes
2answers
4kviews
Are side-effects in Array's "every", or "some" bad?
I've always been taught that having side-effects in an if condition are bad. What I mean is; if (conditionThenHandle()) { // do effectively nothing } ... as opposed to; if (condition()) { ...
7votes
4answers
591views
How do you deal with discovering bad and false code in your team? [duplicate]
Every year in january we process a big task with our system. While the performance during the task was above average the maintaince follow up is currently having a lot of trouble with jobs running too ...
209votes
4answers
102kviews
What is an Anti-Corruption layer, and how is it used?
I'm trying to figure out what the Anti-Corruption layer really means. I know that it's a way to transition/work around legacy code or bad APIs. What I don't understand is how it works and what makes ...
10votes
10answers
3kviews
What to do when a project is too difficult to continue developing?
As a developer, can you tell your project manager that an application is unworkable? Or, if you're a project manager, how would you need this presented to you in order to be compelled? This isn't ...
7votes
5answers
4kviews
How do I maintain a really poorly written code base? [duplicate]
Possible Duplicate: I’ve inherited 200K lines of spaghetti code — what now? Recently I got hired to work on existing web application because of NDA I'm not at liberty to disclose any details but ...
131votes
14answers
11kviews
Demonstrate bad code to client?
A client has asked me to do a redesign of their website, an ASP.NET Webforms application that was developed by another consultant. It seemed like a relatively straightforward job, but after looking at ...