Subject: Doc Oz Episode Clip: Top Rated Ep (5/15)

From: Caleb <[email-masked]>
Date: Wed, 21 May 2014 10:52:43 -0700

DocOz has begun his Fat-Melting Countdown to Memorial Day
Episode # 508

Continue eating what you want and erase inches off waist and trouble areas.

You read this correctly... Continue eating sugar, salt and carbs 
and drop 1lb per day.

Outsmart your metabolism with this: / http://www.jusmead.com/docoz/episode/recap/meltingFat.video

- Remember Memorial Day is a few weeks away, and you could be 15 lbs lighter by then.

- The DocOz Show -
Episode Archives -> http://www.jusmead.com/docoz/episode/recap/meltingFat.video 

setting changes can be requested to: Urgent Info Services 
3205 Lake Sarah
Independence, 
MN 55359- http://www.jusmead.com/snfo3/sgjvo40.bgno4

 for a beginner question that actually demonstrates what you have tried, and your thought process.   Chris Laplante Apr 27 at 23:02
13	  	
Generally, the length of good code is proportional to the length of the english describing what it does. So when your "specification" says 11-20, 31-40, 51-60, 71-80, 91-100, you can expect your code to mention those numbers also. If those numbers come from somewhere or were generated by some reason, see if you can code the reason rather than the numbers.   luqui Apr 27 at 23:10
3	  	
@luqui Thanks for this, I haven't heard of that philosophy before. I've repeatedly fallen into the thought process of "Man, I could make this a lot more efficient and a lot smaller." and I assume that my code is bad. Perhaps I am discounting how important readability is. I guess there is a balance that I'll have to work on.   user3419168 Apr 27 at 23:21
34	  	
@user3419168: The compiler cares not a bit how readable your code is; it will compile it in a fraction of a second. But for the humans reading your code, the choices you make can cause it to be comprehended in seconds, minutes, hours, or never. This imposes a cost; people get paid to read and understand code, so make it easy on them. Always write production code to maximize readability, and remember that concision does not necessarily make code perform better.   Eric Lippert Apr 28 at 3:15
8	  	
This is a decent question, and I don't want to take anything away from the poster at all, but this does not deserve 500+ points. This is how we end up with some of the nonsense we do with people with thousands of points appearing to be authorities here. (Feel free to move this comment if it belongs elsewhere.)   GaTechThomas May 1 at 21:08@user3419168, just by itself it leaves one to wonder what in the world it means. It gives no hints as to what in the world its trying to do. That's why in the edit I showed a version that splits the logic into a function which makes it clearer what the calculations are actually doing.   Winston Ewert Apr 27 at 23:14
3	  	
It may be prudent to also assert num >= 11 as (1) that lower limit is proscribed, and (2) % on a negative number returns a negative number as well. (I must admit using & 1 here is "safer" but also assumes additional knowledge.)   Jongware Apr 27 at 23:26 
2	  	
+1 for the Edit, it gets into the why of the list of ranges and presents it in a readable manner. IMO, one step up would be to wrap the getRow(num) % 2 == 0 in a function as well to make it crystal clear what the intent is. bool inEvenRow(int num){ return getRow(num) % 2 ==0;}   Mr.Mindor Apr 28 at 14:43 I'd still go for the clever code, but turn it into maintainable code by extracting functions. It would be just as readable if that last bit said && isTensDigitOdd(num), perhaps with a comment before the function definition explaining what it does. If such a pattern exists, a comment explaining the reasoning for the pattern is enlightening for maintainability imo.   chris Apr 28 at 2:39 
3	  	
Chris, that's a great strategy when the "cleverness" has a clear advantage: much shorter code (which means less chance of a typo, especially if it changes), or a large improvement in efficiency. There's almost always a tradeoff between brevity, clarity, and efficiency, and finding a good compromise is a great skill to develop. (2151844/29157 for a snicker.)   Adam Liss Apr 28 at 12:55
1	  	
This is a much better approach. So much easier to understand than the 'clever code' and the performance difference is probably negligible.   user1477388 Apr 28 at 13:19 
  	  	
@AdamLiss, Yes, my opinion is of little value as I haven't had enough experience to see the repercussions of these decisions. I'm sure I will soon enough, and I'll be sure to get a second opinion if needed.   chris Apr 29 at 5:40
1	  	
Don't sell yourself short. Your instincts are very sensible, and you seem eager to keep learning. Every opinion is valuable if there