Linked Questions

2
votes
1answer
1k views

Callback functions: Semantics and maintainability, when they aren't necessary [duplicate]

Within the context of JavaScript/Node.JS; Will using Callback functions improve the maintainability of source code, when there is no need for async programming? For example does the plain code sound ...
1
vote
1answer
231 views

Metrics that measure the readability of the function

Functions are the first line of organization in any program.I believe writing them well improves the readability of code to some extent.I am working on metrics that describe how readable the function ...
1
vote
1answer
363 views

Does this anti-pattern have a name?

Here is a piece of cool code to add the two integers, a and b: NameService nameService = NameService.getSingletonInstance(); OperationService operationService = nameService.resolve(OperationService....
1
vote
1answer
2k views

Structure Code with curly brackets

Is it a good style to place curly brackets around logical parts of sequential code to structure it? An advantage would be, that you can collapse these blocks in an editor like vim and get a better ...
1
vote
1answer
311 views

Refusing to define 2 or more classes in one .cpp file [closed]

In my company there is implicit rule not to define multiple classes inside one .cpp file. The argumentation is that it looks like a mess and hard to read. But in my opinion it will make sense if the ...
1
vote
1answer
256 views

Is there a common set of best practices for passing anonymous functions as arguments?

This is a generic question about using anonymous functions as arguments to other functions. I give an example in Python, but the question is not about Python (and I'm particularly interested in ...
0
votes
1answer
282 views

Formalising algorithms - Greek symbol uses/sources [closed]

I am looking to formalise an algorithm that I have created, however, I am having trouble knowing how to correctly use Greek symbols (such as Epsilon, Omega etc.). Are there any guides/standardised way ...
0
votes
1answer
261 views

What'd be better? To add one more local variable, or to call a method twice in general case?

I have the method which returns java.util.Date inside the hibernate-entity class: package ua.com.winforce.loto_partner.commons.db.entity; @Entity @Table(schema = "pr", name = "publice") public class ...
0
votes
1answer
370 views

How to choose between different ways to write some code?

I would like to validate point in a two-dimensional rectangular Cartesian coordinate. I found following regular expression solution on stackoverflow ^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$ . Another ...
0
votes
1answer
159 views

Method Parameters Ordering [closed]

I was recently changing a method to add in an additional parameter, and I couldn't help but wonder if there were "best practices" or "generally accepted rules" in deciding what order parameters of a ...
0
votes
1answer
726 views

Method size in an OOP language, for instance - in Java [duplicate]

Possible Duplicate: What should be the maximum length of function In Java (and I think in other OOP languages too) it is recommended to keep class methods as short as possible. While I ...
-1
votes
1answer
116 views

Iteration inside a using or using inside an Iteration

Is there a best practice for iterations inside of a "using"? which is better? and maybe a why? "using" inside of an iteration... foreach (var currentPerson in Persons) { using (var db = new ...
-3
votes
1answer
849 views

Best practices: Number of return statements [duplicate]

I'd like to ask about best practices on return statements. So, what would be more preferable, something like... ... String r = null; if(var != null) { r = "NOT NULL!"; } return r; Or something ...
4
votes
0answers
158 views

Should the order of definitions correspond to the order of declarations in header/source files? [closed]

If my header looks like this: class foo { public: foo(); ~foo(); QString b(); QString c(); QString a(); void setB(QString s); void setC(QString s); void setA(...
0
votes
0answers
139 views

Does the term “readability” refer also to the transparency of code functionality? [duplicate]

Question: Does the term "readability" refer also to the transparency of code functionality? For Example: I read that a downside of Dependency Injection is a sacrifice to readability. The idea being ...

15 30 50 per page