Fools ignore complexity; pragmatists suffer it; experts avoid it; CREATIVES remove it.

Monday, September 24, 2007

Design Pattern Books

Sometimes you get all information you need in one book only, but sometimes, even including all information directly from core, it's possible that book has not been written best way it could do, I'm mean format.
if you ask me a good book about Design Patterns I would like to suggest two, first one it's the bible:

I'm used to say if you want to learn about C start reading “The C programming language” from Kernighan and Ritchie or if you want to learn about C++ start reading “The C++ programming language” from Stroustrup because those books are bibles written by creators of those languages; to learn with creators really works for me, the same can be said about Design Patterns, you can start reading the book above, after a first contact with idea, in order to get some fluency, you will need practice, more research and more samples, internet is full of them, but you know internet is a free land, so take care with pseudo gurus; in order to help you, I would like to suggest a second book about patterns that worked for me, this second book has a practical approach, I love practical things, less academic, the only bad point about this book is about language, they have been using Java, I’m not a Java programmer but if you know C++ or even C+# and OO you can read without any reserve.

I've friends that confessed me they ignored this book because the cover, don’t do that, it’s a nice book!
Keep studying and keep creative.

Another very very nice work, this time, they've provided codes in other languages and all kind of examples; really excellent job.

Design Patterns: Simply


Good reading!

Thursday, September 20, 2007

Float random in 15 minutes

I was reading Gamasutra website when I saw an interesting job offer, please check out, http://jobs.gamasutra.com/jobseekerx/viewjobrss.asp?cjid=12163&accountno=219
I couldn't avoid write that function they are describing in the first part of test.

* The function rand_FloatRange(float a, float b) returns a random float number, 'x', such that a <= x <= b.

I’ve decided to invest 15 minutes from my spare time, so after 5 minutes trying the conventional approach I just decided change strategy in order to make that function work in the last 10 minutes; Pressing creative button all became clear: we need to return a number that needs match AB range, the difference between A and B can be considered a distance as well, a percent, that was my approach:

float rand_FloatRange(float a, float b)
return ((b-a)*((float)rand()/RAND_MAX))+a;

All I did was transform conventional rand() in percent, now that I’ve a percent I can apply that to range between A and B, it doesn't matter if they are negative or positive values, easy, huh?

that’s all!!! nothing bad for 15 minutes

Keep creative!