Readability is a subjective parameter used to measure an aspect of code quality. It is based on the assumption that code should be easily comprehensible by humans, both in its form and in its meaning.

learn more… | top users | synonyms

7
votes
4answers
66 views

Check if XmlNode with certain attribute exists and create XmlNode if not

I'm not going to explain the purpose of the code provided below. If you do not understand it, i know that i have to improve it (naming, structure etc.). I would like to know how to improve this code ...
11
votes
7answers
365 views

Class for handling unit conversions

I am creating a class to be the end all defacto class for handling unit conversions. This is particularly difficult in my company's industry where imperial architectural strings are used as units. I ...
5
votes
1answer
83 views

Increasing readability of maximum path sum algorithm

I had written a solution for Project Euler problem 18 in Python 3. It is good in its efficiency but the problem is the readability and I think reuse. The algorithm used is that at every iteration ...
4
votes
1answer
42 views

Template with boost::operators extremely verbose and repeating

I got the following ugly code: ...
7
votes
2answers
69 views

Merge some child values back into the parent multidimensional array

This is a wonky PHP function I came up with to merge some select values from child arrays into the original. It could really use some help simplifying / making it more elegant. Is there a built-in ...
9
votes
2answers
81 views

Printing permutations of a given string

I want some feedback on the program I developed in C for printing the permutations of a given string. ...
5
votes
1answer
62 views

BinarySearch Kata in Ruby

I've just completed this binary search kata - which has some weird requirements - and I spent a little while "cleaning" up my code and making it more compact. I would appreciate some feedback on the ...
3
votes
2answers
68 views

Readability and cyclomatic complexity of this Ruby code

I consider this two options exactly the same. I prefer the first one but I'm not sure if it's better the second option in terms of cyclomatic complexity or readability. Assuming that this is not pure ...
10
votes
2answers
55 views

Component-oriented implementation of JList

One of the main problems I have with JList is that no component is actually added to it. This means that things like ...
2
votes
1answer
64 views

Bash pass multiple commands to SSH and make readable

I have a script that sends multiple commands after logging in a remote machine via SSH. Problem is, it's barely readable. I've tried quoting everything with "", but it's terrible (everything appears ...
10
votes
3answers
271 views

Proper capitalization for book titles?

I'm working through some exercises to sharpen my Ruby skills. The following code is how I solved this particular question. I'd like to know what other developers think of this solution. I'm self ...
7
votes
1answer
54 views

Importing data from an external EXCEL-Sheet

I was assigned the task of copying some subsums from a given EXCEL-Sheet into the executing EXCEL-Sheet. This had to be done with an EXCEL-Macro, so non-programmers can easily use it. There was the ...
11
votes
1answer
270 views

Project Euler “Even Fibonacci numbers” in Java 8

I'm looking for general advice on my code on the following problem: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 ...
4
votes
3answers
77 views

What are my options for read-only access with many member variables?

I have a MouseInputHandler class that registers itself to an InputManager. When the InputManager class receives events they are ...
10
votes
1answer
112 views

Finding the next higher digital permutation of a number

This is my solution for CodeEval challenge 44. The function followingInteger takes a number in its decimal representation and returns the next higher permutation ...
13
votes
2answers
955 views

Java %= and general feedback

I'm doing a program for a course in school (intro software development) and I'm looking for some general feedback as well as any ways this bit of code could be cleaner. I'm also wondering if it is bad ...
3
votes
2answers
169 views

Return value when the requested variable returns null

I have a method that returns a list from a html page: ...
12
votes
4answers
827 views

Better way to manipulate this string in sequence?

I am working on a small custom Markup script in Java that converts a Markdown/Wiki style markup into HTML. The below works, but as I add more Markup I can see it becoming unwieldy and hard to ...
4
votes
3answers
67 views

Mutual conversion operators

What is more readable? value / 60 / 60, value / 3600, or ...
2
votes
1answer
134 views

How to make string.Format template more readable?

Have a look to the following example. Clearly it's very hard to understand the meaning of each parameter passed to the string.Format to be replaced to the numeric sequence of {0}, {1}, ... I want to ...
10
votes
5answers
1k views

Minimal Game of Life in C#

I want to learn how to write clean code from the start. This is my first project, a 'Minimum Viable Product' implementation of Conway's Game of Life in C#. Mostly I want to know if my code is ...
1
vote
1answer
71 views

Commenting in simple programs [duplicate]

I am struggling with commenting and variable-naming. My teacher said I need to add comments to my below code. I am not sure where I could add comments (I feel it is self explanatory) or what I ...
7
votes
1answer
144 views

Home-grown web service

I needed to build a one-way web service for a mobile app I developed. Its only goal is to receive incoming JSON data and insert it into the correct tables. It works, but it looks very "kludgy" and ...
5
votes
1answer
251 views

Newton's method to solve cubic equations

I have deleted the previous question I had posted, and am reposting the program with the new version of the code without the error present in the previous one. I have used the Newton-Raphson method ...
0
votes
2answers
62 views

Screenshot-scaling code

Please review for readability. ...
8
votes
3answers
121 views

How clear is this ruby code?

Elsewhere, there was a question about an elegant solution to a problem. I'm curious whether this solution is elegant from the perspective of easy to understand for a ruby programmer (which I am no ...
2
votes
2answers
151 views

Game launcher for The Sims 3

Is there a way I could improve my code's readability, or have I finally won the war against sloppy coding? Here's a game launcher I made for The Sims 3 to fix the awful performance caused by big ...
3
votes
1answer
472 views

Simplifying HTML parsing

I'm working on an app for my school (not homework, an app that's going to be used by students), that's supposed to display our week schedules. I get the data from a webapp, but it has no API that I ...
3
votes
1answer
119 views

Complete Hangman game

I would like to improve code readability and reduce the complexity of my code to improve the maintainability of the source code. If you have any tips, please say so. I was also wondering if it would ...
6
votes
2answers
142 views

python neural network: arbitrary number of hidden nodes

I'm trying to write a neural network that only requires the user to specify the dimensionality of the network. Concretely, the user might define a network like this: ...
2
votes
3answers
179 views

Is this a good parser?

Is this a good C program for splitting a command line without doing any expansion on it? Don't worry too much about main() and the output -- those are for testing. ...
3
votes
1answer
79 views

SASS Code Structure / Readability

I'm trying out a new approach to SASS stylesheets, which I'm hoping will make them more organizined, maintainable, and readable. I often feel like there is a thin line between code that is well ...
4
votes
1answer
70 views
2
votes
4answers
163 views

How can I make this code more readable and efficient?

How can I rewrite this code to make it more readable and, if possible, more efficient? The conditions are entirely necessary in this problem, but how could I rewrite those ...
5
votes
1answer
168 views

GUI design in Java Swing

I am developing a GUI using Swing, but before my project gets too complex. I would like to have a good design structure. I have a few ideas and will use a simple example to illustrate. Some feedback ...
6
votes
3answers
86 views

Code Readability and Maintenance

I'm debating which version would be more suitable in parameters of code length, readability and maintenance. This is a portion of a set of functions which together parse a Gif file. Version 1: ...
0
votes
0answers
32 views

Could this ROM reader be faster and/or smaller?

I've been practicing arduino programming for a few weeks now having become confident in reading and writing to pins so I decided to take it a step further and do a serious project that does both, so ...
3
votes
2answers
36 views

How to make the end of loop more readable in Ruby

There are some blocks in my code. To make it easier to read, I often append comment after the end such as end # end upto end # fileopen Because sometimes ...
1
vote
1answer
64 views

Tic-Tac-Toe JavaScript readability and additional suggestions

Requires Underscore and jQuery I'm looking for suggestions on how to make this a little more readable and additional suggestions on flow, logic, etc. The game can be run in a browser by just ...
2
votes
1answer
237 views

Is this an elegant/accurate simulation of the Monty Hall problem?

I'm trying to simulate the Monty Hall problem, to statistically determine if there is any benefit to changing my choice after a door containing a goat is open (testing this guy's Monty Hall theory on ...
7
votes
1answer
134 views

Improving readability of Boolean adder generator?

Today I've noticed that the source code for a Boolean adder is very repetitive, so I wrote a Python script to generate the C source code. The script generates an adder of varying size depending on ...
2
votes
3answers
90 views

Function for encoding strings in-place

I recently wrote a function that replaces every white space with '%20', just for fun (and sharping my coding skills). The input string is terminated with extra white spaces, with the length that the ...
1
vote
2answers
122 views

Readable Ruby Gem

So the main purpose of Ruby is to be readable. I hope I did a good job with this gem I made. If there's any kind of suggestion of how to make this better, then please tell me. ...
2
votes
1answer
148 views

Method names for encapsulated unit testing logic. Which convention is better?

I have some C# unit tests which each basically perform the same steps but supply different arguments to the unit under test. I wanted to encapsulate the logic inside some "helper methods" but found ...
2
votes
1answer
135 views

Review of String to Long bijection class - focus on readability/maintainabiliy

I wrote the following interface and class to bijectively map a string to a long. I would like feedback on how to make the code more readable and maintainable. Interface: ...
4
votes
2answers
81 views

Can someone review my Rational implementation?

The header file can be viewed here. ...
1
vote
1answer
34 views

Can someone review my Polynomial data structure?

The following is working but I just want to know if I can make it better in any way. The header file can be viewed here. ...
3
votes
2answers
303 views

get rectangle count from given co-ordinates code review

Problem Description Write a program to find the maximum number of rectangles that can be formed both horizontal and vertical with the help of a given n number of coordinate(x,y) points. [x,y points ...
2
votes
1answer
58 views

Which of these two is better in terms of readability and function?

I have two different ways of populating a List with querying another List. They are: ...