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

30
votes
5answers
2k views

Test driven development - convince me! [closed]

I know some people are massive proponents of test driven development. I have used unit tests in the past, but only to test operations that can be tested easily or which I believe will quite possibly ...
30
votes
8answers
25k views

Private variable vs property?

When setting a value to a variable inside of a class most of the time we are presented with two options: private string myValue; public string MyValue { get { return myValue; } set { myValue = ...
30
votes
3answers
6k views

What are combinators and how are they applied to programming projects? (practical explanation)

What are combinators? I'm looking for: a practical explanation examples of how they are used examples of how combinators improve the quality/generality of code I'm not looking for: explanations ...
29
votes
29answers
5k views

Does over-reliance on tools imply that you are lazy? [closed]

I started programming in C++ at uni and loved it. In the next term we changed to VB6 and I hated it. I could not tell what was going on, you drag a button to a form and the ide writes the code for ...
29
votes
15answers
6k views

How can I automate production deployments without experiencing extreme anxiety?

At our shop we use SVN for source control and CruiseControl for CI on handling automatic builds and deployments to our development, test, and integration environments. This all works smoothly however ...
29
votes
8answers
4k views

Writing robust code vs. overengineering

How do you guys know that you are writing the most robust code possible without overengineering? I find myself thinking too much about every possible path that my code can take, and it feels like a ...
28
votes
15answers
3k 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
3k views

Future proofing code

Where I work developers are always telling me that "I added this just in case for the future" or "I think it's a good idea to do this because they'll probably want it some day". I think it's great ...
28
votes
12answers
3k views

Why should a class be anything other than “abstract” or “final/sealed”?

After 10+ years of java/c# programming, I find myself creating either: abstract classes: contract not meant to be instantiated as-is. final/sealed classes: implementation not meant to serve as base ...
28
votes
7answers
13k views

What's wrong with being a code monkey? (Or, what is a code monkey?) [closed]

Programmers tend to talk about being a "code monkey" in a derogatory way. "Don't work there, you will just be a code monkey!". I have two offers for jobs, one at a small company, one at a very large ...
28
votes
4answers
2k views

How to efficiently troubleshoot or test new code when hardware setup to reproduce bugs is difficult or impossible to obtain?

I work at a mid-sized company (150ish employees, ~10 size engineering team), and most of my projects involve interfacing with lab equipment (oscilloscopes, optical spectrum analyzers, etc) for the ...
28
votes
7answers
1k views

Is it okay to use exceptions as tools to “catch” errors early?

I use exceptions to catch problems early. For example: public int getAverageAge(Person p1, Person p2){ if(p1 == null || p2 == null) throw new IllegalArgumentException("One or more of ...
28
votes
3answers
25k views

Which is a better practice - helper methods as instance or static?

This question is subjective but I was just curious how most programmers approach this. The sample below is in pseudo-C# but this should apply to Java, C++, and other OOP languages as well. Anyway, ...
27
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 ...
27
votes
13answers
11k views

If XML is so bad…why do so many people use it? [closed]

I understand the purpose of XML, but I always hear people complain about how BAD it is? I don't really understand whats so bad about it? I usually hear the terms "bloated" and "slow" tossed around. ...
27
votes
10answers
3k views

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

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#) ...
27
votes
7answers
3k views

How to convince my teammates to follow some basic rules

I have a problem with my teammates. Long story short: We are three students working at a project for a competition. The project consists of 2 separate applications: one for Windows (that I develop) ...
27
votes
6answers
4k views

Progressive Enhancement vs. Single Page Apps

I just got back from a conference in Boston called An Event Apart. A really popular theme amongst the speakers was the idea of progressive enhancement - a site's content should go in the HTML, and ...
26
votes
16answers
3k views

How often do experienced programmers have trouble getting their code to perform its intended purpose?

I'm kind of inexperienced with programming (ie less than a year) and I have recently been getting discouraged, mostly from not being able to solve problems with my own code (Not forgetting parentheses ...
26
votes
9answers
3k views

Simple vs Complex (but performance efficient) solution - which one to choose and when?

I have been programming for a couple of years and have often found myself at a dilemma. There are two solutions - one is simple one i.e. simple approach, easier to understand and maintain. It ...
26
votes
3answers
2k views

Is it considered a bad practice to add logic in a property setter?

I jumped in to a project and I see that the other developers are adding a lot of logic in the setters of synthesized properties. I understand how this works, but I think that it makes it hard to ...
26
votes
9answers
9k views

Alternatives to the singleton pattern

I have read different opinions about the singleton pattern. Some maintain that it should be avoided at all costs and others that it can be be useful in certain situations. One situation in which I ...
25
votes
12answers
2k views

Industry has no place for passionate programmers? [closed]

I've been interning at a place where my manager believes that if you are in a, product company, then you generally spend time tweaking the product and sometimes adding some features, or service ...
25
votes
7answers
3k views

What's the best way to avoid catastrophe caused by negligence? [duplicate]

I have been a programmer for almost 1 year. As an ADHD adult, naturally I don't have the same strength of attention on ordinary stuffs as my colleagues do. And I find the catastrophe made by me are ...
25
votes
11answers
2k views

Is it okay to use a language that isn't supported by your company for some tasks?

I work for a company that supports several languages: COBOL, VB6, C# and Java. I use those languages for my primary work, but I often find myself to coding some minor programs (e.g. scripts) in Python ...
25
votes
10answers
7k views

What are the best practices regarding unsigned ints?

I use unsigned ints everywhere, and I'm not sure if I should. This can be from database primary key id columns to counters, etc. If a number should never be negative, then I will always used an ...
25
votes
5answers
11k views

Are there any major alternatives to Waterfall and Agile? [closed]

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.
25
votes
10answers
1k views

Inspiring a co-worker to adopt better coding practices?

In the Handling my antiquated coworker question, various people discussed strategies for dealing with coworkers who are unwilling to integrate their workflow with the team's. I'd like, if possible, ...
24
votes
13answers
5k views

Why isn't literate programming mainstream? [closed]

Literate programming has good ideals. Why do you think that this isn't mainstream? It is because it has failed to deliver?
24
votes
8answers
4k views

Wouldn't it be beneficial to write tests during code review?

A colleague of mine came up with an idea that I found interesting. Wouldn't it be beneficial to write tests during code review, by the person doing the review assuming that we don't do TDD? For ...
23
votes
17answers
6k views

Why are regular expressions so morbidly attractive?

Exhibit 1, Exhibit 2, I guess you won't find it hard to recall other examples. Thing is: if there is more than one way to solve a problem, the PHP programmer (I usually browse the PHP tag on ...
23
votes
18answers
9k views

What should be the maximum length of a function? [closed]

What should be the maximum length of a function? And are there cases which are an exception to this?
23
votes
8answers
2k views

How did you become a const correctness convert? [closed]

After 15 years of C++, I've still haven't learn to love using const. I understand it's use, but I've never actually been in situation where being const correct would have avoided the problem I was ...
23
votes
4answers
919 views

Prefer examples over documentation. Is it a behavioral problem?

Whenever I come across a new API or programming language or even simple Linux man pages, I always (ever since I remember) avoided them and instead lazily relied on examples for gaining understanding ...
23
votes
5answers
4k views

Code Samples and Interviews? [closed]

I've seen a number of questions since I've been here where, in the answer, someone has asserted that they would never use portfolios or code samples coded outside of the interview process to judge a ...
22
votes
15answers
5k views

Spending too much time debugging

Yesterday, I rolled out a v1.0 release of a Web project I've spent about 6 weeks working on (on and off, that is). I haven't made any exact records of my time, but according to my experiences I would ...
22
votes
11answers
2k views

Should I be concerned that I can't program very fast without Google? [duplicate]

Possible Duplicate: Google is good or bad for programmer? I'm currently in college to be a software engineer, and one of the main principles taught to us is how to learn for ourselves, and how ...
22
votes
7answers
4k views

while(true) and loop-breaking - anti-pattern?

Consider the following code: public void doSomething(int input) { while(true) { TransformInSomeWay(input); if(ProcessingComplete(input)) break; DoSomethingElseTo(...
22
votes
12answers
3k views

Should developers be forced to check-in before leaving work each day, even if the code does not compile? [closed]

During a previous consulting position, the developers where told to check-in code on a nightly basis, regardless if it complied or was complete. Managers were afraid of losing any code and said now we ...
21
votes
10answers
3k views

Is over-engineering a warning sign? [closed]

So we present a straightforward coding exercise to new candidates with some well defined requirements. Occasionally we receive solutions which don't really solve the problem at hand, but are over-...
21
votes
10answers
2k views

Struggling as a programmer. Need some advice [closed]

I've been a developer now for a number of years. I'm pretty good at what I do and can "get the job done". But, there is a difference between "getting the job done" and "doing the job properly". Let's ...
21
votes
5answers
13k views

When and why you should use void (instead of e.g. bool/int)

I occasionally run into methods where a developer chose to return something which isn't critical to the function. I mean, when looking at the code, it apparently works just as nice as a void and after ...
21
votes
12answers
646 views

Refactor or Concentrate on Completing App

Would you refactor your app as you go or focus on completing app first? Refactoring will mean progress of app app will slow down. Completing app will mean you get a possibly very hard to maintain app ...
21
votes
6answers
2k views

Should I place functions that are only used in one other function, within that function?

Specifically, I'm writing in JavaScript. Let's say my primary function is Function A. If Function A makes several calls to Function B, but Function B is not used anywhere else, then should I just ...
21
votes
5answers
774 views

Is staying implementation agnostic really worth it?

I have a project that I'm working on currently using Tomcat, Spring 4, Spring Security, MySQL, and JPA w/ Hibernate. I picked JPA from the standpoint that it's suppose to make swapping out the ...
21
votes
5answers
1k views

How to avoid giant glue methods?

In my current job, I've been tasked with cleaning up old code a few times. Often the code is a labyrinth and the data behind it is even more tangled. I find myself combing out things into nice, neat,...
21
votes
1answer
1k views

How often is seq used in Haskell production code?

I have some experience writing small tools in Haskell and I find it very intuitive to use, especially for writing filters (using interact) that process their standard input and pipe it to standard ...
20
votes
15answers
4k views

Do Programmers sometimes intentionally over complicate code? [closed]

It seems alot of times on stackoverflow, that people (programmers especially) tend to over complicate a solution to a problem to where the solution is vastly much more complicated then the original ...
20
votes
5answers
3k views

How to overcome programming by coincidence? [closed]

In the book The Pragmatic Programmer, the writers mention the programming by coincidence concept. It explains what it is, why it is caused, what are the dangers you may encounter and it compares with ...
20
votes
3answers
6k views

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 ...