Programming Practices are the commonly or not so commonly used practices in development of software. These can include things like Agile Development, Kanban, Coding shortcuts, etc.

learn more… | top users | synonyms

148
votes
14answers
9k views

How do you balance between “do it right” and “do it ASAP” in your daily work?

I find myself pondering over this question from time to time, again and again. I want to do things the right way: to write clean, understandable and correct code that is easy to maintain. However, ...
143
votes
16answers
11k views

Is there a benefit in compiling your code as you go along?

I recently had a job interview in which they gave me an hour to write some real code. It wasn't a huge amount, probably less than 100 lines. After about 45 minutes, I compiled, ran it, and got it to ...
121
votes
22answers
12k views

Why are shortcuts like x += y considered good practice?

I have no idea what these are actually called, but I see them all the time. The Python implementation is something like: x += 5 as a shorthand notation for x = x + 5. But why is this considered good ...
107
votes
20answers
10k views

How would you know if you've written readable and easily maintainable code?

How would one know if the code he has created is easily maintainable and readable? Of course in your point of view (the one who actually wrote the code) your code is readable and maintainable, but we ...
104
votes
18answers
8k views

Can a function be too short?

Whenever I find myself writing the same logic more than once, I usually stick it in a function so there is only one place in my application I have to maintain that logic. A side effect is that I ...
98
votes
11answers
18k views

Should we avoid object creation in Java?

I was told by a colleague that in Java object creation is the most expensive operation you could perform. So I can only conclude to create as few objects as possible. This seems somewhat to defeat ...
79
votes
12answers
6k views

How big does my project need to be for me to unit test it? [closed]

I assume that my project is decoupled enough to allow for unit testing. But how big, exactly, in terms of clases and functions does my project need to be to make unit testing worthwhile? We all make ...
77
votes
17answers
4k views

Are my negative internship experiences representative of the real world? [closed]

I'm curious if my current experiences as an intern are representative of actual industry. As background, I'm through the better part of two computing majors and a math major at a major university; ...
74
votes
22answers
39k views

Automatic programming: write code that writes code [closed]

After reading the book The Pragmatic Programmer, one of the arguments I found most interesting was "write code that writes code". I tried searching over the net for some more explanations or articles ...
73
votes
8answers
7k views

Is it okay to not completely understand code functionality? [duplicate]

As I am currently struggling with learning WCF for a project at work, for the past several days I have been looking at online tutorials and examples on the best way to make a WCF client; and today, ...
73
votes
12answers
5k views

Does programming in general become easier to read, write and understand as you gain experience?

I'm a beginner in programming and I've been reading books, studying, reading articles, and whatnot. I'm getting great results since I've started learning programming, and when I was a beginner I used ...
71
votes
9answers
8k 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 ...
70
votes
10answers
13k views

Why do most of us use 'i' as a loop counter variable?

Has anyone thought about why so many of us repeat this same pattern using the same variable names? for (int i = 0; i < foo; i++) { // ... } It seems most code I've ever looked at uses i, j, ...
66
votes
18answers
13k views

How to visualize code? [closed]

I've mostly only had to read my own code. As such, I've had no need to visualize the code as I already know how each and every class and module communicate with one another. But the few times I've ...
57
votes
11answers
6k views

Is it a bad practice to modify code strictly for testing purposes

I have a debate with a programmer colleague about whether it is a good or bad practice to modify a working piece of code only to make it testable (via unit tests for example). My opinion is that it ...
57
votes
18answers
4k views

How to tell your boss that his programming style is really bad?

I'm a student and in my spare time I'm working for a big enterprise as Java developer. The job is good, but the problem is, my boss writes very strange code. I don't want to complain, but some issues ...
56
votes
22answers
4k views

Why do some programmers think there is a contrast between theory and practice? [closed]

Comparing software engineering with civil engineering, I was surprised to observe a different way of thinking: any civil engineer knows that if you want to build a small hut in the garden you can just ...
55
votes
17answers
4k views

How to deal with tautology in comments?

Sometimes I find myself in situations when the part of code that I am writing is (or seems to be) so self-evident that its name would be basically repeated as a comment: class Example { /// ...
55
votes
9answers
4k views

Is committing/checking in code everyday a good practice?

I've been reading Martin Fowler's note on Continuous Integration and he lists as a must "Everyone Commits To the Mainline Every Day". I do not like to commit code unless the section I'm working on ...
53
votes
17answers
4k views

How to train yourself to avoid writing “clever” code?

Do you know that feeling when you just need to show off that new trick with Expressions or generalize three different procedures? This does not have to be on Architecture Astronaut scale and in fact ...
48
votes
16answers
3k views

Should I take care of race conditions which almost certainly has no chance of occuring?

Let's consider something like a GUI application where main thread is updating the UI almost instantaneously, and some other thread is polling data over the network or something that is guaranteed to ...
48
votes
5answers
25k views

Two HTML elements with same id attribute: How bad is it really?

Just browsing the google maps source code. In their header, they have 2 divs with id="search" one contains the other, and also has jstrack="1" attribute. There is a form separating them like so: ...
47
votes
11answers
7k views

What kind of problems does MapReduce solve?

I have been reading about MapReduce for a while -- but what I can't understand is how someone would make a decision to use (or not use) MapReduce. I mean, what are the problem patterns that signal ...
47
votes
2answers
16k views

Choosing between Single or multiple projects in a git repository?

In a git environment, where we have modularized most projects, we're facing the one project per repository or multiple projects per repository design issue. Let's consider a modularized project: ...
46
votes
14answers
5k views

Differences between programming in school vs programming in industry? [closed]

A lot of students when they graduate and get their first job, feel like they don't really know how to program even though they may have been good programmers in college. What are some of the ...
41
votes
10answers
2k views

Is it a good idea to schedule regular time to clean up code? [closed]

I'm managing a small team of developers. Every so often we decide we're going to spend a day or two to clean up our code. Would it be a good idea to schedule regular time, say 1 week every 2 months, ...
41
votes
12answers
4k views

Are there problems with using Reflection?

I don't know why, but I always feel like I am "cheating" when I use reflection - maybe it is because of the performance hit I know I am taking. Part of me says, if it is part of the language you are ...
39
votes
10answers
3k views

Why are exceptions considered better than explicit error testing? [duplicate]

Possible Duplicate: Defensive Programming vs Exception Handling? if/else statements or exceptions I often come across heated blog posts where the author uses the argument: "exceptions vs ...
39
votes
17answers
3k views

Best practice on if/return

I want to know what is considered better way of returning when I have if statement. Example 1: public bool MyFunction() { // Get some string for this example string myString = GetString(); ...
38
votes
12answers
5k views

Unwritten rules of rewriting another team member's code

We are practicing collective code ownership. To my understanding this means that any developer can change any line of code to add functionality, to refactor, fix bugs or improve designs. But what ...
38
votes
6answers
16k views

Method vs Function vs Procedure

Simple question, but I often hear these three terms defined with such ferocity, but which have been known to me to mean different things over the years. What are the "correct" definitions of ...
38
votes
1answer
2k views

Why do programmers use `Acme` as a package, namespace or directory name

This may or may not be a silly question, but I really would like to know the answer to something which has been bothering me for a while. I quite often see programming examples/conventions where the ...
38
votes
7answers
2k views

How can I get my progress reviewed as a solo junior developer

I am currently working for a 2 person company, as the solo primary developer. My boss gets the clients, mocks up some png design templates and hands them over to me. This system has been working fine ...
37
votes
10answers
6k views

Is writing software in the absence of requirements a skill to possess or a situation I should avoid?

I find that some software developers are very adept at this, and often times are praised for their ability to deliver a working concept with abstract requirements. Frankly, this drives me crazy, and I ...
36
votes
8answers
2k views

What is the term for a really BIG source code commit?

Sometimes when we check the commit history of a software, we may see that there are a few commits that are really BIG - they may change 10 or 20 files with hundreds of changed source code lines ...
36
votes
11answers
3k views

Is it bad habit not using interfaces? [closed]

I use interfaces rarely and find them common in others code. Also I create sub and super classes (while creating my own classes) rarely in my code. Is it a bad thing? Would you suggest changing ...
35
votes
11answers
2k views

Is it a good practice to code in English? [duplicate]

Possible Duplicate: Do people in non-English-speaking countries code in English? I have a development comming that is intended to be sold across Latin America (Spanish speakers), but I've ...
35
votes
4answers
2k views

Can too much abstraction be bad?

As programmers I feel that our goal is to provide good abstractions on the given domain model and business logic. But where should this abstraction stop? How to make the trade-off between abstraction ...
34
votes
7answers
2k views

How to convert a copy/paste/spaghetti programmer to see the light?

This question was inspired by this one. While that other question was deemed localized, I believe the underlying problem is something that is extremely common in our industry. I know there are some ...
33
votes
14answers
6k views

Is programming or computer science in general, all about algorithms?

As a grad student, I find it more and more common for prestigious companies (like Google, Facebook, Microsoft,...) to put algorithm questions in their test and interviews. A few startups I applied to ...
33
votes
12answers
12k views

Must a programmer learn text editors like Emacs and Vim? How important are they? [duplicate]

I have been writing code so far in conventional text editors that come with the OS so far or use an IDE in some cases. I know there are some advanced text editors like Emacs and Vim available solely ...
33
votes
8answers
2k views

Is Linq having a mind-numbing effect on .NET programmers?

A lot of us started seeing this phenomenon with jQuery about a year ago when people started asking how to do absolutely insane things like retrieve the query string with jQuery. The difference ...
33
votes
8answers
2k views

Is OOP becoming easier or harder?

When the concepts of Object Oriented Programming were introduced to programmers years back it looks interesting and programming was cleaner. OOP was like this Stock stock = new Stock(); ...
32
votes
15answers
3k views

Why use other number bases when programming

My coworkers and I have been bending our minds to figuring out why anyone would go out of their way to program numbers in a base other than base 10. I suggested that perhaps you could optimize longer ...
30
votes
15answers
2k views

Does heavy library and code snippet usage make you a bad programmer?

Overall I'm in programming for about 8 years now and it seems to me that I'm relying more and more on open source libraries and snippets (damn you GitHub!) to "get the job done". I know that in time I ...
30
votes
17answers
1k views

What is a good way to pick up where you left off? [closed]

My job is roughly a "9-5"ish type programming job (I'm occasionally there later when I need to finish something), and over the weekend I'm not in the office. When I get back to the office on Monday, I ...
29
votes
17answers
4k views

Am I copy/paste programmer? [duplicate]

When ever I am stuck with a particular problem, I search for a solution in Google. And then I try to understand the code and tweak it according to my requirement. For example recently I had asked a ...
29
votes
8answers
3k views

Is there such a thing as having too many private functions/methods?

I understand the importance of well documented code. But I also understand the importance of self-documenting code. The easier it is to visually read a particular function, the faster we can move on ...
28
votes
15answers
2k views

Is it wise to be going back and forth between two programming languages? [closed]

I have been writing quite a lot of PHP for nearly two years. Now I am doing .NET (mainly c#) development. However, sometimes I go back and do some php. My main question is, is it wise for me to ...
28
votes
9answers
2k views

Is it considered poor practice to include a bug number in a method name for a temporary workaround?

My coworker who is a senior guy is blocking me on a code review because he wants me to name a method 'PerformSqlClient216147Workaround' because it's a workaround for some defect ###. Now, my method ...