Questions tagged [programming-practices]

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.

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.

Common Questions Include:

1586 questions
185
votes
17 answers

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 work. I may have spent 5-10 minutes working out…
131
votes
15 answers

Are single-character constants better than literals?

I recently encountered a class which provides pretty much every single-character as a constant; everything from COMMA to BRACKET_OPEN. Wondering whether this was necessary; I read an "article" which suggests that it may be helpful to pull…
Austin Day
  • 1,361
98
votes
45 answers

What popular "best practices" are not always best, and why?

"Best practices" are everywhere in our industry. A Google search on "coding best practices" turns up nearly 1.5 million results. The idea seems to bring comfort to many; just follow the instructions, and everything will turn out fine. When I read…
Steven Evers
  • 28,180
68
votes
16 answers

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(); if (myString == null) { return false; …
sed
  • 401
55
votes
14 answers

Is it ever a good idea to hardcode values into our applications?

Is it ever a good idea to hardcode values into our applications? Or is it always the right thing to call these types of values dynamically in case they need to change?
Edward
  • 2,159
50
votes
13 answers

Do most programmers copy and paste code?

I learned very early on that cutting & pasting somebody else's code takes longer in the long run that writing it yourself. In my opinion unless you really understand it, cut & paste code will probably have issues which will be a nightmare to…
44
votes
12 answers

What techniques help retain programming knowledge?

How do you remember programming related stuff? Have you had the feeling that you've encountered the error you have before you right now, a few years ago and you could swear you knew the cause then but now you've forgotten it? Did you work with the…
Dan L.
  • 691
43
votes
14 answers

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 also asked about algorithms. I wonder if…
wakandan
  • 557
42
votes
40 answers

Stuff you should have learned in school but didn't pay attention to at the time

This question made me think that there was a better question to ask. What did you learn in school that you didn't care about at the time, but turned out to be useful or you had to relearn in the workplace because you had it in school, but didn't…
HLGEM
  • 28,759
42
votes
10 answers

Acceptable to rely on random ints being unique?

I've been implementing a network protocol, and I require packets to have unique identifiers. So far, I've just been generating random 32-bit integers, and assuming that it is astronomically unlikely that there will be a collision during the lifespan…
Phoenix
  • 758
37
votes
5 answers

Are there any major alternatives to Waterfall and Agile?

I am curious if anyone knows of any methodologies that are significantly different (not a recombination) and I would especially appreciate anyone who brought forward any experience with alternatives.
35
votes
3 answers

What is decoupling and what development areas can it apply to?

I recently noticed decoupling as a topic in a question, and want to know what it is and where it can apply. By "where can it apply", I mean: Is it only relevant where compiled languages like C and Java are involved? Should I know about / study it as…
user129679
31
votes
3 answers

What is the meaning of 'high cohesion'?

I am a student who recently joined a software development company as an intern. Back at the university, one of my professors used to say that we have to strive to achieve "Low coupling and high cohesion". I understand the meaning of low coupling.…
Max
  • 421
28
votes
8 answers

Why are so many of the numbers I see signed when they shouldn't be?

I see and work with a lot of software, written by a fairly large group of people. LOTS of times, I see integer type declarations as wrong. Two examples I see most often: creating a regular signed integer when there can be no negative numbers. The…
prelic
  • 886
  • 7
  • 15
28
votes
10 answers

What's the difference between college-level and corporate programming?

I have just completed my Bachelors degree in IT field. I have deep interest in coding and really want to be a professional in it. Now, apart from college courses, I have been learning programming(C#) on my own (college level programming is too…
vish213
  • 415
1
2 3
8 9