Questions for best practices for writing high quality code.

learn more… | top users | synonyms

19
votes
9answers
812 views

Is it better to use pre-existing bad practices, or good practices that don't fit well with old code? [closed]

I was thinking of this because I was trying to write an extension for an existing 3rd party software, and their database is horribly denormalized. I needed to use their existing tables and add a bunch ...
5
votes
3answers
658 views

Handling false positives and legacy code warnings in static-analysis of C++ code? [closed]

We have a large "legacy" C++ code base on which no static analysis is run at the moment. Every now and then, we are thinking about at least using cppcheck, maybe via Visual Lint. (I've also briefly ...
2
votes
5answers
342 views

What is a better word for aligning your nesting?

I was taught by an old-time programmer who called this nested code if(condition){ <div> <b>text <u>text</u></b><br/> <table> <tr> ...
7
votes
6answers
2k views

Prefer class members or passing arguments between internal methods?

Suppose within the private portion of a class there is a value which is utilized by multiple private methods. Do people prefer having this defined as a member variable for the class or passing it as ...
23
votes
14answers
3k views

Why do so many developers believe performance, readability, and maintainability cannot coexist?

While responding to this question, I began to wonder why so many developers believe a good design should not account for performance because doing so would affect readability and/or maintainability. ...
2
votes
5answers
2k views

Are ASP.NET MVC automated code good enough to be used in real live applications [closed]

I have been trying to get my hands dirty with ASP.NET MVC which looks pretty good (I am not certain, but some users say that even StackOverflow and other StackExchange websites made use of it). The ...
2
votes
3answers
2k views

General checklist before releasing software [closed]

I'm currently building a tool that my company intends to sell. I'm the sole developer on the project and it is being developed outside our normal code base and to a certain extent outside our normal ...
3
votes
1answer
8k views

What is the best way to comment a deprecated class in Java?

I would like to know the best way to add a comment to identify a deprecated class in Java. Should I remove the previous comment added to the top of the class that helps another programmer to know what ...
7
votes
0answers
681 views

Website for code review [duplicate]

I know that we all are trying to improve our structure and style of our code, striving to be truly agile. Websites like Stack Overflow are great when you want an answer to a specific question but ...
6
votes
6answers
338 views

Formatting 'Complex' Math

Note: by 'complex' math I mean an equation with many steps involved and a wide mix of operators. A programmer should know the order that operators are evaluated in an equation. However it can be a ...
66
votes
14answers
4k views

Why is DRY important?

Quite simple, why would I want to write code that works for all cases and scalable data when all I need to do is repeat the same process a few times with a few minor tweaks? I'm unlikely to need to ...
5
votes
14answers
949 views

Are software developers who ignore quality/standards better for the company?

Do software developers who choose not to put code optimization, standards and best practices as top priority, create more useful code than those developers who choose to worry about optimization, ...
13
votes
12answers
1k views

What to do with a not well organized application? [duplicate]

I'm a newly graduate programmer and just got hired before my graduation. In the office, I used to create and revise modules of some applications developed by other programmers in our company. The ...
11
votes
3answers
239 views

Do I need to deal with the situation where private methods are called through reflection?

When creating a library, must I ensure that the private methods must work as expected when called not by other methods of the same class, but by another library through reflection? For example, if a ...
42
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 ...
17
votes
6answers
1k views

Any success stories continuously using commercial static analysis tools for C++? [closed]

I can't decide whether an offer of a commercial static analysis tool is worth spending the resources. We tried the tool on several million lines of our C++ code and it found something like 50 real ...
9
votes
8answers
701 views

How to balance code quality vs strong developer personalities

On code reviews at work I have been seeing code & patterns that I consider "clever" though not necessarily adding to the overall quality or maintainability of the code base. I point this out on my ...
41
votes
12answers
3k views

Develop fast and buggy, then correct errors or be slow, careful for each line of code? [duplicate]

Possible Duplicates: Frankly, do you prefer Cowboy coding? Prototyping vs. Clean Code at the early stages Good design: How much hackyness is acceptable? Does craftsmanship pay off? ...
113
votes
30answers
9k views

Is micro-optimisation important when coding?

I recently asked a question on Stack Overflow to find out why isset() was faster than strlen() in PHP. This raised questions around the importance of readable code and whether performance improvements ...
3
votes
1answer
143 views

Ideas about how to prevent malicious code to go into production especially in case of SAAS environments

As nowadays SAAS is becoming popular way of developing and deploying the applications, and I have just started working at a company providing SaaS solution for payment authorization services. Since ...
28
votes
18answers
3k views

Why would a company develop an atmosphere which discourage code comments?

I was taught in university to write comments for our programs. As I write comments, I feel like I have a better organization and understand the programs better. However, I am in a company where most ...
3
votes
5answers
489 views

Minimising little coding mistakes [closed]

I make a fair amount of small mistakes when I code (things such as getting an angle bracket to the wrong direction). It adds a fair amount of time to my coding because I have to debug several times ...
66
votes
22answers
23k views

How do you define elegant code? [duplicate]

Possible Duplicate: What does it mean to write “good code”? In a discussion on coding quality, and how you identify it, I came across a discussion on testing people's coding ...
1
vote
6answers
530 views

What information should a good (method- / class-) comment contain?

This is something that has bothering me for a while now. I guess there are a couple of obvious important things that should go into a comment, such as: The author(s) A description of the parameters ...
8
votes
5answers
380 views

When developing on an old code base, should I use Best Practices or go for Consistency [duplicate]

Possible Duplicate: Code maintenance: keeping a bad pattern when extending new code for being consistent, or not ? As my experience in programming increases with each project, I look back ...
3
votes
5answers
790 views

How to convince my boss to switch to OOP PHP? [closed]

We have been trying for months to convince my boss to switch to OOP php, but each time, he takes out his previous experience with programming and convinces us other wise. i need to talk like a boss ...
2
votes
2answers
136 views

Should I update this code or continue with current design

I am working with ASP.NET Application. The application is great and works fine but it a few flaws. To give you an example, Every control uses an absolute position layout. This makes working with ...
11
votes
7answers
2k views

Is it beneficial to read old Java programming books? [closed]

Many of my Java books are 5 - 10 years old. Does it still help to read them, or should I use something within 2 years.
21
votes
6answers
555 views

How to encourage version control adoption

I have recently started working in a team where there is no version control. Most of the team members are not used to any kind of version control. I've been using mercurial privately to track my work. ...
3
votes
3answers
387 views

Code mapping in .NET (or in general)

Does there exist a software solution of some form that has the ability to map out the actions of calling a function. So what I mean is, let's say that we have the following class. public class Foo ...
9
votes
7answers
3k views

What is beautiful code in C++, and why do most programmers care that much?

As most projects use a C++ API, they deal with constraints of the API and constraints of the project itself. I'm a beginner at programming, I don't like to use OOP at all because nobody clearly ...
62
votes
10answers
7k views

I'm forced to write bad code. How do I save my face? [closed]

I'm only a junior developer but my job forces me to work with really terrible PHP code (think about the worst PHP code you've seen; then think about code twice as bad). I usually try to fix bugs and ...
5
votes
6answers
308 views

How to keep a project easy to understand and intutive?

I am working on this project, which will soon contain loads of packages, projects etc. (Java). So, from the start I need to keep track of the high level package and class structure, monitor which ...
2
votes
6answers
330 views

C: What is a good source to teach standard/basic code conventions to someone newly learning the language? [closed]

I'm tutoring someone who can be described as a rank newcomer in C. Understandably, she does not know much about coding conventions generally practiced, and hence all her programs tend to use single ...
151
votes
25answers
13k views

How to convince my boss that quality is a good thing to have in code? [duplicate]

My boss came to me today to ask me if we could implement a certain feature in 1.5 days. I had a look at it and told him that 2 to 3 days would be more realistic. He then asked me: "And what if we do ...
7
votes
6answers
2k views

What's the benefit of having a private repository for personal projects?

So I just created my first GitHub repository and started to wonder if there would be any reason why somebody shouldn't post their code. I don't mean the obvious, such as code that is IP of somebody ...
0
votes
1answer
1k views

C++ IDE and tools with Clang integration [closed]

Recently I've read this blog about Google integrating Clang parser into their code analysis tools This is something in which C++ is at least a decade behind other languages like Java, but now that ...
32
votes
9answers
1k views

How do I overcome paralysis by analysis when coding?

When I start a new project, I often times immediately start thinking about the details of implementation. "Where am I gonna put the DataBaseHandler? How should I use it? Should classes that want to ...
76
votes
11answers
5k 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 ...
21
votes
5answers
2k views

Is code ownership a code smell?

This is something I've been thinking about ever since I read this answer in the controversial programming opinions thread: Your job is to put yourself out of work. When you're writing ...
16
votes
7answers
466 views

Could an internal rep, voting and badges encourage good programming practices?

Just thinking out aloud - we programmers love all this voting/badges/rep stuff so could a scheme like this be introduced into a companies code review process to encourage better coding. Something ...
6
votes
3answers
2k views

What are the steps required to ensure you've covered technical due diligence when purchasing a software product (and IP) created by another company?

If you were tasked with performing due diligence for a software product/IP you/your company was considering buying. What would be your steps to make sure the purchase was acceptable from a technical ...
15
votes
9answers
1k views

Dealing with a developer continuously ignoring edge cases in his work

I have an interesting, fairly common I guess, issue with one of the developers in my team. The guy is a great developer, work fast and productive, produces fairly good quality code and all. Good ...
4
votes
4answers
252 views

lightweight, sustainable processes for good code/design quality?

Ok, gang, next question: what do y'all think are the best processes to improve the quality of the code the (corporate) team produces? (The cult of quality question was good, but I'm looking for ...
5
votes
3answers
301 views

Fine Line: Readability Vs Speed

Is there a line between readability vs compile or processing speed? Aside from the extreme cases, I wouldn't think it would be even worth saving that little bit extra in favor of legibility... For ...
34
votes
9answers
2k views

Prototyping vs. Clean Code at the early stages

I'm planning to work/start on a few personal projects that could end up as my daily job. It made me think, which way should I start? Just prototype—write just working basic code that could cost me ...
5
votes
7answers
768 views

Do good code readers write bad code?

I've been observing programmers that are great at reading foreign, messy and undocumented code. At the same time they tend to also write messy code without documenting it. Is this common or just a ...
22
votes
9answers
2k views

My coworker is a nice guy, but his performance is sub-par. Do I tell my boss?

I was placed on a project about three months ago that was until then under development by a single, newly hired developer because it was falling behind. To be fair, the project is an interface to a ...
46
votes
12answers
3k views

If your unit test code “smells” does it really matter?

Usually I just throw my unit tests together using copy and paste and all kind of other bad practices. The unit tests usually end up looking quite ugly, they're full of "code smell," but does this ...
10
votes
5answers
3k views

Why have a method that returns a bool/int and has the actual object as an output parameter?

I see the following code pattern all over the place in my company's codebase (.NET 3.5 application): bool Foo(int barID, out Baz bazObject) { try { // do stuff bazObject ...