Monday, 16 February 2015

Into the Forest

I think I'm slowly getting the hang of recursion. Writing it doesn't take quite as long as before and my head can slowly wrap around the logic of using the function within itself. However, a new problem was introduced: Trees. 

I'm not going to lie, I fell asleep for most of the class on the topic of trees. To no surprise, the notion of how trees were set up made no sense until I actually played around with the code. I now understand that each child is its own tree, and calling upon a tree's children creates a list of the names of the trees that can be called upon, rather than the values of the children themselves. After learning this, writing recursive code through trees became easier, but it still took sometime. I particularly had trouble with code that had to analyze every single element in a branch rather than just the leaves, due to having to add on an extra section on top of the for loop. 

I can see how trees can be useful, for creating programs and menus where clicking one item leads to an array of other options, with no overlap between them. However, their usefulness is limited if you need an option that can be accessed through multiple means. Maybe you could use multiple separate trees in that case? 

(-o-o-)

Sunday, 1 February 2015

First Impressions

One word: Recursion. Holy shit. Stuff messes with my head in loops like no other. Writing out a recursion flow chart thingy isn't too bad with the examples and all. Figuring out a recursion code without the docstring is a bit trickier, but writing recursion code itself is the stuff of nightmares. One trick I've found so far is to always keep in mind the original goal, as a function pertaining to counting or finding out the largest number will always have to come up. As usual, I suppose more practice should do the trick. If you have any other tricks...feel free to share them for the greater good of my sanity. 

Other than recursion, the concepts in python haven't been too bad. Classes are okay, although I'm still not entirely too sure how to use them very effectively, particularly when it comes to assigning __str__ and __repr__. Sub-classes are neat, but I feel like I should probably be writing more code in the super-class and then inheriting it. Oh well! 

Coding's been pretty fun so far, though admittedly it takes up time. At least it's rewarding when the code finally runs! 

(-o-o-)

Thursday, 22 January 2015

Writing for nerds

So you might be one of those guys who enroll in science classes specifically to avoid writing. Maybe you had a demotivating high school English teacher or just hate essays in general. Perhaps the texts you studied just didn't appeal to your literary senses or you simply couldn't understand what the hell they were talking about to be able to criticize them (I'm looking at you Shakespeare). Unfortunately for you, you've stumbled into the wrong field. If you were a musician you might have been able to escape the horrors of writing, but as a geek in the sciences, be it quantitative or biological, writing is an essential part of your trade. 

Why Nerdy Orange? Why must I write when the code speaks for itself? The answer is quite simple: so that everyone can understand your ideas and not just yourself. If you have any background in programming, you'll know that commenting is an essential part of great coding. When if statements pile on to each other and variables come and go, being able to clearly state the aim and logic of your otherwise gibberish could make a huge time difference if an error ever pops up. Through writing, you could keep a log of your progress and easily retrace your steps when making changes to the code. 

If you ever decide to go into research, then you'll definitely need to write a paper or grant at some point. You'll need to explain to the readers the results of your data, the conclusions they draw and why your work is relevant at all. You'll need to compact what could be years of work into a few pieces of paper and more than just that, you'll need to make it legible for individuals far less specialized than you. The secret to all this? Knowing how to write. 

The next time you come across a writing assignment, don't just brush it off and leave it until the last minute (unless you're Vladimir Nabokov). Take time and make sure your writing is coherent and free of silly grammatical or spelling mistakes. If anything, a solid grasp of the English language will make you appear more professional and intelligent to others. 

(-o-o-)