Questions tagged [readability]
Readability measures how easy code is to read and understand.
207 questions
8 votes
9 answers
6k views
Does it make sense to keep two different versions of code?
I am developing projects for my private use and have been wondering how I should design my projects. I always try to keep the code as efficient and concise as possible and as readable as possible. ...
0 votes
2 answers
1k views
C# readability - async/await or return for wrapping asynchronous functions?
Say I have an asynchronous method: public async Task DoThing(int x) { // ... } Now, I want to wrap this method with a new method. Each of these two options are functionally equivalent: public ...
3 votes
4 answers
2k views
Representing vectors as arrays of points vs. as data structures
I'm writing a program in Java where I need to represent the position, scale, and other 3-dimensional properties of objects in a world using vectors. I can use either of these two approaches: ...
1 vote
2 answers
355 views
What is an appropriate length for function names? [closed]
I'm writing a C++ class, CBookSpellDef which has the following methods: int GetIndexOf(const char *psz); char* GetNameAtIndex(int index) { return m_spellTypes[index].szName; } char* ...
1 vote
0 answers
134 views
golang: pattern for handling message queues? Are named functions anti-idiomatic somehow?
Had a discussion today in how to implement services that work with messages coming in from event queues. We call these services processors. One of us argues for using several functions, while the ...
4 votes
2 answers
3k views
Should a method modifying object passed as a parameter return the modified object? [duplicate]
I have some incoming request - it's an instance of class generated from api specification - POJO with public getters/setters. I would like to normalize some values. For example dimensions (to use ...
2 votes
1 answer
674 views
Does "happy path to the left edge" break Python conventions?
I found the short article Align the happy path to the left edge quite helpful in improving readability of functions. Briefly, reading down the left edge of the function should step you through the ...
0 votes
3 answers
713 views
Should I send the current or previous state with my state changed event?
I have an event that is raised when my job objects change state (e.g. initializing, running, complete, etc). The event is to be invoked from my set method in the State property, but before I make it ...