All Questions

Filter by
Sorted by
Tagged with
104 votes
9 answers
23k views

Is putting general-use functions in a "helpers" file an anti-pattern or code smell?

Is it an anti-pattern or code smell to put "general use" functions (examples below) into a catch-all file named "helpers" or "utils"? It's a pattern I've seen quite a lot ...
old greg's user avatar
  • 939
104 votes
9 answers
21k views

Why should I use dependency injection?

I am having a hard time looking for resources on why I should use dependency injection. Most of the resources that I see explains that it just passes an instance of an object to another instance of an ...
Daniel's user avatar
  • 1,045
104 votes
5 answers
50k views

Why doesn't Java have optimization for tail-recursion at all?

From what I have read: The reason is because it is not easy to determine which method will actually be called as we have inheritance. However, why doesn't Java at least have tail-recursion ...
InformedA's user avatar
  • 3,021
104 votes
5 answers
166k views

What does 'Nightly Builds' mean?

I have been using open source projects for a while and been developing upon the open source applications and every so often I come across the words 'Nightly Build' and I have always been curious as to ...
dbramhall's user avatar
  • 1,801
104 votes
9 answers
76k views

Should interface names begin with an "I" prefix?

I have been reading "Clean Code" by Robert Martin to hopefully, become a better programmer. While none of it so far has been really ground breaking it has made me think differently about the way I ...
Charles Sprayberry's user avatar
104 votes
11 answers
10k views

What's the name of the antipattern opposite to "reinventing the wheel"? [closed]

The "Reinvent the wheel" antipattern is a pretty common one - instead of using a ready solution, write your own from scratch. Code base grows needlessly, slightly different interfaces that do the same ...
SF.'s user avatar
  • 5,156
104 votes
7 answers
7k views

Ship of Theseus applied to GPL - Can I relicense my program if I replace all of the derivative parts?

I translated a GPLv2 C program to Python, but found it was hard to extend as designed and rewrote significant portions of it. The program is now structurally completely different, but there are ...
Landon's user avatar
  • 1,013
103 votes
13 answers
25k views

Should we eliminate local variables if we can?

For example, to keep a CPU on in Android, I can use code like this: PowerManager powerManager = (PowerManager)getSystemService(POWER_SERVICE); WakeLock wakeLock = powerManager.newWakeLock(...
ggrr's user avatar
  • 5,783
103 votes
25 answers
30k views

How do programmers quit a job? [closed]

I'm thinking about leaving my current employer and wondering how one goes about that process in the programming world. We have a lot of projects on the go at the moment and I'm the only developer. We ...
Brandon - Free Palestine's user avatar
103 votes
13 answers
74k views

What can multiple threads do that a single thread cannot? [closed]

While threads can speed up execution of code, are they actually needed? Can every piece of code be done using a single thread or is there something that exists that can only be accomplished by using ...
103 votes
6 answers
153k views

Stack and Heap memory in Java

As I understand, in Java, stack memory holds primitives and method invocations and heap memory is used to store objects. Suppose I have a class class A { int a ; String b; //...
Vinoth Kumar C M's user avatar
103 votes
2 answers
25k views

What is the "Free Monad + Interpreter" pattern?

I've seen people talking about Free Monad with Interpreter, particularly in the context of data-access. What is this pattern? When might I want to use it? How does it work, and how would I implement ...
Benjamin Hodgson's user avatar
103 votes
6 answers
154k views

What's the difference between simulation and emulation

I frequently see Simulation and Emulation in computer science. These two terms seem synonymous. Is there any difference between Simulation and Emulation?
user's user avatar
  • 2,200
103 votes
10 answers
8k views

What should I do when I've already waited too long between commits?

I was naughty... Too much "cowboy coding," not enough committing. Now, here I am with an enormous commit. Yes, I should have been committing all along, but it's too late now. What is better? Do one ...
durron597's user avatar
  • 7,610
103 votes
3 answers
104k views

What's the difference between MariaDB and MySQL?

What's the difference between MariaDB and MySQL? I'm not very familiar with both. I'm primarily a front end developer for the most part. Are they syntactically similar? Where do these two query ...
chrisjlee's user avatar
  • 2,070
103 votes
13 answers
18k views

How to deal with 'almost good' code from a junior developer? [closed]

I got a question about team managing. Right now I'm dealing with a junior developer who's working remotely from a coding factory. The guy is open to criticism and willing to learn, but I got some ...
Zalomon's user avatar
  • 1,200
103 votes
7 answers
150k views

Should we create a new single instance of HttpClient for all requests?

recently I came across this blog post from asp.net monsters which talks about issues with using HttpClientin following way: using(var client = new HttpClient()) { } As per the blog post, if we ...
Ankit Vijay's user avatar
  • 1,588
103 votes
5 answers
15k views

With all of these services, how can I not be anemic?

Where do we draw the line between delegation and encapsulation of business logic? It seems to me that the more we delegate, the more anemic we become. However, delegation also promotes reuse and the ...
SonOfPirate's user avatar
  • 2,915
102 votes
16 answers
19k views

TDD negative experience [closed]

What is a negative side of your TDD experience? Do you find baby steps (the simplest fix to make test green) annoying and useless? Do you find no-value tests (when test has sense initially but in ...
102 votes
5 answers
23k views

Clang warning flags for Objective-C development

As a C & Objective-C programmer, I'm a bit paranoid with the compiler warning flags. I usually try to find a complete list of warning flags for the compiler I use, and turn most of them on, unless ...
Macmade's user avatar
  • 1,146
102 votes
12 answers
38k views

Should I use a parser generator or should I roll my own custom lexer and parser code?

What specific advantages and disadvantages of each way to working on a programming language grammar? Why/When should I roll my own? Why/When should I use a generator?
Maniero's user avatar
  • 10.8k
102 votes
7 answers
81k views

What are invariants, how can they be used, and have you ever used it in your program?

I'm reading Coders at Work, and in it there's a lot of talk about invariants. As far as I've understood it, an invariant is a condition which holds both before and after an expression. They're, among ...
gablin's user avatar
  • 17.4k
101 votes
61 answers
19k views

What's the most absurd myth about programming issues?

To put it another way... What is the most commonly held and frustrating misunderstanding about programming, you have encountered? Which widespread and longstanding myths/misconceptions do you find ...
101 votes
60 answers
12k views

Which things instantly ring alarm bells when looking at code? [closed]

I attended a software craftsmanship event a couple of weeks ago and one of the comments made was "I'm sure we all recognize bad code when we see it" and everyone nodded sagely without further ...
101 votes
45 answers
60k views

How do programmers in the West see programmers in the East?

The other half of this question: How do Programmers in the East see programmers in the West? The eastern part of the world (India/China/Philippines ) mainly provide outsourcing services to the ...
101 votes
16 answers
55k views

How can I tell in an interview if a programmer is passionate about programming? [closed]

While most interview questions are focused on current knowledge of a candidate or check his/her skill to solve algorithmic problems I would like to hire a developer who is passionate about programming....
101 votes
10 answers
55k 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 ...
the baconing's user avatar
  • 1,121
101 votes
9 answers
26k views

Is it ever okay to use lists in a relational database?

I've been trying to design a database to go with a project concept and ran into what seems like a hotly debated issue. I've read a few articles and some Stack Overflow answers that state it's ...
linus72982's user avatar
101 votes
11 answers
18k views

How do you detect dependency problems with unit tests when you use mock objects?

You have a class X and you write some unit tests that verify behaviour X1. There's also class A which takes X as a dependency. When you write unit tests for A, you mock X. In other words, while unit ...
bvgheluwe's user avatar
  • 1,187
101 votes
22 answers
58k views

Why is OOP difficult? [closed]

When I started using an object-oriented language (Java), I pretty much just went "Cool" and started coding. I've never really thought about it until only recently after having read lots of questions ...
101 votes
14 answers
26k views

Is it bad practice to write code that relies on compiler optimizations?

I've been learning some C++, and often have to return large objects from functions that are created within the function. I know there's the pass by reference, return a pointer, and return a ...
Matt's user avatar
  • 1,043
101 votes
9 answers
23k views

Why did BASIC use line numbers?

Why did old BASICs (and maybe other languages) use line numbers as part of the source code? I mean, what problems did it (try to) solve?
DerMike's user avatar
  • 1,053
101 votes
10 answers
21k views

Should I follow a bad coding style just to follow the established conventions at my workplace?

I've been working at my job for about a year. I primarily do work in our GUI interface which uses methods from a C backend, but I generally don't have to deal with them except for return values. Our ...
Justin's user avatar
  • 913
101 votes
3 answers
132k views

Why is Python written in C and not in C++?

In Python's tutorial one can read that Python's original implementation is in C; On the other hand, the Python implementation, written in C, (...) I'm very curious why was Python written in C and ...
Piotr Dobrogost's user avatar
101 votes
7 answers
81k views

What is the history of why bytes are eight bits?

What were the historical forces at work, the tradeoffs to make, in deciding to use groups of eight bits as the fundamental unit? There were machines, once upon a time, using other word sizes. But ...
DarenW's user avatar
  • 4,433
100 votes
64 answers
17k views

What is the (craziest, stupidest, silliest) thing a client/boss asked you to do? [closed]

See title, but I am asking from a technical perspective, not Take my 40 year old virgin niece on a date or you're fired.
100 votes
17 answers
27k views

(Why) Should I learn a new programming language? [closed]

I'm quite proficient with Java, C/C++, JavaScript/jQuery and decently good at Objective-C. I'm quite productive with the languages and their corresponding frameworks too and do produce enterprise ...
100 votes
10 answers
152k views

What are the key differences between software engineers and programmers? [closed]

What are the key differences between software engineers and programmers?
grokus's user avatar
  • 7,538
100 votes
3 answers
110k views

Break on default case in switch

I am a bit puzzled on whenever or not to include break after the last case, often default. switch (type) { case 'product': // Do behavior break; default: // Do ...
Robin Castlin's user avatar
100 votes
3 answers
50k views

Why do programming languages, especially C, use curly braces and not square ones?

The definition of "C-Style language" can practically be simplified down to "uses curly braces ({})." Why do we use that particular character (and why not something more reasonable, like [], which ...
SomeKittens's user avatar
  • 4,230
100 votes
7 answers
69k views

What is the most accepted transaction strategy for microservices

One of the major issues that I have seen occur in a system with microservices is the way transactions work when they span over different services. Within our own architecture, we have been using ...
Kristof's user avatar
  • 2,241
100 votes
3 answers
40k views

What does "GPL with classpath exception" mean in practice?

Oracle seems to license all their Java-related open source code under the GPL with a classpath exception. From what I understand, this seems to allow to combine these libraries with your own code into ...
Thilo's user avatar
  • 4,786
99 votes
34 answers
66k views

"Comments are a code smell" [closed]

A coworker of mine believes that any use of in-code comments (ie, not javadoc style method or class comments) is a code smell. What do you think?
99 votes
16 answers
33k views

Why aren't user-defined operators more common? [closed]

One feature I miss in from functional languages is the idea that operators are just functions, so adding a custom operator is often as simple as adding a function. Many procedural languages allow ...
99 votes
34 answers
39k views

30 minutes to explain programming to a 15 year old [closed]

I've been volunteered to sit down and talk about the life and work of a Developer with a 15 year old work experience student next week. The catches are that I've got just half an hour, and I'll be ...
99 votes
9 answers
19k views

Is it the correct practice to keep more than 10 years old spaghetti legacy code untouched without refactoring at all in big product development?

I have been in two software product houses for three years in a row. The first is a small company maintaining a fairly small management system with a monolithic legacy code base (almost twenty years). ...
Rui's user avatar
  • 1,729
99 votes
8 answers
34k views

Client wants source code, but it contains a lot of shared code I reuse with other projects

I have a client who would like me to deliver the source code with a developed application binary. They originally said nothing about source code, but they recently said they need it. The contract is ...
robby987's user avatar
  • 1,079
99 votes
14 answers
43k views

Is it considered an anti pattern to write SQL in the source code?

Is it considered an anti pattern to hardcode SQL into an application like this: public List<int> getPersonIDs() { List<int> listPersonIDs = new List<int>(); using (...
w0051977's user avatar
  • 7,101
99 votes
9 answers
23k views

What are the advantages of build scripts?

For most of my programming career, I've used the "build/compile/run" command in whatever IDE I'm working with to produce a runnable program. This is one button, pretty easy. As I learn more about ...
WannabeCoder's user avatar
  • 2,794
99 votes
10 answers
94k views

How can I teach a bright person, with no programming experience, how to program? [closed]

I have been asked to take a person in our IT department who has no programming experience but is a smart and capable person and help him move into programming at lets say an entry level developer ...
Richard Fantozzi's user avatar

15 30 50 per page
1
9 10
11
12 13
1274