A89: Re: Re: Re: Re: A Address book With Some Real Problems


[Prev][Next][Index][Thread]

A89: Re: Re: Re: Re: A Address book With Some Real Problems




Hi!

> From that point of view, you did an AMAZING job =)

See, I am not a programmer: I am a hacker. In other words, I write
programs just for fun. And I like to make programs for which I can
not get any profit (I know that this is stupid, but that's me...).
So, I like to do reverse engineering, etc. I like programming on
limited platforms like calculators, microcontrollers, old computers
with 16 kb of RAM memory, etc.

> I'll be looking forward to catching you on the SDK mailing list
> within the next few days, then.  When I get a chance, I'll send
> you a private message with various comments =)

Well.

> Well, you sure are very, very good at pulling off a lot of 
> "tricks" in C that someone who targets exclusively more 
> sophisticated platforms - like x86 - would never learn of.

Yes. But, I am 32 years old, and I have 18 years of programming 
experience. I started to program on very very limited platforms
(more concrete, on Sinclair ZX Spectrum). So, when I start to
program on x86 platform, I already learned about everything I need
to know about limited platforms. Later, when I have my first PC
(12 MHz AT), I wanted to wrote an emulator of ZX Spectrum which
can have full emulation of the hardware and which will work on
full ZX Spectrum speed on my 12 MHz computer. I suceed to do this
(of course, in pure assembler, with lot of dirty hacks like
self-modified code, etc.). More precise, I suceed to achieve 88%
of the original speed. 14 MHz machine were necessary for full
speed (note that ZX Spectrum worked with 3.5 MHz Z80). This work
gives me a lot of dirty-hacking experience too.

> I know that you're a professor somewhere, but how did you first
> learn to do all this?

As you can see, the fact that I am professor does not help me to
knowing dirty tricks: in fact, I learned dirty tricks when I was
secondary-school student, from other boys which learned dirty
tricks, and from computer magazines which were full of dirty tricks
before about 15 years (today, who cares about optimizations?)

About professors: when I was on Faculty, all professors learned
me only how to make simple school-style programs (in fact, nothing).
And, something for fun: when I was in secondary-school, our
professors of programming were extremely stupid. In this time,
programming was a young discipline, so many programming professors
were just pre-qualified professors of mathematics of physics, who
need to learn every lesson before teaching it to us. Just an example:
when I was 1st class of secondary school (i.e. when i was 14), I
have an exam with the following task: "Calculate the sum of all
elements on the diagonal of 10x10 matrix (in Basic)". I wrote:

S=0
FOR I=1 TO 10
S=S+A(I,I)
NEXT I

But the "professor" says: "How you can be so stupid? We learned
that 2-dimensional arrays must be accessed using two loops! So,
the correct solution is:

S=0
FOR I=1 TO 10
FOR J=1 TO 10
IF I=J THEN S=S+A(I,I)
NEXT J
NEXT I

You can't learn anything! You are stupid!"

I think that my professor (in 1st class) were very clever, isn't
it? Making O(N^2) algorithm from O(N) algorithm is really very
clever idea ;-)

And most of today professors in my surrounding are stupid (well, 
not so stupid, but stupid however).

> I certainly think coordinates should typically not just be magic
> numbers. For instance, if each request box were 10 pixels high, 
> and the top one is at a 15 pixel offset (I don't feel like getting
> the exact numbers from Rob's code), why not use something like the
> following:
> 
> #define VERTICAL_OFFSET 15
> #define VERTICAL_INCREMENT 10
> 
> and the y coords would be:
> 
> 1*VERTICAL_INCREMENT+VERTICAL_OFFSET
> 2*VERTICAL_INCREMENT+VERTICAL_OFFSET
> 3*VERTICAL_INCREMENT+VERTICAL_OFFSET
> . . . etc. . .
> 
> See, no more magic numbers!  I actually find using something like 
> this much simpler to write, and it prevents simple precalculated
> math errors that many of us have learned to avoid the hard way.

I forgot that I am too lazy for writting so much ;-)

> Didn't say it can't be explained, I just think that other things
> should be taken care of first.

Right.

Cheers,

Zeljko