2007/07/06

Point Class in C#

I originally intended to learn C#, and blog, while developing a fractal image generator. I figured a fractal generator would cover pretty much all the most used areas of application development: interface, text input, text output, algorithms for fractal generation, graphics output of the generated fractal, and, possibly, dynamic generation of the fractal during calculation. I soon landed myself in a bog, however, when I got stuck on just how I was supposed to translate somewhat esoteric (for me, at least) floating point calculations into iterative code. I got so distracted trying to figure it out the whole project came nothing. Nevertheless, in the end, I did learn something: RLC rule No. 1; Don't let the forest blind you to the trees.

Isn't the first rule of Agile development to break everything down into little chunks? Sure, I don't really understand the fractal formulas and I have little clue how to turn them into code, but there's a lot more to the application than the math engine. And even the math engine needs something to work on... something like a Cartesian point! Now, there's something I understand.

A Cartesian point, as a coding object, must have, at minimum, an X and a Y value, a constructor that takes no value, and a constructor that takes both an X and Y value. It also ought to be able to calculate its own distance from the origin. I'll talk later about what a fractal generator should do with this point but for now, here's a single tree I can work with.

As I seek help with my coding efforts from other bloggers and forums, I hope readers will come here to comment and help me develop as, well... a developer.

No comments: