Most Popular

1500 questions
62
votes
4 answers

What is language-agnosticism and why is it called that?

When is something language agnostic? Why is it called that?
Louis Rhys
  • 6,122
62
votes
10 answers

Is it premature optimization to add database indices?

A colleague of mine today suggested that we go through all of the queries in our application and to add indices accordingly. I feel this is premature optimisation because our application is not even released yet. I suggested to monitor for slow…
62
votes
4 answers

Appropriate Git workflow for multiple active releases while handling hotfixes

I'm trying to choose a Git workflow that is most appropriate for our product. Here are the parameters: We do a few major releases a year, let's say 10 at the most We have multiple versions of our product active at the same time (some people are on…
Rocket04
  • 1,076
62
votes
8 answers

Securing sensitive data from developers

I have an enterprise application running that uses both MySQL and MongoDB datastores. My development team all have SSH access to the machine in order to perform application releases, maintenance, etc. I recently raised a risk in the business when…
Clinton Bosch
  • 754
  • 1
  • 6
  • 9
62
votes
12 answers

Is there any logical reason to auto-generate code documentation?

Automatic documentation generation can be done with a variety of tools, GhostDoc being one of the more prominent. However, by definition, everything it generates is redundant. It takes a look at names of methods, classes, etc. and outputs English…
Jez
  • 1,318
62
votes
6 answers

Why is CPU cache memory so fast?

What makes CPU cache memory so much faster than main memory? I can see some benefit in a tiered cache system. It makes sense that a smaller cache is faster to search. But there must be more to it.
62
votes
1 answer

Are go-langs goroutine pools just green threads?

The commentator here offers the following criticism of green threads: I was initially sold on the N:M model as a means of having event driven programming without the callback hell. You can write code that looks like pain old procedural code but…
hawkeye
  • 4,819
62
votes
1 answer

Treating a 1D data structure as 2D grid

I am working with a native class that represents a 2D image as a 1D array. If you want to change one pixel, for example, you need to now how to derive the index from the x,y coordinates. So, let's say we have a 1D array array1d like this: array1d =…
62
votes
9 answers

How to write "good" unit tests?

Triggered by this thread, I (again) am thinking about finally using unit tests in my projects. A few posters there say something like "Tests are cool, if they are good tests". My question now: What are "good" tests? In my applications, the main part…
Jens
  • 729
62
votes
3 answers

Best Practices To Create Error Codes Pattern For an Enterprise Project

I'm working on an enterprise project which will be deployed in many SMBs and Enterprises. The support for this project would be struggling and so I want to create a coding pattern for errors (Like HTTP status Codes). This will enable help desk…
Pooya
  • 847
62
votes
8 answers

MVC Architecture -- How many Controllers do I need?

I have been coding for a while, but mostly scripts and simple applications. I've moved into a new role where it is all about developing Web Apps and using a proper MVC architecture, so I am desperately trying to learn about all that very quickly. I…
Jeff
  • 1,854
62
votes
14 answers

RESTful API design. What should I return if there are no rows?

I'm currently coding an API for a social network with the Slim Framework. My question is: What are the best practices when there are no rows to return in the json structure? Lets say that this call /v1/get/movies returns 2 rows from the table movie…
Andres SK
  • 723
62
votes
6 answers

When to use weak references in .Net?

I have not personally come across a situation where I've needed to use WeakReference type in .Net, but the popular belief seems to be that it should be used in caches. Dr Jon Harrop gave a very good case against the use of WeakReferences in caches…
62
votes
8 answers

LSP vs OCP / Liskov Substitution VS Open Close

I am trying to understand the SOLID principles of OOP and I've come to the conclusion that LSP and OCP have some similarities (if not to say more). the open/closed principle states "software entities (classes, modules, functions, etc.) should be…
Kolyunya
  • 965
62
votes
12 answers

Is it bad practice to pass instances through several layers?

In my program design, I often come to the point where I have to pass object instances through several classes. For example, if I have a controller that loads an audio file, and then passes it to a player, and the player passes it to the…
Puckl
  • 1,555