Reputation
2,575
Top tag
Next privilege 3,000 Rep.
Cast close & reopen votes
Badges
12 18
Newest
 Quorum
Impact
~163k people reached

  • 0 posts edited
  • 0 helpful flags
  • 90 votes cast
2d
comment Is it still an antipattern if we log an exception message and throw a different exception?
I would stop you as soon as you logged ex.getMessage(), that's already wrong.
Sep
1
awarded  Quorum
Jul
24
comment Self Documenting Code Vs. Commented Code
@Trylks Besides, even if we take your example, you factor your check out into a method and call it, great. Now all you have to explain is why you need to check that the file is writable. :)
Jul
24
comment Self Documenting Code Vs. Commented Code
@Trylks That works for some cases but not for all. Imagine this scenario: for (int i = 0; i < length/2;i++) { //if length is odd, the middle element should stay in place. Now, this is neither something that is obvious from the purpose of the enclosing function, nor could it be factored out into its own function. If you leave it uncommented, that's clearly bad. So you add a comment to clarify your intent.
Jul
3
comment Self Documenting Code Vs. Commented Code
Once everyone agrees on the problem, I'm sure we could come up with plenty of solutions. And surely some languages suffer more than others, so the solutions will probably vary too.
Jul
3
comment Self Documenting Code Vs. Commented Code
@dallin That is true, on the other hand though, a short code block that is its separate function can be compartmentalised in your mental map of the code far more easily. Without the familiar formalism of a function declaration that task is a lot harder. Of course you can formalise your block comments too, but not everyone will adhere to your comment formalism. No problem, you can write a tool that checks the comment formatting. But how different will that tool be from the compiler? :)
Jun
27
comment Self Documenting Code Vs. Commented Code
but isn't it faster and easier to read the comment at the top saying what that section of code does and skip it altogether if it's not what I'm looking for It's called "the name of the method/function". If you've got a block of code that has no name but is so long that you can't take it in with one quick glance, maybe the problem lies there.
Jun
1
comment How to think as a C programmer after biased with OOP language?
I personally found most of C easy and straightforward, with the notable exception of the pre-processor. If I had to re-learn C, that would be one area I'd concentrate a lot of my effort on.
Feb
23
awarded  Nice Answer
Jan
18
awarded  Yearling
Sep
10
revised Is there any logical reason to auto-generate code documentation?
added 527 characters in body
Sep
9
answered Is there any logical reason to auto-generate code documentation?
Feb
20
awarded  Good Answer
Jan
18
awarded  Yearling
Jun
22
awarded  Necromancer
Jan
18
awarded  Yearling
Aug
20
awarded  Autobiographer
Jan
18
awarded  Yearling
Nov
21
awarded  Nice Answer
Aug
29
awarded  Nice Answer