Questions tagged [readability]

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.

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.

To improve code readability, the following is usually considered:

  • The code is written such that a person with poorer programming skills will be able to understand what is written.

  • Adding descriptive comments to explain every step of the way.

  • Using proper indentation and white spaces.

  • Choosing object\variable names that describe their purposes.

  • Referencing the algorithm and the responsible authors.

730 questions
0
votes
1 answer

ImageMagick best improvements for number readibility (with Tesseract)

I am using ImageMagick to convert a digitalized PDF file to tiff. I use Tesseract to scan a small part of this document which is a number. My digitalized documents have a poor definition and sometime tesseract doesn't manage to read the right…
Vincent Roye
  • 2,751
  • 7
  • 33
  • 53
0
votes
0 answers

Empty Response - Readability API

I was testing Readability API on my localhost with the following jquery code: $.getJSON("https://www.readability.com/api/content/v1/parser?url=" + encodeURIComponent(url), function( data ){ log(data); }); with the following response…
kyw
  • 6,685
  • 8
  • 47
  • 59
0
votes
3 answers

Proper way to break up large strings

I have to write an application that searches for some constant strings in a file/database (they haven't told me which it is yet, and it really doesn't matter for this post). Anyway, these strings tend to be long (over 200 characters at times) and…
inspectorG4dget
  • 110,290
  • 27
  • 149
  • 241
0
votes
1 answer

Generate octave query using java

I have a complicated drawing procedure written in Octave. I want to call it from JAVA. So, I am generating some octave query using JAVA to call this draw function. However, this part of code does not seem to me right: String line = "draw('" + header…
Sait
  • 19,045
  • 18
  • 72
  • 99
0
votes
1 answer

PHP Jquery-like nesting readability

I'm building a new framework and beneath all the work I'm suffering a strange question aroused my mind. Is it worth creating a jquery-like nesting syntax like this ? core->component->...->method() Assuming all "components" expand an abstract class…
Kei
  • 771
  • 6
  • 17
0
votes
1 answer

Readability: splitting lines of code, should the operator be on the first or second line?

Simple question about formatting code (in my case C++). If I have a line of code, say: SomeSortOfLongVariable = AnotherLongVariableThatTakesUpTonsOfHorizontalSpace + IDontActuallyUseVariablesThisLong Should I split it like: SomeSortOfLongVariable =…
Fault
  • 420
  • 3
  • 17
0
votes
3 answers

Magic numbers for parameters or method overloading?

I need to implement an interface for a class in C++ where I need to ask for events occured related with two kinds of sets, let's say here persons and actions. I need to ask for person identifier and action identifier in all possible combinations…
chorch
  • 163
  • 1
  • 7
0
votes
1 answer

Purpose of Particular Java Variable

I'm taking an AP Computer Science course and have a brief question about the purpose of a particular variable in Java program. Below is my own slight adaption of a certain program in my textbook... public class Nineteen { public static void…
Eric
  • 99
  • 2
  • 9
0
votes
5 answers

Readable alternative to two-dimensional switch statement?

I need to fire different methods depending on the value of parent and child which are different values of the same enum type. Currently I do this: switch (parent) { case DEPARTMENT: { switch (child) { case TERMINAL: { …
Gili
  • 86,244
  • 97
  • 390
  • 689
0
votes
4 answers

Elegant coding, how to deal with hidden/invisible HTML code?

I am developing an ask-and-answer website. There is a "Choose as best answer" button besides each answer, this button should be visible to the asker but should be invisible to other viewers. Other part of the web page is almost the same. So how can…
Steven
  • 24,410
  • 42
  • 108
  • 130
0
votes
5 answers

C++ macros to convert readable equations into corresponding code

Suppose I have the following code currently: double P[2][2][10]; std::vector b, r, n; // // Assume that 10 doubles are pushed to each vector and // that P has all its allocated values set. // for(int t=0; t<10; ++t) { P[0][0][t]…
synaptik
  • 8,971
  • 16
  • 71
  • 98
0
votes
1 answer

How to download images from response of Readability Parser API in C#

I'm using Readability Parser API to get content of the page. After result received content goes to kidlegen.exe(to generate .mobi) and then to my kindle via email. The problem is content i get from Readability Parser API contains to remote…
trerums
  • 397
  • 2
  • 15
0
votes
2 answers

Enforcing pointer to pointer type at compile time

I have got a deserialization scenario for an object hierarchy, in which most objects contain pointers to other objects, but don't own them. I am trying to implement a two-step process in which: Objects are created, Register(Object* pObject)ed to an…
zyndor
  • 1,418
  • 3
  • 20
  • 36
0
votes
5 answers

Can I apply the same styling to two elements together in jQuery by grouping them like in CSS?

This is simply for keeping code neater. In CSS I can group elements like this: .element1, .element2, .element3, .element4, .element5, .element6 { font-weight:bold; } is there anything similar in jQuery or would I have to set each…
byronyasgur
  • 4,627
  • 13
  • 52
  • 96
0
votes
1 answer

Writing methods inside methods for readability. Good or bad?

I personally like to break long methods into smaller steps, for example: Load() { LoadStep1() LoadStep2() LoadStep3() LoadStep4() ... } is this overkill? Someone else complained that there is too much jumping around to find the actual logic. I…
happygilmore
  • 3,008
  • 4
  • 23
  • 37