Questions for best practices for writing high quality code.

learn more… | top users | synonyms

2
votes
1answer
149 views

Will this “wireless” syntax for my framework make for good code structure / design?

I'm at the point where I'm getting into the freelance development of some complex web apps, and I would like to develop a light weight framework for my personal use, but I'd like to get some advice ...
0
votes
1answer
56 views

OpenSSL Client model for half duplex communication over socket

I have read in this SO question that OpenSSL socket communication can be only half duplex in a single thread. Assuming what I have read is true, I am wondering if I can apply philosopher's dining ...
16
votes
14answers
3k views

How many mistakes does a good software developer make? [closed]

I am currently in a situation where a lot of people criticized me for making bugs (on my first local try - the first time I run the code for the first locally done test - , not on a committed repo ...
3
votes
2answers
136 views

In terms of Software, what constitutes a quality control plan for ISO 9001 compliance?

I am bidding on a government contract (my first) and there is a section requesting that I provide a high-level outline of a quality control plan that would ensure that the end product is ISO-9001 ...
0
votes
4answers
360 views

File exists vs. File does not exist. Is there a difference in performance?

Let's say I am checking a directory for the existence of a file, and then depending on whether or not the file exists, I act accordingly. For example, see the two Python snippets below. if ...
4
votes
1answer
371 views

In Java, why use bit hacks when non-bitwise technique it is more readable?

Is there any legitimate use for bit manipulation hacks in higher-level languages such as Java? I can see them being useful in speed-sensitive low-level and computation-intensive programs, e.g. ...
0
votes
2answers
153 views

Working with Javascript classes the right way

Comparable questions have surely been asked before but I'd like to hear some words about my specific way of implementing Javascript classes. Let me first start with a Javascript example taken from a ...
1
vote
2answers
103 views

Apply filter only if not null

My function takes an optional parameter, type, which is used to filter through a collection. However, the filter should only apply if the parameter is passed in (in other words, non-null). If the ...
1
vote
0answers
98 views

Diagram to show code responsibility

Does anyone know how to visually diagram the ways in which the flow of control in code passes between code produced by different groups and how that affects the amount of code that needs to be ...
1
vote
3answers
196 views

Software architecture for two similar classes which require different input parameters for the same method

I am writing Java code to simulate a supply chain. The supply chain can be simulated in either an intermediate stocking or a cross-docking configuration. So, I wrote two simulator objects ...
1
vote
1answer
128 views

Is it good practice to analyse who introduced each bug? [duplicate]

I used to analyse performance of programmers in my team by looking at the issues they have closed. Many of the issues are of course bugs. And here another important performance aspect comes - who ...
1
vote
3answers
70 views

Modelling highly specific business requirements

How can one go about modelling highly specific business requirements, which have no precedent in the system? Take for example the following requirement: When a purchase order contains N lines, is ...
2
votes
4answers
236 views

Is it normal needing time to understand code I wrote recently [closed]

By recently I mean some weeks ago. I am trying to continue a project I left 2 weeks ago and I need time to understand some functions I wrote (not copied from somewhere) and it takes me time. Normally ...
3
votes
2answers
129 views

Checking program robustness using static code analysis

(Building on this question) If you have a static code analyser such as Checkstyle, is it possible to to relate any of the stuff that it checks for to actual robustness? Some of the things that ...
36
votes
12answers
5k views

I am making 4-5x more story points than average, but producing bugs at half the rate. Graphs say it's 2x more bugs, how to deal with that?

So it is generally accepted that top tier programmers can produce an order of magnitude more/better code than their more average peers. It's also generally accepted that the rate of errors made in ...
-1
votes
1answer
91 views

How to code efficiently? [duplicate]

I often compare my code to others and I find their solution more efficient and shorter than mine. Although both solutions work, I can't help it but wonder if mine is not adequate enough. As a result, ...
7
votes
4answers
349 views

Does “write quality code” advice apply to companies of any scale? [duplicate]

I carefully followed the "always write quality code, unless you're writing a prototype" advice during my career as freelancer and software developer. I was convinced pretty early that avoiding to do ...
27
votes
10answers
3k views

Getting coders to do code review [duplicate]

I am running a project where I pay developers to contribute to my semi open source project. My problem is that it is easy to hire developers, but it is very difficult to get anyone to do code ...
0
votes
1answer
90 views

Is it a good practice to decouple the membership system?

Currently I'm developing a project that basically is built with ASP.NET Web API. The membership system I'm using is ASP.NET Identity. The only problem I'm seeing with this is that the membership ...
0
votes
0answers
49 views

Creating New Wrapper Objects and Extension Classes and Keeping it Organized

Here's my situation: I'm programming an embedded device with a very simple, but customizable LED array display. It's 10 RGB LEDs linearly setup. The LEDs will be used to display many different ...
4
votes
1answer
238 views

If TDD is design, how do you know your TDD is well designed? [duplicate]

Given a large group (50+) of programmers: All given the same problem, All using Test-Driven Development (TDD), All pair programming, All doing group-based code review, I have personally seen the ...
1
vote
1answer
156 views

Java code quality in methods calling methods

I am currently working with an "interesting" code-base and see the following type of thing alot in the code. public Object doSomething() { Object obj = new Object(); // Do some stuff to the ...
0
votes
0answers
46 views

Algorithm to Select Sequential Subarrays from an Array

I solved my problem by using simple nested loops and comparisons but I'm wondering if there is a well known Selection Algorithm to solve my problem. Let's say I have an array such as [1, 10, 250, 9, ...
3
votes
2answers
140 views

Reflecting on finished project with no other technical criticisms?

I'm a coop (in college but I work 3 months, then do classes for 3 months, work again for 3 months, etc until I graduate) at a company in their IT department. My job usually has to do with writing ...
0
votes
1answer
130 views

What should be the minimal quantity of code production per week? [duplicate]

I'll try to further explain what I mean. Imagine you are the boss of a company. You have to deal with the tradeoff between the quality of the code and the speed of producing it. Let's assume to ...
2
votes
3answers
138 views

When to use python function nesting?

I am writing a program that creates backup of directories. Which of the following approach is better for code organization? Create separate class for Backup and Zip logic - class BackupUtil: ...
5
votes
4answers
769 views

Sprint pressure causes quality issues? [closed]

The burn down chart displays a clear deadline and the progress towards the deadline. When the progress is slow and the completion of the committed work is at risk, people start to get sloppy on design ...
0
votes
1answer
154 views

Lean Startup MVP: Quality Code or Quick and Dirty [duplicate]

Hello some programmers might know about the lean philosophy, building a minimal viable product Lean Startup MVP. I ask myself (when building Webapps): "Should I put effort into writing good ...
1
vote
0answers
28 views

Reducing Valgrind Findings (uninitialised value)?

I'm trying to run some code though Valgrind. The code depends on OpenSSL, and OpenSSL is making Valgrind useless due to uninitialised values. I know where the use lies in OpenSSL's PRNG, but I'm ...
16
votes
11answers
2k views

How to address the concerns of the software architect but still maintain collective code ownership? [duplicate]

The quality of the code in our software is indeed lacking. When you change a line of code in one component it usually breaks code in other components. Our software architect blames this on collective ...
2
votes
1answer
51 views

When should I pass setting-like value as class' variable and when as an assoc. array?

Following my other question, is there a general rule of thumb, when we should pass a setting-like value, that controls class' behavior (for example displayed texts) as as class' constant or variable, ...
1
vote
1answer
87 views

When should I pass value as class variable and when as a method argument?

Is there a general rule of thumb, when we should pass a value as as class variable and when as a method argument? Or is it just a choice of the developer? For example -- are there any reasons, why ...
3
votes
1answer
158 views

How to avoid too much html in JQuery?

I'm not liking how my JQuery is after making some dynamic buttons, or other dynamic things. For example, when I have checkboxes marked, I add a button that is called "Download Selected" and "Remove ...
6
votes
6answers
384 views

Code ownership with multiple Scrum teams

If two Scrum teams use the same software component, who is responsible for providing a clear architectural vision of that component and maintain/develop this vision as the code base evolves? In Scrum ...
2
votes
1answer
262 views

equals and hashcode methods autogenerated, is it always a good practice?

Preamble: Let's say I aim to cover all my classes with test coverage. Despite the common opinion (expecially in Java community) to "not pay too much attention to Cyclomatic Complexity (CC) and code ...
2
votes
4answers
251 views

What's the point of Continuous Integration services like Travis CI?

As far as I can tell, services like Travis CI and CircleCI take your project and run its test suite whenever you push a new change to your repository. Assuming that it's also possible to either ...
1
vote
2answers
127 views

Should a method in a class be aware that the class has “loaded” a variable?

So I have the following code, which connects and then binds to an LDAP server. The question is in the first method. public function getUsers() // This is the method in question { if( ...
0
votes
1answer
54 views

should this code be structured into an event capture and a method or put the functionality in the event capturing

I have adopted some jQuery code that has like 20 event-captures that look like this // used on menu#edit $('.show-headers-only-toggle').on('click',function(){ ...
3
votes
3answers
122 views

Can removing unnecessary file from a repo be considered part of refactoring?

We're using Git as our DVCS and we're about to start to do a clean up (never done before in this team) of files that are not necessary (not part of the sources) from our products. This is done in two ...
6
votes
5answers
433 views

How do you get developers to want to write good code they can be proud of? [closed]

In a team of developers, how do you get the developers to feel pride in their code and write good code (I realize this is subjective and everyone is different, but there is a point when I write code ...
13
votes
4answers
947 views

Which way to terminate reading loop is the preferred approach?

When you have to iterate a reader where the number of items to read is unknown, and the only way to do is it to keep reading until you hit the end. This is often the place you need an endless loop. ...
2
votes
3answers
234 views

Are projects using frameworks not as good as projects using pure programming? [duplicate]

I've been a Rails developer for a year now (originally self taught), and am at the point where I want to improve. I've been reading books on how to improve the quality of my Ruby code (I read Design ...
4
votes
5answers
441 views

What can go wrong with composing a method name out of a string?

I have a piece of code that composes method name to call from a string parameter. I don't feel it's a good thing to do but I'm not sure what can go wrong with this. Here is a simplified snippet of ...
0
votes
0answers
68 views

Is is reasonable to be asked to record defect culpability? [duplicate]

I fear this question is going to send shivers down the spine, and/or instinctive anathema of the very thought... Basically: has anyone ever been asked to diagnose and assign individual culpability to ...
6
votes
3answers
223 views

How many bugs to expect [closed]

At a previous job (circa 2010), my manager mentioned that he's doing some research into quality metrics. The bottom line is to answer the question how many bugs should I expect? The goal is to try and ...
7
votes
5answers
338 views

Keep indentation level low [duplicate]

I hear a lot that you should not write functions larger than one screen size, that you should extract things into functions if you call things very often and all these coding guidelines. One of them ...
2
votes
3answers
290 views

Which one of these designs is preferred? [duplicate]

In the case of an application with a single simple responsibility (eg, a simple replacement for grep or wc), which of these designs is preferred and why? I find that they are all testable and they all ...
1
vote
1answer
201 views

How to present code in academic work?

Actually, I'm writing my undergrad thesis, that consists in analysing the BitTorrent algorithm and see its application on Transmission client as an example of implementation. Reading through its ...
12
votes
6answers
3k views

Avoid too complex method - Cyclomatic Complexity

Not sure how to go about this method to reduce Cyclomatic Complexity. Sonar reports 13 whereas 10 is expected. I am sure nothing harm in leaving this method as it is, however, just challenging me how ...
4
votes
4answers
309 views

How to scope code base health when interviewing for new a company? [duplicate]

I've recently started working for an awesome company, on a product which is a steaming pile once you go under the hood. Apart from asking for a code review (which I doubt I'd get anyway), what are ...