Relative Content

Tag Archive for coding-style

Is there an excuse for short variable names?

Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. This has become a large frustration with the codebase I’m currently working in; many of our variable names are short and undescriptive. I’m the only developer left on the […]

How properly perform passing operation result to View

I’m developing web site on self made MVC engine.
I have actionController that handles operations like register, login, post submit and etc. actionController receives operation name and parameters.
Of course it mast handle errors such user with same nick already exists or password is to short about which action handler have to notify user. The question is which is the best way to organize errors, such that View could easily get localized user notification message.

Single statement non-braced ifs and code merges [duplicate]

This question already has answers here: Single statement if block – braces or no? [closed] (17 answers) Closed 11 years ago. I’ve seen code merges being used as an argument for bracing even single statement ifs. For example: if (condition) { do something; } Unfortunately I can’t think of a change that would break a […]

Commenting regular expressions

Are there any common practises for commenting the regular expressions: inline comments referring different part of RegEx or general comment for all expression?

“static” as a semantic clue about statelessness?

I’ve recently undertaken a refactoring of a medium sized project in Java to go back and add unit tests. When I realized what a pain it was to mock singletons and statics, I finally “got” what I’ve been reading about them all this time. (I’m one of those people that needs to learn from experience. Oh well.)