sábado, 20 de noviembre de 2010
I'm a LOL programmer (wannabie)
In my new job, it seems I'll be writing ruby (on rails).
I've been trying the language in my spare time, and it seems a fairly good compromise between Perl and Smalltalk.
Except a couple of features or idioms I saw, everything else was quite intuitive or easy to understand (at least coming from Perl/Smalltalk).
+ Sigils do exist, but denote scope oposed to type.
+ __DATA__
+ '=' can be part of a method name. And there's some magic involved there. def method=(attr) can be used as an assignment (sintactically) as parens are optional.
+ Integer class can be expanded or subclassed.
Here are the codes I wrote to grasp the language. These are the usual examples I write in every language I try to learn:
- a program to center paragraphs.
- guessing number
- Network with hosts that pass messages one to the other.
Here is a link that I found useful about ruby patterns and idioms.
http://scriptlandia.blogspot.com/2009/02/design-patterns-in-ruby.html
lunes, 15 de noviembre de 2010
Last but not least
I'm leaving my current $work, and changing to another one. Being the first one I'm starting not as an university student but a 'professional' one feels strange, and I'm somewhat thrilled. Will I be good enough for the job? I hope so :)
These last days I'm reviewing some of my old code with the guy who will inherit my codes. A cool programmer, with lots of knowledge I wouldn't expect from an average young programmer (it's actually a bit older than me but, you know... not everyone reads 'refactoring', code complete, and GoF just for fun :) ). We've had good times. Transfering info would be quite more difficult without such a good learner. In little less than a week, he also explained me some ins and outs about some agile methodologies, or good programming practices (some cool refactorings, Log4X modules, etc...). We both learned quite a lot from each other.
Some of the neat advices that I liked.
- use Logging modules. They pay off. And they are quite easy to set up (opposed to what I thought)
- refactor any piece of code that is repeated more than 1 time (if it's easy to do). calling a simple join(',' , @array) three times in the same function can be refactored into a meaningful name sub. You get the name explaining what your code does, and if you want to change ',' to ':', only one change does it.
- Codes that you write separated by 2 newlines, like paragraphs, and start with a comment that explains what that snippet does, are screaming for a new function. You can use the first words of the comment as a hint for the function name.
- Take a look at AOP, it's cool. a really cool thing.
These last days I'm reviewing some of my old code with the guy who will inherit my codes. A cool programmer, with lots of knowledge I wouldn't expect from an average young programmer (it's actually a bit older than me but, you know... not everyone reads 'refactoring', code complete, and GoF just for fun :) ). We've had good times. Transfering info would be quite more difficult without such a good learner. In little less than a week, he also explained me some ins and outs about some agile methodologies, or good programming practices (some cool refactorings, Log4X modules, etc...). We both learned quite a lot from each other.
Some of the neat advices that I liked.
- use Logging modules. They pay off. And they are quite easy to set up (opposed to what I thought)
- refactor any piece of code that is repeated more than 1 time (if it's easy to do). calling a simple join(',' , @array) three times in the same function can be refactored into a meaningful name sub. You get the name explaining what your code does, and if you want to change ',' to ':', only one change does it.
- Codes that you write separated by 2 newlines, like paragraphs, and start with a comment that explains what that snippet does, are screaming for a new function. You can use the first words of the comment as a hint for the function name.
- Take a look at AOP, it's cool. a really cool thing.
jueves, 4 de noviembre de 2010
I'm in ur shell, watching your repos
I'm using more and more a little script that Cornelius called cpans.sh (for cpan search)
It's dead simple, but great anyway, and, it lets me use ratfinder to browse cpan modules. And to give credit where the credit is due, I'll just embed his gist.
Simple idea, neatly used. curl, file tests, zgrep and some bash bits.
It's dead simple, but great anyway, and, it lets me use ratfinder to browse cpan modules. And to give credit where the credit is due, I'll just embed his gist.
Simple idea, neatly used. curl, file tests, zgrep and some bash bits.
Suscribirse a:
Entradas (Atom)