Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 29029

Programming Practices are the commonly or not so commonly used practices in development of software. These can include things like Agile Development, Kanban, Coding shortcuts, etc.

5 votes

Is it better to have separate functions or add more arguments to a function?

This depends on the context. Both options have its pros and cons and tradeoffs are to be made. Both at once Freedom of choice - allowing setChannelOneVoltage(220) as well as setVoltage(1, 220). Ev …
Konrad Morawski's user avatar
13 votes
Accepted

Unit testing of non-atomic methods

If getNumberFromMordor and makeSomeOperation are public, they should be tested by themselves, so your unit test should not doublecheck that getNumberFromMordor works correctly. Only test what SomeNo …
Konrad Morawski's user avatar
4 votes

Is throwing new RuntimeExceptions in unreachable code a bad style?

I don't know if there's a convention. Anyhow, another trick would be to do like so: private <T> T rethrow(Exception exception) { // or whatever it actually does Log.e("Ouch! " + exception.g …
Konrad Morawski's user avatar
12 votes

Stacking keywords on top of each other - poor style?

I'd say I'm against it. I'll come around and add some code after try...catch without noticing that I should have extended the scope of lock. And, more importantly, this version doesn't really reduce …
Konrad Morawski's user avatar
4 votes

Is using hashes for primary keys a good idea?

Hashes will inevitably collide if they're smaller than all possible combinations of data. See this excellent answer: https://softwareengineering.stackexchange.com/a/145633 If primary keys are not s …
Konrad Morawski's user avatar
6 votes
2 answers
334 views

Any recognized convention for repository changelogs?

We use TortoiseSVN, but we have no bug tracking system. I know, lame, but beyond my control. There were times when svn wasn't in daily use. Now I've had succeeded in pressing for using it regularly, …
Konrad Morawski's user avatar
34 votes
8 answers
14k views

Is throwing an exception an anti-pattern here?

I just had a discussion over a design choice after a code review. I wonder what your opinions are. There's this Preferences class, which is a bucket for key-value pairs. Null values are legal (that' …
Konrad Morawski's user avatar