Skip to main content

Questions tagged [coding-style]

Coding style is a set of guidelines that helps readability and understanding of the source code.

2votes
4answers
389views

How to combine multiple functions into a single template based function

Threre are two functions FindMaxDistanceVector and FindMaxDistanceList whose implementation is almost same except some debug information added in FindMaxDistanceList. Note that these two functions are ...
user146290's user avatar
0votes
2answers
325views

Which is better: a chain of OR statements or IF in a loop? (Java)

Which code style is preferred in Java? final boolean result = isCausedBy(e, ExceptionType1.class) || isCausedBy(e, ExceptionType2.class) || isCausedBy(e, ExceptionType3.class) |...
Andriy Makukha's user avatar
-4votes
1answer
102views

Feedback on custom "Orchestration" architecture

I've been doing some deep thinking on how to structure code and found myself coming up with a (for me) new pattern. The pattern is based on a highly modular approach with a large focus on indirection, ...
Felix ZY's user avatar
1vote
3answers
269views

Considering IDE and text editor features when choosing a coding style

Recently, I had a debate with one of my friends on using type inference in C# (var keyword). His argument was that we should stick to using the explicit type names because "even with the ...
Zombies are Real's user avatar
2votes
3answers
199views

Is it still "feature envy" if the state to make decision or the action to take after asking the state involves other classes to participate?

According to https://softwareengineering.stackexchange.com/a/212130/432039, if a class asks another class for the state, and then call methods of that class, it is called "feature envy", eg: ...
wcminipgasker2023's user avatar
10votes
4answers
2kviews

Is the inability to find code by searching for a class name a reason to avoid using auto in c++ variable declarations?

According to https://softwareengineering.stackexchange.com/a/180616/432039 suggested, I know the answer advised "auto" should be used instead of the actual type when declaring variables. ...
wcminipgasker2023's user avatar
1vote
5answers
210views

End method in normal flow versus exception flow

Consider the two following examples: public Something fetchSomething(String key) { if(somethingsMap.containsKey(key)) { return somethingsMap.get(key); } throw new ...
steros's user avatar
6votes
4answers
3kviews

How do you honour the principle to only do "one thing" in a method in reactive streams?

Uncle Bob mentions in his book "Clean Code" that "[f]unctions should do one thing [...] only" and advocates that a method should stick to one abstraction level (I'd call it flight ...
Christian's user avatar
14votes
5answers
5kviews

How to "Tell, don't ask" when 2 objects involves in the condition and the decision at the same time?

According to Explanation on how "Tell, Don't Ask" is considered good OO, I know the following is bad: if(a.isX){ a.doY(); } public class A{ public boolean isX; public void ...
wcminipgasker2023's user avatar
0votes
4answers
396views

Code quality: expressiveness vs. conciseness

I've been wondering about code expressiveness vs. conciseness lately. What I mean by that is that a lot of modern programming languages offer features to express statements in a very short manner, ...
Sir Falk's user avatar
1vote
2answers
267views

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* ...
Bunabyte's user avatar
24votes
11answers
8kviews

Is it logical to not use inheritance because the function is critical?

Our codebase has a typical base-class with a ton of sub-classes. The base-class already has many default functions for the sub-classes. However, one particular function has the same verbatim ...
Zack Light's user avatar
0votes
1answer
240views

How to deal with very complex codebase? [duplicate]

I recently changed my job to a big MNC and the code I am exposed to is highly complicated, difficult to read and understand. Although it is divided in microservices and runs on local I have to keep ...
Surya Saini's user avatar
17votes
8answers
7kviews

How to be (more) critical during Code Reviews? [closed]

I'm a Software Engineer who sometimes need to review the code of my fellow team members. I often look at the source code and think; this looks fine. I'm having a hard time to think critical about it. ...
Jay's user avatar
  • 289
-2votes
3answers
902views

Common practice where to place "is" word while naming predicate function: at the beginning or in the middle?

There's a lot of free or member predicate-like functions (that returns boolean value) in different programming languages and popular libraries/frameworks that have "is" as a prefix, e.g.: ...
αλεχολυτ's user avatar

153050per page
close