A realization.
Jul. 22nd, 2003 08:45 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Yesterday, while at work, I had a mission. It was a simple one: hook up a query to a database, show the results of the query-- a list of names-- to the user, and let the user pick one.
It took me about 45 minutes to hack a basic system. I even did it using a new chunk of technology (the Python iterator system, new in 2.2) that saved me a whole lot of memory (which was useful, since I could now burn that memory for caching results of associate queries, which made follow-on main queries faster... it's all very geeky). Since it's a web application, the back end was python, the front end HTML and Javascript, with a few style sheets tossed in for good measure.
I also did it using a heavily functional style (there are four basic programming paradigms: procedural, objective, functional, and the one Forth uses that nobody really understands...). Python lets you write in all of the above styles (except the Forth one). One of the programmers who took over my job while I was gone on vacation looked at the code and said, "I would never have gotten there that way."
I asked if there was something wrong with my code. He said there wasn't, and that was his point: there wasn't a wasted line or an unneeded side effect anywhere in the code. I'd gone from raw data to correct output in a very readable way without doing anything extraneous that could introduce errors.
And then I had this realization: This is what they pay me for. The years of programming experience and the depth of knowledge about HTML, CSS, Javascript, Python, C, C++, and so on are important, but it's the ability to apply those quickly with precision and concision that keeps me employed. It's the ability to understand that the task really is about data-in, data-out, while filtering the garbage, and to know exactly what tool will do the best about filtering the garbage and arranging the rest for the human eye.
It was kind of neat, after a long bout of self-doubt, to realize what it is about my progamming abilities, particularly, that makes me economically valuable to other people.
It took me about 45 minutes to hack a basic system. I even did it using a new chunk of technology (the Python iterator system, new in 2.2) that saved me a whole lot of memory (which was useful, since I could now burn that memory for caching results of associate queries, which made follow-on main queries faster... it's all very geeky). Since it's a web application, the back end was python, the front end HTML and Javascript, with a few style sheets tossed in for good measure.
I also did it using a heavily functional style (there are four basic programming paradigms: procedural, objective, functional, and the one Forth uses that nobody really understands...). Python lets you write in all of the above styles (except the Forth one). One of the programmers who took over my job while I was gone on vacation looked at the code and said, "I would never have gotten there that way."
I asked if there was something wrong with my code. He said there wasn't, and that was his point: there wasn't a wasted line or an unneeded side effect anywhere in the code. I'd gone from raw data to correct output in a very readable way without doing anything extraneous that could introduce errors.
And then I had this realization: This is what they pay me for. The years of programming experience and the depth of knowledge about HTML, CSS, Javascript, Python, C, C++, and so on are important, but it's the ability to apply those quickly with precision and concision that keeps me employed. It's the ability to understand that the task really is about data-in, data-out, while filtering the garbage, and to know exactly what tool will do the best about filtering the garbage and arranging the rest for the human eye.
It was kind of neat, after a long bout of self-doubt, to realize what it is about my progamming abilities, particularly, that makes me economically valuable to other people.
no subject
Date: 2003-07-22 04:12 pm (UTC)The fourth "Forth" style is stack-based. It's the same one PostScript uses. For instance,
will print out 27 (the is the print command). Its advantage is that it's very simple and easy to implement.But functional is my preference. If you're really interested in the functional style, you should check out Haskell (http://haskell.org/).
no subject
Date: 2003-07-22 05:27 pm (UTC)When it costs almost nothing to do a function call, you can factor away with no loss of runtime performance but all the benefits of ease of interactive testing.
Jump To Subroutine!
Date: 2003-07-23 04:16 am (UTC)The Forth paradigm includes a hugely minimalistic style: originally, you were limited to a 40x80 character block for your main program, and it was considered the ultimate in good form to have your subroutines be one-liners. The handful of us who learned Forth as our first language tend to bemuse the rest of the programming world.
It's also all reverse-polish, stack-based, parentheses are used to denote comments, and all variable names are just literals pointing to memory. And it can be interpreted, which was evidently rare back in the day. You can put entire Forth systems on little processors and develop on them. (That's what my father used to do for a living, which is why I was taught Forth at the tender age of 11.)
Re: Jump To Subroutine!
Date: 2003-07-23 05:36 pm (UTC)If you want to see what the inventor's done with it, see http://www.colorforth.com/
I particularly like the IDE disk driver in five lines of code.