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
730
questions
0
votes
0
answers
10
views
Message when launching quanteda.textstats and error in runningFlesch's Reading Ease Score
I am new to quanteda and I have tried to get the Flesch's Reading Ease Score readability index. I have 2 issues.
I run "library(quanteda.textstats)" but I get the following messeges. Will ...
0
votes
1
answer
69
views
Replacing string.Split(string[]) with string.Split(char[])
I've noticed that in our code, we have a lot of calls to string.Split(string[],StringSplitOptions) like this:
input.Split(new string[] { "\r\n", "\n", "\r" }, ...
1
vote
2
answers
78
views
Ugly Triple Indirection: Extensible Buffer Management Struct
I'm currently trying to build a string parser for an AVR based stepper motor controller. The idea is to observe some input string over UART, then breaking apart this string into several sub-buffers ...
0
votes
1
answer
23
views
Does adding too much validations for user inputs is a good practice while creating REST APIs
I'm building a REST api which take some inputs like id,customer_id,firstname,lastname,contact,email,updated_time,created_time. Before processing these inputs, i have added validations to check if
id ...
1
vote
5
answers
145
views
Find the remaining Enum
I have the Enum A, B, C.
In a method, I am given two different Enum and must return the remaining Enum.
Example: I receive A and C I must return B
The solution that I have is to use if elseif else:
...
2
votes
2
answers
112
views
TypeScript functions within functions vs. private functions
Here is a hypothetical example:
I have a market.service.ts with 2 functions called buy() and sell() which are each 100 lines of code
export class ShopService {
public async buy() {
// 100 lines ...
0
votes
1
answer
71
views
Is there any difference between using "content = { }" parameter or directly "{}" in Jetpack Compose?
I was wondering if it is better to use directly "content = {}" parameter instead of "{}" despite I see more often people using "{}".
Is the code cleaner or does the code ...
0
votes
1
answer
53
views
How do i use loop to name or use variables in Kotlin?
I'm trying to create a "pixel" layout and manage movements over there for an exercise, and I would love to know a simple/creative way to name and use all the variables without doing terribly ...
0
votes
0
answers
36
views
Improve Readability of Nested Foreach Loops - Should I Create Separate Methods?
I have a piece of code in my C# project that involves nested foreach loops. While it works as intended, I find it difficult to read and maintain due to its complexity. I'm wondering if it's a good ...
0
votes
2
answers
73
views
How to improve this program's readability?
I'm learning the basic of Python dictionaries and am having an exercise on nesting dictionaries in a list. It basically told me to make 3 dictionaries about 3 people, nest them inside a list, loop ...
-3
votes
2
answers
199
views
Python for loop: array unpacking vs range deconstruction
I'm following a data structures and algorithms course taught in Python at the moment and the instructor always opts to unpack arrays (well, lists) using a range functions (method 2 below) instead of ...
0
votes
2
answers
85
views
How to deal with constant error checking in C?
In C, I am calling many functions having to check if they worked. The code gets ~3x bigger because of it! An example:
char *myStr = malloc(sizeof(char));
if (!myStr)
return NULL;
Is there a more ...
-1
votes
1
answer
385
views
How to make this Python function for finding colourful numbers operate on any number?
A colourful number is one that includes no duplicates in the list of it digits + the products of the subsets of its digits. For example, the products of 263 are [2, 6, 3, 2x6, 6x3, 2x6x3]. These are ...
0
votes
2
answers
479
views
ImportError: cannot import name 'legacy_round' from 'textstat.textstat'
I am trying to import legacy_round from textstat as follows:
from textstat.textstat import textstatistics,legacy_round
But I get following error:
ImportError: cannot import name 'legacy_round' from '...
1
vote
0
answers
15
views
issue in code structure when trying to divide components to logical elements
My team writes a url db.
I am making some restructuring to optimize in it. Since Im also going to be the maintainer of it, I thought of adding readablity refactors. However, I have a situation where ...