Friday, February 29, 2008

Cien

Hundredth post! Yay!

Had an excellent lunch at Vermont St BBQ today. It's been a long time since I felt this satisfied in general. There is just something about today that is awesome feeling. I am definitely looking forward to a nap after work though.

I ran across one of my favorite programming blog posts again today. It had been a while since I last read it, so I gave it another go. I must say, The Kingdom of Nouns pretty much describes perfectly why Java now frustrates me. Admittedly, after working with it the last few months, I have come to tolerate it much better, but I do miss my Ruby/Erlang/Scheme fun.

In just 84 days my summer vacation starts. Woohoo!

Thursday, February 28, 2008

Thursday

It seems I only post on Thursdays recently. I wonder why.

Due to a minor issue on a query at work yesterday, I got to learn a lot about how mysql indexing works. It was fun and interesting. In the end, I think the whole thing will be a non-issue, but at least I got to learn some neat stuff along the way. For instance, the order you put fields in an index matters, because any fields after the field being used to sort can't be used in where clauses. There are just a ton of little nuances like that.

In my home time I have been working with Erlang a bit. I'm still in the uber-nub stage with it, but I am trying to make some progress. After all, I have this glorious four core machine, and I should put it to use with something. Also, I think Erlang seems like an interesting niche with a lot of opportunities to build interesting things. The Ruby space has matured so nicely since I started with it in 2005, hopefully the Erlang space can too.

The two languages seem to compliment each other so well too. Ruby is just so great for doing things quickly, and now that it has so many libraries to do things, it makes a great exploratory tool. Erlang seems great for another type of exploration, which is back end performance. One of my first experiments with it was comparing a simple factorial algorithm with a parallelized one. The difference is quite mind-blowing. I mean, all I did was cheat and make it calculate fac(N-1), fac(N-2), and fac(N-3) in child nodes all at once. This is essentially akin to increasing the branching factor of the recursion tree from one to three. But it definitely put more cores to use and finished faster on bigger numbers.

Like I said, I haven't done anything too exciting with it yet, but I have an idea for a webservice framework that I'd like to build (for my own projects, and maybe for open source consumption). The basic vision is write something to map Yaws requests RESTfully to Mnesia records or some SQL db. The cool part would be seeing how well it scaled. I think I could get some people at hacker news to hammer it with a script for a while to see how it went.

Non-programming news in my life mostly includes taxes and the doing of. How fun!

Thursday, February 21, 2008

(mis)Education

A recent confluence of articles on YC News have the topic of education in my mind a lot the last couple days. All this reading and thinking has brought something that has always bothered me back to my attention. To put it bluntly, the idea that miseducation at some level of development is acceptable.

Regardless of the position you take on any remotely controversial issue, be it political or personal, you have probably asked yourself at one time or another how the other side can be so naïve. Rest assured, they are thinking the same of you, but that is beside the point. I think the reason is that the vast majority of people don't think critically on any topic (myself included). What they do instead is adopt the beliefs of someone they respect for a different reason, be it their parents, a favorite teacher, their peers, or some charismatic guy on TV.

What I keep coming back to as I try and think about the topic of thinking critically (the meta-discussion-fu!), is that it only becomes societally acceptable after a certain age. Oh, the education mantra is to “foster critical thinking and problem solving skills” or some such newspeak, but the reality is that developing these skills is limited to safe questions. The need to maintain authority and not offend minority parties means that any non-safe question is off limits for critical thinking at a young age.

This starts early. Think about learning math as a kid. At some point, every kid asks why the heck they need to learn 'this stuff.' The teacher makes some vague promise that it will be useful later in life, hoping the kid is placated. If the child persists in asking why, one of two things occurs. The teacher either does some hand-waving about how math skills are necessary for a good job, or they tell the student to stop goofing off and get back to work. Neither is really a good answer in my opinion, because neither reply does anything to make math seem important. The idea of a job is as alien to a 12 year old as the idea that factoring polynomials is useful when calculating average case algorithmic complexity would be.

Jump to another subject. Your history classes, if they were anything like mine, were a series of gradual refinements of founding myths into the gritty reality of what actually happened. At a young age 'history' consists of stories like the Thanksgiving myth and the Pilgrims coming to America. It wasn't until sixth grade that we learned that there had been Europeans in the Western Hemisphere for over 100 years by the time anyone landed at Plymouth Rock. In my five year old mind, the Pilgrims made a daring voyage off the face of the earth, and landed alone and in an alien world. Later I learned that the reason our history education of the New World began with the Pilgrims is most likely because they were the first well-known group to come without the intention of war/profit/conquest. There is an idea that kids need to be handled with kid gloves, even if it's detrimental later on. I would say that at least 50% of every later class was spent unlearning something taught to us previously and learning a more realistic version. I say a more realistic version, because the new version was most likely to be contradicted the next semester.

As for English, this has been well said by Paul Graham in his essay on essays. The basic gist is that somehow writing got thrown in with literature, and so all the practice kids get at writing is about literature. (Or, if they had a decent history teacher that wasn't lazy and actually required essay exams, history.) How many teenagers do you know that give a flying crap about literature? How many teenagers do you know that care about music, movies, or relationships? If you actually remember being a teenager, my guess is you answered about one percent to the first question, and about 99% to the second question. So why aren't kids writing about music, movies, and relationships?

The answer is twofold. One is that these topics are considered insubstantial and too 'pop culture' for serious writing. But that is missing the point. The whole point of learning to write is to be a good writer (regardless of the subject). To learn anything you have to practice, a lot. Wouldn't someone be much more likely to practice if they wrote about something that interests them? I never practiced basketball, and I consequently sucked at playing it. I did, however, spend a lot of hours in high school programming, and I'd like to think I became fairly good at it.

The other half of the answer is that the situation is habitual. Writing instruction has involved writing about literature for as long as anyone can remember, and if was good enough for our parents, it's good enough for us.

To me, the root of all these problems, and probably a few that I am missing, is that kids are taught, rather than encouraged to learn. At some point, fairly quickly (I remember having the realization in fifth grade), the whole school game becomes a meta-game. The objective ceases to be about curiosity and learning, and starts being about how to get the best scores. To get the best scores you have to learn the material, sure, but that only means learning the material you know will be on a test.

The greatest evidence for this mindset is in a college course. (Time to assault the Ivory Towers.) If you walk in to any undergrad course on the day before a major exam, you can tell within five minutes how interesting the class is to the students. If the class is really exciting and stimulating, the day before the test will be spent in a discussion on some topic related to the material, like any other day. If the class is (far more likely) boring and simply something to check off on your planning form, the students will spend the day pleading to know what every single question on the test will be. They will ask what to study, how many points each section will be worth, whether the scores will be curved, whether there will be extra credit, and so on. I feel sorry for the professor because, even if he doesn't consciously realize it, he is experiencing a conniving interrogation for insider knowledge that even the most seasoned Presidential Press Secretary would have trouble dancing around.[1]

The students probably don't realize what they are doing either, because they have done it for so long. They are subconsciously calculating many things at once. Foremost of these is: “What do I need to study to maximize my score?” but they are also considering how much effort to expend on studying, what kind of grade to expect on it given past experience, and a myriad of other meta-considerations. No where in all this thought is the subject of the course. Students are extremely good at the game of being a student, and generally much less good at whatever their major happens to be.

There are always those students and courses that defy this. I think my functional programming class was the most horribly administered course with the most boring lecture in my entire undergrad career, but it's still my favorite class, because despite all of that, the topic was interesting. I went above and beyond on every project in that class. It was one of the few classes that I didn't bother keeping a running spreadsheet of my grade. I knew I was kicking ass, because I thought about it all the time, even in other classes. My girlfriend feels the same way about organic chemistry.

This meta-education mentality all flows out the critical thinking duality. Specifically, the ability to think critically and question assumptions is turned off in students around the time they begin playing the meta-game of education.

It's moderately necessary, to maintain order in the holding pens we call schools, that the students don't realize they are being held. What you do is keep them busy. So classes are structured like lectures, where a bunch of facts or processes are given to be remembered, with the implicit assertion that these facts and processes will be on a test in the future. This system is great for teaching X facts in Y time, with minimal deviation, and getting score Z on some standardized test.[2] Some 'educators' take the theory even further, assuming that, statistically, a student will remember roughly half of what they are 'taught,' so they just add in more facts in the hope that more stick. I had a professor admit to this once.

Extracurricular activities help too. Almost every kid defines himself by what group he belongs to, and these activities provide an approved means to be part of a group, without the risks (violence and exclusivity) inherent in naturally forming groups (gangs and cliques). Far from criticizing these activities, I'd argue they are equally, if not more, important as the classes themselves. Social development is just as important as intellectual development. But these activities also provide a distraction, which is convenient. The distraction is from the fact that school itself is boring and seems pointless.

How would you fix this? I'm not an expert on the theory of education, but maybe that helps. To me, you do the obvious thing. Make school not boring and not pointless.

To be more explicit, I think the problem is that we are scared to challenge kids. A list of facts on a board are not challenging to students. You have to give them something that forces them to try and beat the problem. It has to be hard and interesting. Kids will rise to the challenge, because they will feel like they have accomplished something at the end. Something besides a good grade. Suddenly the subject is interesting again, rather than the meta-game.

Going back to the question about the utility of math, the teacher could respond with some demonstration of how it is useful to the kid today. Make an obstacle course for the class, with the one rule that they must pass through each obstacle at least once, but can do so in any order they choose, as long as the end up back where they started. The person with the fastest time wins. Bam, you have just got them thinking about the Traveling Salesman Problem[3], a famous problem in combinatorial complexity and graph theory, without even realizing it. Instead of teaching the kids the optimum solution to the problem (which would be pretty hard with the TSP anyway ;), ask them for ideas on the best way to solve it, write down the ideas on the board, and let the kids discuss it.

If you start this out of the blue, you'll have a lot of kids just ask straight out what the right answer is. They are used to being told the right way to do something, and have become quite dependent on it. Thankfully the TSP has no 'correct' answer so far as we know, so you get off easy here. But even if you knew the answer, you wouldn't tell them. The point is to get them to realize that they can find the correct answer on their own. It's a confidence issue.

For a writing assignment, try getting the kids to teach themselves something. The whole reason I write long somewhat meandering things like this is to try and organize my thoughts on something. Putting it out there for others to read just keeps me honest, and provides a risk factor, in that maybe someone will poke big holes in my thoughts. I am generally interested in nerdy things, so I write about nerdy things, not English literature.

Once kids get out in the real world, being able to think critically about a subject and modify their own assumptions are crucial skills in being an informed adult. So many people make political decisions based on gut feelings or a persuasive argument, but never sit down to examine the reality behind the issue. How many people do you know that think the national debt is the mark of doomsday, yet don't actually understand how a fiat currency system works? I was in that camp myself until I took the time recently to really study it. My amateur (slightly more informed) conclusion: macroeconomics is almost entirely unintuitive under the fiat system, and a lot of things deemed bad or good by the general public are in fact the opposite.[4] But that is a topic for another day.

It all boils down to our education system teaching facts to students, according to some standard, rather than teaching students to enjoy learning. To abuse a parable, it's like giving a man a fish every day instead of helping him become a fisherman. How is it logical to expect someone to catch fish just because they have eaten a lot of it? How is it logical to expect kids to want to learn, when the only reason we give them is that it will be 'useful someday.' How do we expect adults to think critically and question their own assumptions if those abilities are disabled during childhood?



[1] I may have just found a good way to pick out interesting electives. back

[2] But do they realize that the facts will only be remembered for time T? back

[3] http://en.wikipedia.org/wiki/Traveling_salesman_problem back

[4] Revisiting the Liberal Agenda. Note that this title uses the word 'liberal' in the classical sense, which is different than how it is used today. Liberal is this case is about both economic and social freedoms. Neither party today is very liberal in this sense. back

Thursday, February 14, 2008

Cryptorchild

Went and saw Manson on Monday night. It was a blast. Harry posted his review, which I generally agree with, so I'll save you the babbling.

This week at work has been great. Ken gave us a deadline, and that has put me into overdrive. I love deadlines. Maybe it's the effect that school had on me, but I work best with a deadline. Especially a close one. Much has been accomplished. It mostly forced me to just finish up the tables I have instead of looking for ways to refactor. I like the refactoring better, especially since I still have a half dozen things I'd like to tackle, but it's easy to put off the tables themselves without a deadline for them.

I haven't been doing much in the spare time other than play dota, read, or sleep. I need to go back and visit my grandpa and parents this weekend. It has been like three or four weeks, and with grandpa in the hospital lately, that seems like quite a while. I have just been sick and reluctant to visit in case I infect him. I hear he has been moved to a rehab facility that is quite nice, so hopefully things are improving for him now. (He just had some very major open heart surgery at 75.)

Tomorrow is February 15th! Yay!

I'm still on track to hit financial goals for this month and next. I'm still debating on whether I want to work Spring Break week or take it off. I guess I should check with my brother and see if he still wants to road trip. It would be nice to have the extra week's pay, which would buy me another 24" monitor and the video card I want, but a week off is always nice too. The thing is, I only have about 14 weeks left here anyway, so not like I really need a break.

Tuesday, February 05, 2008

Reflection

Work has been interesting the last couple days, as I have spending about half my time learning about Java's reflection capabilities. I have nearly succeeded in completely generalizing the action code for our Struts app here at work, which to me is a victory. For one, it removes the need to ever write/generate it again on new tables. More importantly, it allows us to fix something in one place in the future, instead of once for each table. I say nearly succeeded because I have one minor issue to address, and really a couple things I'd like to find a cleaner way to do.

Word on the street is that Java reflection is slow, etc. But who cares? If this site was going to be used by millions, it might be an issue, but it's not, and we aren't doing any computation with it, just presenting and storing information. I find the task more meaningful because it solves the more general problem.

I think there are really two styles of coding. One of them solves the immediate problem at hand via the direct approach. I use this all the time when writing some script to parse/scrape text or some other task. You build something specific that solves the problem and get it done. The second style doesn't really come about until you find yourself repeating something using the first style.

The first time I wrote a script in ruby to scrape a website, I just used the built in HTTP library, loaded the page, searched it with a regex and spit out my results. Simple, quick, and it worked. However, about the third time I found myself scraping a page, I realized that I was duplicating a lot of code and really wanted a cleaner more general way. Now if I had been a trailblazer, I would have sat down and written a library to parse html with css selector or xpath support and then used it in my scripts. Thankfully, the people who made Hpricot did this for me.

Using the same code in multiple places just seems like a bad thing. This isn't really an earth shattering idea... it's called abstraction and has been the name of the programming game since the beginning 60 years ago. My point is that I find the enjoyable part of what I do is abstracting. Once you have done the straightforward solution, it is no longer challenging. I have done enough websites to be bored with the straightforward task of putting up forms, capturing input, and saving it. The fun for me writing the abstract system to do it all for me. That was why I wrote that generator to begin with. At the time I was cheating by using my knowledge of Ruby to metaprogram in Java. Now I have learned about how Java does it's own metaprogramming, so I'm trying to make my generator (mostly) obsolete too. At some level I can't entirely do it with Java reflection (building the table objects with reflection would just be too slow as far as I can tell), but I have faith that I can still get rid of a few more things. The xsl file will remain, and the DAO and entity objects, and the hibernate mappings, but I think I still have some low hanging fruit to attack.

Completely unrelated to all this, I have several exciting ideas I'd like to work on, but I'm trying to keep my focus on the project at work. I have problems working on two things at once (or on the same day anyway), and I'd like to leave a good impression here. At least I can tinker on the weekends.

Friday, February 01, 2008

Display Technology

Wow... all I can say is that these two videos must be the coolest things I have seen in a long time. The first one is on Head Tracking for VR Displays and the second Automatic Projector Calibration. The implications for such things are crazy.

The projector calibration technology especially excites me. The fact that it works with unmodified projectors (the magic is in the screen and software) is just brilliant for one. More usefully, this would allow for high quality mobile displays... that are lightweight. Imagine having a 30x24 inch screen that is no thicker than a piece of cardboard. A projector would be mounted in the ceiling of each corner of the room. You could then carry the screen anywhere in the room, at any angle, and have a highly visible work surface. Collaborating with others would be a matter of carrying your screen over to them. Add the touch screen technology in another of his videos and you could do away with the mouse all together... and put a keyboard on the screen and you could type without an actual physical keyboard. If something happened to your screen, no problem, it's cheap cardboard with some optical fibers. All the money is in the projector, which is safely mounted elsewhere. Spill water on it, who cares.

I think the VR tech could be built on to finally make useful 3D television. The only real issue left is making it work for multiple viewpoints at once. But even with only one viewpoint, having fully useful 3D without those silly red/blue glasses would be awesome.

This guy is innovating, and man, is he good.