All Questions

Filter by
Sorted by
Tagged with
92
votes
19answers
14k views

Why does TDD work? [closed]

Test-driven development (TDD) is big these days. I often see it recommended as a solution for a wide range of problems here in Programmers SE and other venues. I wonder why it works. From an ...
92
votes
12answers
42k views

Why is C not considered an 'object-oriented' language?

It seems that C has its own quasi-objects such as 'structs' that can be considered as objects (in the high-level way that we would normally think). And also, C files themselves are basically separate ...
92
votes
5answers
38k 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 ...
92
votes
10answers
61k views

What is the opposite of initialize (or init)? [closed]

The term will be used as a method name. The method is called when a part of the user interface is hidden (or removed), and it is used to reset values to default and dispose objects that will not be ...
92
votes
10answers
11k views

How to motivate co-workers to write unit-tests? [closed]

We're working on a large product which has been in production for about 5 years. The codebase is.. erm.. working. Not really well but it is working. New features are thrown into production and tested ...
91
votes
17answers
27k views

Why are unit tests failing seen as bad?

In some organisations, apparently, part of the software release process is to use unit testing, but at any point in time all unit tests must pass. Eg there might be some screen which shows all unit ...
91
votes
15answers
16k views

Should we design our code from the beginning to enable unit testing?

There's a debate going on in our team at the moment as to whether modifying code design to allow unit testing is a code smell, or to what extent it can be done without being a code smell. This has ...
91
votes
15answers
48k views

What makes C so popular in the age of OOP? [closed]

I code a lot in both C and C++, but did not expect C to be the second most popular language, slightly behind Java. TIOBE Programming Community Index I'm curious as to why, in this age of OOP, C is ...
91
votes
22answers
46k 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 ...
91
votes
3answers
8k views

Is there a term for unimplemented code that was written for someone else to fill in?

Sometimes in a programming exercise, boilerplate generation, putting guide rails around the tasks for a junior programmer to implement, etc., it happens that the programmer is presented unimplemented ...
91
votes
15answers
9k views

TDD Red-Green-Refactor and if/how to test methods that become private

as far as I understand it, most people seem to agree that private methods should not be tested directly, but rather through whatever public methods call them. I can see their point, but I have some ...
91
votes
12answers
9k views

Is there a reason that tests aren't written inline with the code that they test?

I've been reading a bit about Literate Programming recently, and it got me thinking... Well-written tests, especially BDD-style specs can do a better job at explaining what code does than prose does, ...
91
votes
14answers
7k views

How can I avoid always feeling like if I completely rebuilt my program from scratch I'd do it much better? [closed]

I have learned a significant amount of coding, however, it's always been in a scientific environment (not computer science), completely self-taught without anyone to guide me in the right direction. ...
91
votes
8answers
69k views

Is modern C++ replacing C#? Is Microsoft pushing developers to adopt C++? [closed]

I hear about modern C++ popularity and some talks about migrating back to C++ from C# or other C-like languages. I know about C++11 features but I would like to hear your experiences, especially from ...
91
votes
9answers
26k views

Is it advisable to ask employees to create 'work' GitHub accounts?

I've moved all our company Git repositories to GitHub and now I want to add employees to the projects. Since most employees already have personal GitHub accounts, I'm wondering whether I should ask ...
91
votes
7answers
25k views

What functionality does dynamic typing allow? [closed]

I've been using python for a few days now and I think I understand the difference between dynamic and static typing. What I don't understand is under what circumstances it would be preferred. It is ...
91
votes
5answers
140k views

What is the advantage of choosing ASCII encoding over UTF-8?

All characters in ASCII can be encoded using UTF-8 without an increase in storage (both requires a byte of storage). UTF-8 has the added benefit of character support beyond "ASCII-characters". If ...
90
votes
12answers
18k views

What is meant by the phrase “Software can replace hardware”?

Studying beginners course on hardware/software interface and operating systems, often come up the topic of if it would be better to replace some hardware parts with software and vice-versa. I can't ...
90
votes
19answers
4k views

Dealing with management that does not see value in improvements that are not immediately visible to the user

I can understand schedule pressure. You want to please your users, as they are the lifeblood of the company. However, it is also true that certain changes will make everything easier down the road. ...
90
votes
5answers
12k 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 ...
89
votes
28answers
18k views

Why is cleverness considered harmful in programming by some people?

I've noticed a lot of questions lately relating to different abstraction techniques, and answers saying basically that the techniques in question are "too clever." I would think that part of our jobs ...
89
votes
7answers
12k views

How to reject a code review that you believe is unnecessary?

I am in a position where I have been asked to review some code that fixes a problem that I don't believe exists. The fixer, who is more senior than me, insists his fix is necessary but it appears ...
89
votes
8answers
12k views

How to modify the output of a program for which you don't have the source code

In our company we have a small program (.exe 500Kb size) that does mathematical calculation and in the end it spits out the result on a Excel spreadsheet that we use to continue our workflow. I want ...
89
votes
18answers
22k views

Reasons Programmers Leave [closed]

I am interested in finding out why programmers leave their jobs and if the reasons for leaving have resurfaced in your now job? Is the reason for leaving simply down to remuneration, location, I hate ...
89
votes
13answers
9k views

Is a large increase in velocity realistic in a Scrum environment?

My manager has recently really been pushing to use velocity as a target and measure of productivity. We are currently working at an average velocity of 50 story points. My manager wants us to increase ...
89
votes
16answers
18k views

Do the young minds need to learn the pointer concepts?

Why did the C master Dennis Ritchie introduce pointers in C? And why did the other programming languages like VB.NET or Java or C# eliminate them? I have found some points in Google, and I want to ...
89
votes
19answers
19k views

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

The other half of this question: How do programmers in the West see programmers in the East? I think it's just as interesting and important to see how programmers in the east view programmers in the ...
89
votes
26answers
86k views

What does mathematics have to do with programming? [closed]

I just started a diploma in software development. Right now we're starting out with basic Java and such (so right from the bottom you might say) - which is fine, I have no programming experience apart ...
89
votes
2answers
81k views

What's wrong with relative imports in Python?

I recently upgraded versions of pylint, a popular Python style-checker. It has gone ballistic throughout my code, pointing out places where I import modules in the same package, without specifying ...
88
votes
63answers
15k views

What features would you like to have in PHP? [closed]

Since it's the holiday season now and everybody's making wishes, I wonder - which language features you would wish PHP would have added? I am interested in some practical suggestions/wishes for the ...
88
votes
28answers
13k views

How important is graceful degradation of JavaScript?

Should web developers continue to spend effort progressively enhancing our web applications with JavaScript, ensuring that features gracefully degrade, thereby ensuring accessibility? Or should we ...
88
votes
6answers
20k views

Why are some C programs written in one huge source file?

For example, the SysInternals tool "FileMon" from the past has a kernel-mode driver whose source code is entirely in one 4,000-line file. The same for the first ever ping program ever written (~2,000 ...
88
votes
15answers
61k views

Tricky logic puzzles - Are they really useful in assessing programming skills? [closed]

In the last interview I attended, I was asked to solve a puzzle where I was expected to measure exactly blah liters of water given two buckets with capacities - blah and blah liters respectively. I ...
88
votes
5answers
93k views

Naming classes, methods, functions and variables [duplicate]

There are 3 important naming conventions: with_underscores PascalCased camelCased Other variants are not important because they are not commonly used. For variables it seems that the one with ...
88
votes
17answers
15k views

Is imposing the same code format for all developers a good idea?

We are considering to impose a single standard code format in our project (auto format with save actions in Eclipse). The reason is that currently there is a big difference in the code formats used by ...
88
votes
9answers
14k views

Over thinking development

I've been working as an app developer for a year and a half now (not long I know), and I've just been given my first big project. Needless to say it didn't go very smoothly, so I sought advice from a ...
88
votes
14answers
5k views

Hiring a programmer much more qualified & experienced than yourself? [closed]

My employer is hiring a programmer - more specifically, I am interviewing and selecting the person who will fill the position. The best candidate right now is far more qualified than I am, older, and ...
88
votes
7answers
12k views

Short circuit evaluation, is it bad practice?

Something that I've known for a while but never considered is that in most languages it is possible to give priority to operators in an if statement based on their order. I often use this as a way to ...
88
votes
17answers
6k views

How do you cope with ugly code that you wrote? [closed]

So your client asks you to write some code, so you do. He then changes the specs on you, as expected, and you diligently implement his new features like a good little lad. Except... the new features ...
88
votes
4answers
35k views

Is XHTML5 dead or is it just an synonym of HTML5?

So what happened to XHTML5? http://www.w3.org/TR/html5/ That page is a draft for both xhtml5 and html5? So there's no difference between these doctypes?
88
votes
11answers
90k views

How should I organize my source tree?

I am an individual developer working, largely, on web-projects (W/LAMP) and, at times, on C/C++ (non-GUI) projects of about average scale. I often struggle with structuring my source-code tree. In ...
88
votes
2answers
20k views

What are the London and Chicago schools of TDD?

I’ve been hearing about the London style vs. Chicago style (sometimes called Detroit style) of Test Driven Development (TDD). Workshop of Utah Extreme Programming User's Group: Interaction-style ...
87
votes
23answers
17k views

Is fewer lines of code always better? [duplicate]

Which of these programming styles is better? var result = methodOne(methodTwo(a, methodThree(b)), c, d); or var result3 = methodThree(b); var result2 = methodTwo(a, result3); var result = methodOne(...
87
votes
29answers
21k views

Can my company give IP rights away for an application I wrote off hours to another startup? [closed]

I am an intern for a health company (unpaid), let's call it Company A and I noticed that they are using a lot of paper form for things that can be done on the computer. Excel files for things that ...
87
votes
13answers
30k 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 (...
87
votes
11answers
8k views

Why should main() be short?

I've been programming for over 9 years, and according to the advice of my first programming teacher, I always keep my main() function extremely short. At first I had no idea why. I just obeyed ...
87
votes
8answers
15k views

What is “Soft Coding”, really?

In this article by Alex Papadimoulis, you can see this snippet: private void attachSupplementalDocuments() { if (stateCode == "AZ" || stateCode == "TX") { //SR008-04X/I are always required in ...
87
votes
10answers
9k views

Where is the line between unit testing application logic and distrusting language constructs?

Consider a function like this: function savePeople(dataStore, people) { people.forEach(person => dataStore.savePerson(person)); } It might be used like this: myDataStore = new Store('some ...
87
votes
9answers
23k views

Check First vs Exception Handling?

I'm working through the book "Head First Python" (it's my language to learn this year) and I got to a section where they argue about two code techniques: Checking First vs Exception handling. Here is ...
87
votes
13answers
115k views

What's the difference between syntax and semantics?

I've always thought that referring to the syntax of a language was the same as referring to the semantics of a language. But I've been informed that apparently that's not the case. What's the ...

15 30 50 per page