How to excel in Computer Science or Engineering

13 01 2012

It’s official: I’m the proud new owner of a Bachelor’s of Engineering in Computer Systems Engineering, and managed to graduate with highest honors and a GPA that makes most people hate me. After nearly 5 years of intense procrastination (er, I mean intense studying), living on a diet of Monster energy drinks and ramen, and having a sleep schedule so erratic my friends call me a voluntary insomniac,  my time in college is over for the time being. Having theoretically gained at least some wisdom and experience over the last five years, I thought I would offer it to the Internet for future generations.

Learn to program before college

I learned HTML/CSS when I was 12, was using Linux by 15, and knew enough about security to hack into my school’s webserver by 16. I took up programming at maybe 17 by teaching myself Python from online tutorials (which I’ve entirely forgotten the syntax of, but many things are universal in programming languages). Am I an unusual ubergeek? Well, yes and no. The fact is that if you enter CSE101 not knowing how to program, you’ll probably be in the minority. Does this mean that you’re behind and won’t be able to do well in CS? Certainly not. But this does mean you don’t know,

  • If you’re going to like programming
  • If you’re going to do well at programming
  • If you’ll enjoy sitting at computers for hours learning stuff or go stark raving mad
  • If you’ll be frustrated  not knowing what you’re doing or just accept it and keep searching for the answers
  • If you’ve accepted the fact that you’re going to be a geek in every sense of the word (or at the very least, be surrounded by them)
  • If you can handle spending 30 minutes writing a program and 3 hours debugging it
How do you choose to devote 4 years to life into something if you haven’t tried it? The answer is that it’s a lot easier to do if you get your feet in the water early. Another advantage of learning to program before you start is that your first CS classes will be a breeze. You’ll probably be disappointed that they’re so slow and boring, but don’t be. Spend your first couple of semesters,
  • Surviving Calculus (I-III), Linear Algebra, and any other hard classes your college requires
  • Using CS classes as GPA boosters (a pile of A+’s early on is how I graduated with highest honors even though my grades slipped a bit in the end)
  • Getting rid of pesky required humanities on things like ancient mesoamerican rubber ball making cultures (true story)

Don’t be too hard on yourself as a new programmer

When I started programming, I thought I was a horrible programmer, and it scared me. Now, I do have one of those personalities that make job interview terrible because I’m always self deprecating when it comes to what I’ve done, but the truth is you’re going to start out being a terrible programmer. Take a look at something I wrote on this blog nearly 4 years ago.

Do I have the art of programming? Nothing I’ve written is very impressive, half finished and unmaintained projects clutter my hard drives. The most complicated thing I wrote was a nearly 3,000 line IRC bot, with a plethora of useless features. The architecture got so bad that I couldn’t even figure out how to fix it to make it connect to esper’s servers correctly after they changed to a new version.The !google feature also mysteriously broke. I admit, when I started writing it I knew a lot less than I did now, and I wouldn’t make a lot of the same mistakes (variables all over the global namespace, lack of comments, horribly inefficient algorithms that make it take up over 100MB of RAM when the log files are loaded) if I rewrote it from scratch, which is the only way to really salvage the project, and too much work to bother with. Meh.

On the other hand, I can’t conceive of any other career that I’d like to peruse with even half as much enthusiasm, so even if my fate is that of a mediocre code monkey, it seems better than the other possibilities.

Did I turn into a mediocre code monkey? No, I’d like to think I turned into a decent software developer. I’m still a newb in many fields and feel behind sometimes (mainly in all the new web development technology), but in general programming areas I feel rather confident. It just took a lot of practice, and frankly a lot of mistakes. That little IRC bot I wrote taught me a lot about big projects. I don’t use tons of global variables anymore, I try not to write programs that take 100MB of RAM. I once learned the hard way by taking down a big company’s production database for a night that making sure your database connection code handles disconnects properly is really important.You’re going to start out a terrible programmer; see above point about getting a head start before college.

Part of the problem that made me question my computer science talent was the stress on the science part of some of my classes. Part of me back then thought that algorithm development was really important, and without it you aren’t a good programmer, since half of what you did in classes was go out and implement merge sort or Red Black Trees while sitting around studying linear algebra and calculus. The truth is you can still be a good software developer even if tracing through dijkstra’s algorithm gives you a headache. In the real world you’re far more likely to use a library implementation of an algorithm than code it from scratch, and high level abstract understanding is far more important than detailed understanding of the implementation or the ability to come up with such an algorithm on your own.

Learning the IT stuff

Now that you’re hopefully convinced you should be getting a head start on CS stuff, how do you do it? Having a solid foundation of computer skills is essential, and something they won’t teach you in college. Go get yourself an old computer from a swapmeet or online and install Linux. Never seen hard drive jumpers or power supply connectors before? Crack that baby open and see what’s inside. Then, install Linux. The reason is not because Linux is better than Windows, it’s because Linux is more transparent and actually more difficult to use. It’ll fail to install correctly, and in the process you might figure out what a bootloader is. You’ll pick up some terms about make tools and shared libraries when you install solitaire. You’ll pick up new concepts like dependency hell and kernel panic. It will be a love hate relationship and the process may lead to shark attacks.

You could call Linux a sort of bootcamp for computer people. When I started, everything that could go wrong went wrong with it. I once by accident destroyed my windows partition. I found that my video drivers were buggy as hell, my wifi cards needed custom firmware loaded into them, and that trying to get sound to work in Linux is less fun than herding mutant cat mules. I once managed to destroy X because it was a package dependency for a Firefox upgrade and the AMD64 bit version was unstable (or incompatible with something, I never found out for sure since that was the day I gave up using Gentoo). I once spent 3 hours trying to track down and manually compile all of the dependencies for a side scrolling open source game that only provided 30 minutes of entertainment actually playing. My SSH log in was always being harassed by strange Chinese IP addresses and the server was screwed up once from SQL injections on something I wrote.

The point is: when things are working fine in Windows all day, you don’t learn anything. Linux is actually becoming easier to use than ever with distributions like Ubuntu: don’t be afraid to jump into the more “advanced” distributions. I suggest Slackware as a good middle ground between working out of the box and being a good learning experience, then pick up something like Gentoo. Remember: pain is weakness leaving the body. Sometimes the old people complaining you kids have it too easy are actually right. When I was a kid, I remember having to wander the filesystem in a MSDOS command prompt… now get off my lawn (I’m a college graduate, I have the right to say that now, right?)!

Back to the details. What do you do with Linux now that it’s working?

  • Learn to use the command line (+1 for learning shell scripting)
  • Learn Vim (+1 if you become a vim junky and install vim shortcut emulation plugins in your browser)
  • Get SSH working
  • Get a webserver working (http, ftp)
  • Did you pick up HTML yet? Go host your own webpage
  • Get Samba working
  • Play with cron jobs for doing backups and maintenance
  • Try different GUIs (KDE, Gnome, xfce, Fluxbox)
  • Try to recompile your kernel, explore start up scripts, and make it boot as fast as possible
  • Look up guides on how to keep it secure and maybe play with some offensive security (hacking) network tools on your own network

Learning the programming stuff

Alright, you’ve either gotten the basics of computer stuff down or skipped it since you want to get straight to programming that video game idea you’ve been dreaming about. Either way I would recommend that your first programming language is something high level with a decent GUI library built in. Personally I went with Python/Tk followed by TCL/Tk. Other options could be Ruby or PHP if you can find decent tutorials on the internet for them. The reason for not jumping straight into C/C++/Java is that a scripting language will probably let you get to fun stuff sooner. Using Tk you can throw together a little tick tack toe game in about 5 minutes once you know what you’re doing. The second advantage is that this will reduce you’re boredom in beginning CS classes where they will probably start with either Java or C++. The third advantage is that a scripting language is always useful as a go to language for a quick script to do something like text processing. Learn regular expressions, they’re useful even for everyday find/replace tasks on a decent text editor.

How to learn to program

Learning to program is a bit like learning a musical instrument. People can tell you how to do it 500 times and it won’t make you any better. You simply become a better programmer by programming. When you’re learning to use Linux, it generally screws up and you figure out how to fix it. When you move on to programming, you screw up and slowly learn from your mistakes until you see what to do and what not to. Some things might accelerate the learning path: seeing really good code, seeing really bad code, finding the built in library that does the exact thing you’ve spent 3 days programming from scratch, sitting through lectures on software design and algorithms. Overall the best way to learn to program IS to program. I absolutely can not stand reading tutorials on the syntax of languages. Learn the basics of a language and then move on to actually trying to program something. What you ask? What do people draw when they learn to paint? What do people play when they learn music? What kind of building does an architect practice design on? There’s no correct answer; be creative. If you can’t think of anything useful to make, you can always resort to classic games (tic tack toe, checkers, chess, blackack, rubik’s cube, tower defense game, etc etc). The point being it’s easier to study pages of dull documentation when you’re using that to work toward a working program rather than just trying to memorize stuff. Your program might have been programmed a hundred times before, but that won’t make it any less of an experience writing, and you could learn from other people’s implementations.

Keeping the passion and motivation

Everyone has highs and lows when it comes to interests in things. If you’ve been reading from the beginning of this you probably think that I sit around every night writing MMORPGs and hacking together Linux scripts that make my Linux box take input by voice command. The truth is that  my work ethic can best be summarized as spurts of obsessive genius followed by long stretches of laziness, and the vast majority of my nights are filled catching up on all the TV I somehow missed growing up (seen Buffy the Vampire Slayer? If not, go, watch, now). This occurs on both a daily and long term basis, and I don’t believe I’m alone in it. Something I saw in a post by Joel Spolsky resonated with me,

Sometimes I just can’t get anything done.

Sure, I come into the office, putter around, check my email every ten seconds, read the web, even do a few brainless tasks like paying the American Express bill. But getting back into the flow of writing code just doesn’t happen. These bouts of unproductiveness usually last for a day or two. But there have been times in my career as a developer when I went for weeks at a time without being able to get anything done. As they say, I’m not in flow. I’m not in the zone. I’m not anywhere.

For me, just getting started is the only hard thing. An object at rest tends to remain at rest. There’s something incredible heavy in my brain that is extremely hard to get up to speed, but once it’s rolling at full speed, it takes no effort to keep it going.

This is the same with me. Once you get in the middle of a programming project it isn’t a chore, it’s a rush, a feeling of zen that most people rarely find during their day job. However, finding the motivation to get started, especially without school or work deadlines pushing you can be the last thing you feel like doing. I don’t have any solution to this other than: think of something to program and force yourself to start. Sure, it might end up being a false start, I once tried to force myself into the mood by programming an Android time tracking application for people with type A personalities (or just plain OCD, doubt I would ever actually be able to consistently use such and application). It ended in nothing but a failed attempt to find the Ballmer Peak and a slightly more advanced version of the classic Hello World program to see if my SDK was set up.

You might find motivation in odd places too. Why did I take up exploring network security? Anger at someone who told me their page was secure after I said it was outdated and full of holes. I once programmed a puzzle solving game automation program to impress a girl (she was impressed, but in hindsight asking her out would have been a far more effective move). The IRC bot I wrote was partly inspired by another guy writing a bot and battling mine with massive kick/ban/flood wars until the IRC network banned both our IP addresses.  Good times. What you should take away from this is that programming game playing algorithms is not a good way to attract a girl.

If you manage to make it through college as a CS major without having at least one existential crisis, I’ll be amazed. At some point you’ll probably be sitting gloomily in front of your computer realizing that the last x years of your life have been focused around the perusal of degree which will enable you to spend 10x that number of years sitting in front of computers pressing buttons and making the patterns on the screen change. In fact, this was the hardest thing about college for me. It wasn’t the work, I could do the work easily if I applied myself. It was just trying to not fall into apathy, or worse, pure hate for school (keep reading and I’ll got to this).

How did I survive it without becoming a deranged alcoholic? It’s surprising how many software developers and IT people you can find in hole in the wall bars; you should be concerned I know this. There is no easy answer to this. My only advice is to find something to do, even if it isn’t programming. The worse period of my college experience was about 6-12 months ago when I simply had no motivation to touch any CS stuff outside of work and school. The classes I had were both boring and tedium filled, the capstone project I was looking forward to ended up being a huge wast of time, and I’d been both in school and at my internship long enough that absolutely nothing new or exciting was happening in my life. I managed to narrowly avoid failing Statistics for Engineers (pulled a C out of it from 2 days of cramming for the final). The only thing that pulled me out of it was the reality that this is my last semester and I really need to start doing things like planning for a career and not failing my last upper division humanity.

Thoughts on bad professors

An unfortunate fact of my college experience is that I would say the bad professors outnumbered the good professors by probably 2 to 1. For every lecture I went to, I had 2 others with a professor I found mediocre at best.  Is this conclusion because my expectations for professors are too high? Maybe: what makes a good professor?

  • Knowledge of the subject matter above and beyond the textbooks
  • Can be understood (doesn’t skip too many steps, can speak English, can explain things articulately, can write legibly)
  • Entertaining personality/ability to hold people’s attention (throwing in a joke or story instead of 75 minutes of straight monotone slide reading)
  • Fair grading scheme and tests
Once you get to upper division classes, you might be able to start picking classes from professors you know are good. I’d definitely recommend this, nothing is worse than being interested and excited by a topic and then losing all interest because you hate the class so much.

Graduating on time

College advisers always push graduating on time. I went the route of attempting a double major (in math), giving that up, and ended up being behind 1/2 to 1 year depending on how you count things. I don’t regret it at all, if you’re liking college, don’t be afraid to kill some time with interesting non-required classes. It’s easy to get internships when you’re in college that look good on a resume, and in the big scheme of things, who cares if you’re a year older when you enter the work force?

Exception: if you’re hating every moment of college, try and get out quick and not procrastinate. I put off a few classes I didn’t want to take and I would have done better on them earlier on before I lost a lot of my motivation. For those in pain, the quick bandage approach is far better than the slow procrastinating but loathing perma-college student that takes 8 years to finish their degree (I’ve seen it). But hey, 8 years if you’re having the time of your life might be okay, just depends on your situation.

Final thoughts and a link

Somewhere in the middle of college I stumbled across Joel Spolsky’s blog, Joel on Software; I highly recommend reading through his old posts. One of his posts offers some advice for computer science majors.  Go read it yourself, but here are his main points.

  • Learn how to write before graduating.
  • Learn C before graduating.
  • Learn microeconomics before graduating.
  • Don’t blow off non-CS classes just because they’re boring.
  • Take programming-intensive courses.
  • Stop worrying about all the jobs going to India.
  • No matter what you do, get a good summer internship.
A good point to end on: companies like having interns. Programming interviews are hard to properly conduct. Internships let companies have a nice trial period where they get to see what you’re capable of, and you get experience, resume fodder, and money. One problem I had was not knowing when I had enough skills to actually get an internship. Simple answer if you’re an ASU student, CSE310 (Data Structures and Algorithms) and CSE360 (Sofware Engineering/Design) will give you what you need to at least have a good change at surviving a technical interview. That doesn’t mean you couldn’t pick of the stuff you need before the classes or try to interview anyway, but in my experience interviewers focus on algorithmn (reverse a linked list, common algorithm time complexity, space complexity, hash tables, sorting) and OOP design (think through a first pass architecture of a program that does blah and scribble it on a white board) questions a lot, especially for college students that don’t really have much past experience to point to in order to show their skills.




Pondering on the Teaching of Mathematics

21 02 2009

As I sit here working on calc III homework, I come to the realization once again that I really have no idea what I’m doing.

On one hand, I know exactly what I’m doing. I’m taking double integrals, finding Lagrange multipliers, and finding partial directional derivatives. I can tell you what these terms mean, which make any non-engineering or math major cringe, easily enough. They’re volumes under surfaces, a handy way to find max/mins, and lines tangent to surfaces in a direction. They’re actually not even hard to do, it’s just all the stuff you learned (or learned and forgot often in my case) in calc I and calc II applied to R^3 space.

On the other hand, I have no idea what I’m doing. How would I ever use this in the real world? Just trying to figure out an application is difficult. Don’t start attacking me saying there’s applications for this kind of math all over the place, because I’m trying to believe you, I really am. I just haven’t been taught any of them. Say I have a function f(x, y), and then I want to see how the function changes with respect to x only. Okay, sure, just take a partial derivative. Why would I want to find how the function changes at an angle of 42 degrees from a point though? For that matter, where do these functions come from? How do I model real world applications into the form f(x, y) so I can easily do my calc on them? If you look at the Wikipedia article for a hyperbolic paraboloid, there’s 4 sections of it’s properties and how to do stuff with it, and a footnote at the bottom saying “applications: directional antennas and receivers, such as satellite dishes, telescope mirrors, and directional microphones are paraboloids.” Nifty, why don’t they ever give me cool application problems dealing with directional antennas?

useless1

If I get a job in engineering or math, I don’t think my boss is going to come up to me and say, “hey, go find the first and second order derivatives of f(x, y) = -3\sin(2x+y) + 7\cos(x-y).” First off, I can plug that into Mathematica and get the answer in a few dozen clock cycles, faster than I can even write the first derivative with respect to x. For that matter, faster than I can write the letter ‘x’.

The really sad part is, I’m in “applied” linear algebra and calculus “for engineers”. That means somewhere at ASU there’s a bunch of math majors even more clueless about the applications of what they’re doing, even if they can prove by contradiction that their numbers are at least logically derived.

If I ever became a math professor, this is what I’d do. First off, instead of spending the first class introducing myself and the syllabus, I’d spend it introducing the subject. I’m 4 weeks into discrete math right now and I still have no idea what discrete math really is. It seems like a hodgepodge of topics and mainly a class to teach proofs in, which seems a bit pointless since the teacher said a good 50% of the material overlaps with the class I’m taking next semester on proofs. Don’t go into details about how to do anything, just talk about the general idea of the stuff. If teaching calc I, explain what derivatives and integrals are from a geometric viewpoint. Explain a few basic uses of them as well. Don’t just jump into the limit definition.

Then, when you get into the material, first play around with some problems and applications before you dive into a proof of some formula that takes half the class. This would at least show the students where you’re going during your proof. More often than not I watch my teachers manipulate expressions for 5 minutes, coming up with an obscure formula, then explaining what the formula actually does. If I’m really lucky, they’ll even explain what it means after that.

Finally, once you know the formula, where it came from, and what it does, do real world problems. If almost all the problems are related to physics, maybe physics and math should be combined into one class. It seems like physics classes just apply formulas to problems, and math classes just make up formulas without showing any problems. It’s hard to deny that a large part, maybe even the majority of uses for calculous involve physics. Of course the classes would move slower, but what’s wrong with spending more semesters if you’re combining two classes?





ASU Spring 2009 Class Schedule / Ratemyprof Opinion

17 11 2008

As I mentioned in my ASU enrollment appointment post, being a sophomore everyone else gets dibs on the good classes before I do. I planned out a really nice schedule, and then watched for 17 days as all the good classes I wanted got filled up. I wasn’t able to get into Physics (at least not without a lot of difficulty trying to get an override and ending up with a horrible schedule because of it anyway). The lecture got filled up, and even if I did get in, the only lab spots left were 7:30am or 6:00pm. the first would require me getting out of bed and onto the bus before the sun comes up (unnatural I tell you!) and the latter would make for 12 hour Thursdays. It is a bit saddening though, because Physics would have been an easy class. The only requirement was Calculus I, and I took an introduction to physics class at the community college back during my homeschooling/dual enrolment days… The good news is that it isn’t a requirement for any of my future classes, just a science elective I need, so it won’t put me behind at all if I wait a semester or two to take it.

Instead of an easy class and a fun lab, my choices became Linear Algebra (hard looking), Differential Equations (harder looking), an upper division statistics/engineering class with a software lab (hard and time consuming), or a horribly boring and probably time consuming cultural humanity (religion, prehistory, woman’s studies). I was contemplating going with the humanity, since for some reason I’ve developed a fear of math classes, but I decided to go ahead and take Linear Algebra since it will help me a bit if I decide to minor in math; Plus, I’ve heard it’s helpful to take before you take differential equations (even though the degree program says to take them the other way around). Here’s what my schedule next semester ended up as,

spring_09_schedule1

CSE220: Programming for Computer Engineering (Burger)

CSE230: Computer Organization /Assembly Language Programing (Burger)

MAT243: Discrete Math Structures (Maris)

MAT267: Calculus for Engineers III (Rogers)

MAT343: Applied Linear Algebra (Enyang)

It’ll be an interesting but difficult semester. One thing I did differently this semester while registering is spend more time than usual asking people which professor they had for the class and browsing some pages like Ratemyprof and the professor’s previous year’s syllabi. Before, I didn’t really care much, thinking I could just learn the material on my own and do fine even if the professor was a horrible teacher. I’m starting to find that isn’t quite the case; the teacher can make the difference between the same class being interesting/enjoyable and getting a good grade, or a horribly boring/difficult class and getting a bad grade. I think that’s the one thing that I’ve learned from Biology this semester.. easy topics, sometimes interesting, but hate the class more than any I’ve taken so far (and I’m likely to get an “A”.. maybe, the prof won’t say, and the class average is somewhere between 50 and 60). Often I didn’t have much of a choice because of scheduling requirements, but I heard Burger was a really good prof, along with Rogers, so I managed to fit them into my schedule. For discrete math there were only two professors that teach it, and the reviews of them on Ratemyprof summed up in one word were “evil” for one and “scary” for the other. I just picked the one that fit into my schedule best. Ratemyprof with math courses isn’t very reliable anyway, there are always students who will say the class/teacher was horrible because they got a bad grade, but often those are just kids who don’t get math, and wouldn’t even with the best teacher.

So, take reviews and recommendations with a grain of salt, but it can’t hurt to try and find good professors, right? After all, you’re paying for your education just like you pay for a lot of other things, and when you go out to buy a new computer or car, you certainly do research to see what model is best before diving into such an expensive venture. The cost of a computer and the cost of a 3 credit hour class at a university are quickly becoming closer (computers are getting cheaper as education is getting more expensive). There is quite a debate in the college atmosphere about this topic; I’ve heard people say that the idea of Ratemyprof and the dozens of similar pages are stupid, with anonymous posters putting incorrect or misleading information, and that if a teacher was truly bad they would improve or not be teaching at the university anymore. I’ve also heard of professors getting on the pages and posing as students, rating themselves with 5 stars and a great story about how wonderful the class is. Among the professors, they think that being an easy grader is the only thing important on these pages. I won’t deny that all these are possibilities, which is why you mustn’t think every little story you hear is true. However, when you go onto Ratemyprof or some other page and look up a professor, find that they have 8 pages of student comments saying how they are disorganized, hard graders, or the most monotone person they’ve ever met, maybe there’s something to it!

I’ve heard a lot of complaints and comments about Ratemyprof, especially from professors themselves. On one teacher’s forum that I stumbled across while browsing (I’ve since lost the link, but will try and find it later), a college professor stated that he heard a student put off a class for semester because his (the professor) Ratemyprof page said that he was a horrible teacher. The professor’s response was to say that this was ridiculous, and the student was not the kind of student he would want in his class anyway, and that pages like this would weed out students he didn’t want. Perhaps putting of a class seems like an extreme thing to do, but according to several studies Ratemyprof and pages like them correlate directly with the university’s system of teacher evaluations. If the professor’s reaction was claiming that he doesn’t want students like that, does he really sound like a good teacher? My reaction to the professor mentioned above is similar to a comment on the above link,

“Poll a 1000 college students and 900 will tell you they do not think their school or professors care much about their views. This is not merely sad, frustrating and demoralizing, but counterproductive to the ultimate mission of our universities to inspire our individual minds and collective culture toward a higher ideal for the human condition. No sustainable system exists without valid feedback and while the occasional student verbal trashing is inevitable, the broader pattern of issues raised, particularly if students believe it to be taken seriously, should be a welcome insight for improvement in a largely insular academic setting.”

I won’t give myself dreadful schedules or avoid classes just because of Ratemyprof horror stories, but I will continue to skim through them when I register for a semester, avoiding professors with horrible ratings and leaning toward those with good ones when my schedule allows and multiple sections are available. It’s a source of information, and like with any source of information can be a useful and powerful tool when a discerning eye is applied to it. I’ll also continue to contribute to a few of these pages, especially when the ratings are against what my opinion is. If I look up one of my teachers that I really enjoyed learning from and find they have bad reviews (happened with my Calc I teacher), I’ll take a minute to throw a 5 star rating and a comment/story on the page, and encourage you to do the same. The more accurate and intelligent ratings that are posted, the better the site becomes.