|
![](/i/fill.gif) |
On 22/10/2010 02:41 PM, Invisible wrote:
> To use it, just unzip everything...
Speaking of compression: This is about 35KB of source code, yet 7zip has
squished it into an 11KB file. That's about 68% compression. So half of
what I wrote was "necessary". ;-)
It's ironic really. Writing a program that *does* Huffman compression is
fairly trivial. Writing a program that *demonstrates* Huffman
compression is quite non-trivial. _Especially_ in an untyped, rather
promiscuous language like JavaScript. Man, so many global variables! >_<
Not to mention that function names are global too. Yuck!
So yeah, the program is just a tad buggy in places. I think I could
probably improve my abstractions though. I've already done that several
times
For example, originally the code for each step handled twiddling all the
buttons on and off, etc. Things became drastically easier when I
refactored the whole thing. Now I have a data structure representing
steps, and utility functions that handle moving to the next step, etc.
And a utility function that automatically reads this structure and does
the necessary things to the UI. Suddenly everything becomes much easier.
But hey, we all know that having the right abstractions is critical to
computer programming, right?
I remember when programming a computer required serious tools. Like, we
Windows installed, and nothing else, and write stuff like... well, this.
(IE doesn't support SVG yet though, does it?) You'd have to use Notepad
of course [*shiver*], but you can now program a computer with almost
nothing other than what comes with the OS.
(Of course, if you install Linux you probably get GCC by default anyway.
:-P Along with software for every imaginable task, most of which you
don't want and can't remove...)
Anyway, I'm going to go away and ruminate on this for a while now. No
doubt I'll end up rewriting the whole thing yet again, and it'll be even
bigger and better. It's how I work. I call it "iterative prototyping". ;-)
Post a reply to this message
|
![](/i/fill.gif) |