Timeline for Avoid too complex method - Cyclomatic Complexity
Current License: CC BY-SA 3.0
31 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 20, 2016 at 13:48 | history | protected | gnat | ||
May 20, 2016 at 10:07 | answer | added | Arides | timeline score: 1 | |
Mar 8, 2016 at 15:06 | comment | added | Arturas M | Quite honestly, your original code looks understandable, but I can't understand anything on your new code just by looking and taking more time than on the first case. The purpose of those rules is to reduce complexity and increase code readability, yet in this case it makes it just more complex, so I wouldn't say this is like overengineering (doing too much engineering for something real simple and therefore making it more difficult and more prone to errors...) | |
S Dec 22, 2013 at 22:10 | history | bounty ended | Community Bot | ||
S Dec 22, 2013 at 22:10 | history | notice removed | user53019 | ||
Dec 22, 2013 at 17:50 | comment | added | Random42 |
TimeUnit from JDK has most of the implementation you want, with the exception of converting to Weeks. And you definitely do not need a specific class for each converter.
|
|
Dec 22, 2013 at 17:08 | answer | added | user53019 | timeline score: 0 | |
S Dec 21, 2013 at 1:43 | history | bounty started | Community Bot | ||
S Dec 21, 2013 at 1:43 | history | notice added | user53019 | Reward existing answer | |
Dec 15, 2013 at 18:37 | history | edited | asyncwait | CC BY-SA 3.0 |
Added 3rd update as a closing note
|
Dec 15, 2013 at 18:32 | vote | accept | asyncwait | ||
Dec 15, 2013 at 18:32 | comment | added | asyncwait | Though I added my update, it is only that much worth the time. I am going to move on since Sonar now does not complains. Don't worry much and I am accepting the mattnz answer as it is the way to go and don't want to set a bad example for those who bumps on to this question. | |
Dec 14, 2013 at 12:03 | audit | Suggested edits | |||
Dec 14, 2013 at 12:05 | |||||
Dec 3, 2013 at 21:32 | comment | added | mattnz | Re Update: Am I the only one who is has "Over Engineered" ringing in my head? | |
Dec 2, 2013 at 22:17 | answer | added | Gwozdziu | timeline score: 0 | |
Nov 28, 2013 at 15:42 | history | edited | asyncwait | CC BY-SA 3.0 |
Added some update on where the problem stands now, more updates to come on this..
|
Nov 28, 2013 at 7:32 | comment | added | user22815 | I agree with Jimmy Hoffa: when I see a construct like this, I see if a map of some type can replace it. | |
Nov 26, 2013 at 11:55 | answer | added | gnat | timeline score: 4 | |
Nov 25, 2013 at 22:21 | history | tweeted | twitter.com/#!/StackProgrammer/status/405098856733745152 | ||
Nov 25, 2013 at 21:46 | history | edited | FrustratedWithFormsDesigner |
edited tags
|
|
Nov 25, 2013 at 21:37 | comment | added | Jimmy Hoffa | The appended code leads me a little further towards a simpler implementation: Your actual variance is the multiplyer. Create a map of these: Pull the alpha characters from the end of your sValue, use those as your key and then pull all until the alphas from the front for the value which you multiple by the mapped multiplyer. | |
Nov 25, 2013 at 21:26 | answer | added | mattnz | timeline score: 45 | |
Nov 25, 2013 at 21:26 | answer | added | Ampt | timeline score: 16 | |
Nov 25, 2013 at 21:17 | comment | added | asyncwait |
Added a sample for for ExtractBlah method. I will create a gist in a while
|
|
Nov 25, 2013 at 21:17 | history | edited | gnat |
http://programmers.stackexchange.com/questions/219482/avoid-too-complex-method-cyclomatic-complexity#comment435746_219482
|
|
Nov 25, 2013 at 21:17 | history | edited | asyncwait | CC BY-SA 3.0 |
Added more explanation
|
Nov 25, 2013 at 21:13 | comment | added | gnat |
how are ExtractBlah classes defined? are these from some library or homebrew?
|
|
Nov 25, 2013 at 21:07 | comment | added | asyncwait | Would love if you could spare sometime on "monadic parsers" and how it can be applied to pretty small function like this one. And, this piece of code is from Java. | |
Nov 25, 2013 at 20:55 | answer | added | FrustratedWithFormsDesigner | timeline score: 1 | |
Nov 25, 2013 at 20:54 | comment | added | Jimmy Hoffa |
Easiest OO answer offhand: private static Dictionary<string,Func<string,long>> _mappingStringToParser; I'll leave the rest as an exercise for you (or someone with more spare time right now than I). There's a cleaner API to be found if you have any familiarity with monadic parsers but I won't go there right now..
|
|
Nov 25, 2013 at 20:41 | history | asked | asyncwait | CC BY-SA 3.0 |