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
0 answers

How to create a list with most if not all Python3 Error Messages

Some error messages (those encountered by the beginners mostly) are not friendly enough for beginners themselves: Error: 'str ' object does not support item assignment I think a more suggestive, less cryptic message would be: Error: value…
0
votes
1 answer

Enumerate the size of a list backwards, but keep the list going forwards

So I have some code as follows: amount_of_episodes = len(episodes_from_user_show) for x in episodes_from_user_show: print("[{0}] Episode {1}: {2}".format(amount_of_episodes, x.episode_number, x.name)) #…
Brandon Dodds
  • 93
  • 1
  • 1
  • 7
0
votes
2 answers

member field as method parameter in java

Nowadays, I'm writing lots of unit tests in my company. While writing them, I'm facing a problem regarding usage of member fields as parameters of methods in my test class. That's because my colleague cannot understand of the context of…
0
votes
1 answer

Python readability

Greetings stackoverflow, I am pretty new to both this website and python. I wrote a simple program to create a list of devisors based on a user inputted number, the program works (as far as I know) But I am pretty sure my syntax is extremely…
Nolub hay
  • 3
  • 2
0
votes
2 answers

Is there a reason to create classes on seperate modules?

As I learn more about Python I am starting to get into the realm of classes. I have been reading on how to properly call a class and how to import the module or package.module but I was wondering if it is really needed to do this. My question is…
Mike - SMT
  • 14,784
  • 4
  • 35
  • 79
0
votes
2 answers

Python modules - methods vs variables

In writing modules for python code to improve readability and portability, is it better practice to write methods or variables for simple return values? Why? Do python methods utilize more space in memory or do variables? In practice it doesn't…
user7600286
0
votes
2 answers

Refactoring - Combine PolygonClickListener and MarkerClickListener

I am trying to refactor the following method by removing the duplicates in both map.setOnPolygonClickListener and map.setOnMarkerClickListener. Both listeners do exactly the same thing and I would like to combine them as one but since the call…
Rana
  • 1,675
  • 3
  • 25
  • 51
0
votes
1 answer

Formatting and Readability of Output in Hadoop

So I'm just learning Hadoop and trying out the WordCount.java tutorial which works fine. I have zero problems with it. My only issue is that when I get my results in the output file, I want to add in Strings myself. So lets say I have another file I…
I2obiN
  • 181
  • 3
  • 18
0
votes
1 answer

Calculate readability scores for several files with R

I would like to calculate the readability scores in R-3.3.2(R-Studio 3.4 for Win) using koRpus package for several txt.files and save results to excel or sqllite3 or txt. Now I can only calculate the readability score for one file only and print…
In777
  • 171
  • 1
  • 4
  • 15
0
votes
4 answers

Making large numbers in Javascript code more readable

Is there a way to make a large number, i.e. 1000000, more readable in JS code? I know in Ruby you can write 1_000_000 instead, which makes it a lot easier to identify visually. Thanks.
fafafariba
  • 335
  • 1
  • 2
  • 12
0
votes
0 answers

Grabbing main image of the article

I am using node-readability module to cleapup the articles. But in most of the cases, the main image of the article is not part of the grabbed content. So, I have made some changes in the helpers.js and readability.js files to grab the main image of…
0
votes
4 answers

C# performance and readability with buttons enabling/disabling

I've often found myself in front of that kind of code : if(Something > 0) { btnOne.Enabled = true; btnTwo.Enabled = true; btnThree.Enabled = false: } else { btnOne.Enabled = false; btnTwo.Enabled = false; btnThree.Enabled =…
Andy M
  • 5,945
  • 7
  • 51
  • 96
0
votes
1 answer

How to go about checking if a sentence makes readable sense?

My goal is to be able to detect computer generated spun content. Here are some examples of spun text: "As a explicit art fashionable for an advertising organization, you will job to assist put up for auction customers' crop and/or armed forces to…
Zach Johnson
  • 2,047
  • 6
  • 24
  • 40
0
votes
1 answer

.net Serializing XML in a compact, human-readable way

I'm serializing a structure that results in this output: Bool Gut Int
Ravior
  • 561
  • 2
  • 9
  • 30
0
votes
0 answers

Formatting of dynamically generated HTML - does no one care?

Possible Duplicate: Formatting of dynamically generated HTML - does no one care? I have very little experience in web development, so this may be a very basic question. It's just, from the limited experience I do have (a little PHP, and a little…
Dan Tao
  • 125,917
  • 54
  • 300
  • 447