Most Popular

1500 questions
71
votes
7 answers

Is this an assembly language?

In my childhood I used to program on an MK-61 Soviet calculator. It had four operating registers (X, Y, Z, T) and 15 storage registers. A program could have 105 steps. As I recall it, it had commands like: Swap X and Y registers Shift registers (Z…
defhlt
  • 618
71
votes
9 answers

std::shared_ptr as a last resort?

I was just watching the "Going Native 2012" streams and I noticed the discussion about std::shared_ptr. I was a bit surprised to hear Bjarne's somewhat negative view on std::shared_ptr and his comment that it should be used as a "last resort" when…
ronag
  • 1,189
71
votes
16 answers

What is the/Is there a right way to tell management that our code sucks?

Our code is bad. It might not have always been considered bad, but it is bad and is only going downhill. I started fresh out of college less than a year ago, and many of the things in our code puzzle me beyond belief. At first I figured that as the…
sdm350
  • 493
  • 4
  • 8
71
votes
19 answers

When is a version control commit too large?

I've heard in several places "Don't make large commits" but I've never actually understood whats a "large" commit. Is it large if you work on a bunch of files even if there related? How many parts of a project should you be working on at once? To…
TheLQ
  • 13,580
70
votes
10 answers

I'm forced to write bad code. How do I save my face?

I'm only a junior developer but my job forces me to work with really terrible PHP code (think about the worst PHP code you've seen; then think about code twice as bad). I usually try to fix bugs and fight with the codebase to add new features.…
70
votes
19 answers

Why should I care about micro performance and efficency?

Many questions and answers on the C/C++ pages, specifically or indirectly discuss micro performance issues (such is the overhead of an indirect vs direct vs inline function), or using an O(N2) vs O(NlogN) algorithm on a 100 item list. I always code…
mattnz
  • 21,362
70
votes
20 answers

Using single characters for variable names in loops/exceptions

I've had a couple of discussions with a co-worker about the use of single letter variable names in certain circumstances inside our codebase, at which we both disagree. He favours more verbose naming convention for these, and I do not. There are…
Dan Atkinson
  • 243
  • 1
  • 4
  • 8
70
votes
8 answers

When to *not* use SOLID principles

Coming from a math background, counterexamples are equally, if not more, helpful to me for understanding concepts than examples. I've seen many, many examples of when and how to use the SOLID principles, but I am wondering if there are some good…
70
votes
29 answers

Are certifications worth it?

I am finishing my college degree in programming soon and I'm exploring the next steps to take to further my career. One option I've been considering is getting a certification or a series of certifications in the area of development I want to work…
HoLyVieR
  • 976
70
votes
4 answers

Does following SOLID lead to writing a framework on top of the tech stack?

I like SOLID, and I try my best to use and apply it when I'm developing. But I can't help but feel as though the SOLID approach turns your code into 'framework' code - ie code you would design if you were creating a framework or library for other…
Igneous01
  • 2,343
70
votes
7 answers

If functions have to do null checks before doing the intended behaviour is this bad design?

So I don't know if this is good or bad code design so I thought I better ask. I frequently create methods that do data processing involving classes and I often do a lot of checks in the methods to make sure I don't get null references or other…
WDUK
  • 2,082
70
votes
6 answers

Should "No Results" be an error in a RESTful response?

I'll describe an example: I start making an API for a baking shop. The API will allow people to search their catalogus for baking products, such as home-made minty chocolate chip cookies using api.examplebakery.com/search?q=...... Someone uses this…
Berry M.
  • 829
  • 1
  • 6
  • 6
70
votes
3 answers

What is a proper way to do a complex RESTful search method?

Following REST principles, I would want to create a GET method for my API that make a search using some criteria and return the results to the client. The problem is that the criteria can have up to 14 parameters, one of them is a list of complex…
anat0lius
  • 1,019
  • 2
  • 10
  • 10
70
votes
13 answers

Would it be a bad idea to periodically run code formatters on a repository?

I'm thinking of creating a cron job that checks out code, runs code formatters on it, and if anything changed, commits the changes and pushes them back. Most projects that use autoformatters put them in a git hook, but doing it automatically every…
bigblind
  • 1,415
  • 1
  • 13
  • 17
70
votes
8 answers

Naming issues: Should "ISomething" be renamed to "Something"?

Uncle Bob's chapter on names in Clean Code recommends that you avoid encodings in names, mainly regarding Hungarian notation. He also specifically mentions removing the I prefix from interfaces, but doesn't show examples of this. Let's assume the…