Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [bad-code]

The tag has no usage guidance.

0
votes
1answer
93 views

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 { ...
9
votes
4answers
898 views

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 ...
2
votes
1answer
119 views

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 ...
97
votes
10answers
17k views

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'...
3
votes
1answer
336 views

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 ...
94
votes
10answers
49k views

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 ...
24
votes
3answers
34k views

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 ...
4
votes
4answers
2k views

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 ...
9
votes
2answers
2k views

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()) { ...
6
votes
4answers
556 views

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 ...
144
votes
4answers
47k views

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 ...
4
votes
10answers
1k views

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 ...
7
votes
5answers
3k views

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 ...
129
votes
14answers
10k views

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 ...
23
votes
10answers
3k views

How to prove an application is built on a bad codebase?

I'm currently reviewing a system built by some developers that previously worked at my job. The system works pretty well from a user's point of view, but when delving into code review it's a utter ...
17
votes
3answers
1k views

At the end of my rope [closed]

I am a contractor to a big company. Currently, there are three developers on the project, myself included. The problem is the other 2 developers don't really get it. By "it" i mean the following: ...
25
votes
8answers
1k views

Is it better to use pre-existing bad practices, or good practices that don't fit well with old code?

I was thinking of this because I was trying to write an extension for an existing 3rd party software, and their database is horribly denormalized. I needed to use their existing tables and add a bunch ...
21
votes
7answers
854 views

What can you do about the quality of existing integration and unit tests while being the new guy in a team ?

A recurring theme that I came across in my career is being the new developer to arrive in a team, and quickly having an inherent distrust of the existing unit and integration test suites. During the ...
16
votes
7answers
1k views

If a fluent coder disregards good practices, doesn't his fluency work against him? [closed]

I am working on a fairly large and buggy application - and due to the way it's written (I'll spare you details, but it violates rules in most areas you can think of), it is next to impossible ...
4
votes
4answers
606 views

Refactoring Bittersweet PHP: How can I make this less painful?

I've just been assigned a large project. The client has had multiple developers across different companies working on their (intended to be) large, MySQL driven eCommerce site. The DB schema is ......
28
votes
12answers
15k views

What design patterns are the worst or most narrowly defined? [closed]

For every programming project, managers with past programming experience try to shine when they recommend some design patterns for your project. I like design patterns when they make sense or if you ...
34
votes
13answers
28k views

Worst practices in C++, common mistakes [closed]

After reading this famous rant by Linus Torvalds, I wondered what actually are all the pitfalls for programmers in C++. I'm explicitly not referring to typos or bad program flow as treated in this ...
7
votes
7answers
7k views

What to watch out for when writing code at an Interview? [closed]

I have read that at a lot of companies you have to write code at an interview. On the one hand I see that it makes sense to ask for a work sample. On the other hand: What kind of code do you expect to ...
13
votes
0answers
639 views

How do you dive into a big ball of mud? [duplicate]

Possible Duplicate: How do you dive into large code bases? So there is a question about understanding code. Mine is a similar problem. It started when I joined my current org. and like I always ...
15
votes
11answers
481 views

Should you fix preexisting defects while working on something else?

Conundrum: During the course of working on a new feature or fixing a defect, you find a legacy problem in code. What should you do? Fix it and risk altering the behavior of the code. It has either ...
14
votes
8answers
2k views

Do you write bad code when under pressure? [closed]

When you are under pressure, the deadline is approaching, and a manager is breathing down your neck do you find yourself starting to write bad code? Do TDD and best practices slip by the wayside in ...
21
votes
6answers
2k views

How do you deal with intentionally bad code?

There are many stories about intentionally bad code, not only on TheDailyWTF but also on SO. Typical cases include: Having a useless time-wasting construct (e.g. an empty loop counting to some huge ...