Questions for best practices for writing high quality code.

learn more… | top users | synonyms

11
votes
3answers
237 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 ...
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 ...
17
votes
6answers
972 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
689 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? ...
110
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
138 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
485 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
516 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
375 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
768 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
135 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
539 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
386 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
2k 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
6k 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
306 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
329 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 ...
148
votes
25answers
12k 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
1k 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
465 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
247 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
297 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
761 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 ...
23
votes
15answers
1k views

How do I convince my team to use smaller classes/methods?

Disclaimer: I'm a newcomer (this is my third day of work), and most of my teammates are more experienced than me. When I look at our code, I see some code smells and bad engineering practices, like ...
7
votes
2answers
302 views

Developer survey of code quality

I know it's almost impossible to define and/or measure code quality. Instead of trying to measure it I would like to survey the other developers to see how they perceive the current quality of the ...
6
votes
5answers
724 views

How do you get consistency in source code / UI without stifling developer's creativity?

We have a small team (2-3) of programmers writing a program with a lot of forms and dialogs. We have a problem where we cannot keep good consistency in what we write, or how we write it. The latest ...
0
votes
2answers
142 views

Does this status show a green signal?

I have done this static code analysis with Code Analyzer. Is it a green signal or should I improve my coding standards?
6
votes
6answers
462 views

When to write Abstract code and when to be more specific?

I'm working on a small tool as a toy project to show the difference between two directories, showing which files/directories were added, removed, modified, etc. I was trying to represent these ...
9
votes
9answers
789 views

Does code generation increase the code quality?

Arguing for code generation, I am looking for some examples of ways in which it increases code quality. To clarify what I mean by code generation, I can talk only about a project of mine: We use XML ...
5
votes
5answers
199 views

Is there a name for the concept of a hierarchy of many short methods in a class

A refactoring I commonly do is where I come across a large method such as public void doSomething() { // do First thing doPartA1(); doPartA2(); //now something else ...
21
votes
13answers
1k views

How do you ascertain the quality of a potential employer's code before you take a position?

In my experience before you start working for a company you have no opportunity to look at the code-base (I've asked and for reasons of confidentiality everyone has always said no, I think that is ...
1
vote
2answers
115 views

What is the proper way to handle this workflow in TFS

A client of mine is using TFS and asks people to operate in this manner: The developer in India writes the first draft of code The code is published to a workspace (eg 10.1.1.1\TFSName ...
11
votes
7answers
506 views

Introducing design concepts/patterns/principles to co-workers

I've read Joel's article about getting things done when you're a "grunt", several times in fact, but I've never been able to do any of the things it mentions. I work as part of a small development ...
5
votes
8answers
639 views

When do code hacks become bad? [duplicate]

When you begin a new project/function/object you mostly have an idea of the model you want to build. It can be based on the clients' wish, on your ideas for the app or whatever. In the middle you ...
61
votes
19answers
12k views

How to Code Faster (Without Sacrificing Quality) [closed]

I've been a professional coder for a several years. The comments about my code have generally been the same: writes great code, well-tested, but could be faster. So how do I become a faster coder, ...
11
votes
6answers
3k views

What makes an application scalable?

I keep seeing in job postings that the applicant must have experience writing "scalable" applications. What makes an application scalable, and how do I know that my code can scale to millions of ...