Well this is my first week in the
apprenticeship program; it has been kind of difficult because I never thought that setting up the
environment to start coding will cause that amount of errors. But before to get
deeper into what have I done so far, I would like to tell you how I get into
this program.
I’m a student of “computer engineering” that is more like "software engineering" in Tecnológico de Costa Rica. In my second year,
I went to a exhibition where I heard about it, so since that moment I
wanted to enter into this program. Now I’m going to start the last semester of
my studies at college, and I have decided to do this. Let's see how it goes...
The first thing that I did was: set up the
environment, so….
How to install RVM, Ruby, VIM, Bundler and git?
First of all, I’m using Ubuntu 11.10. Open the terminal and now we have to write the next commands on it.
RVM y git:
sudo
apt-get install build-essential git-core
·
sudo
apt-get install curl
·
bash
–s stable <<(curl –s https://raw.github.com/wayneeseguin/rvm/binscripts/rvm-installer)
·
source
/etc/profile.d/rvm.sh
·
echo
‘[[ -s “/home/name/.rvm/scripts/rvm” ]] && source “/home/name/.rvm/scripts/rvm”
‘ >> ~/.bashrc
Note: Remember to change name in the path above
for your user name
·
source
~/.bashrc
· To
check that everything was installed correctly type: type rvm | head -1. It has
to return you rvm is a function
Ruby:
·
rvm
install 1.9.3
·
rvm
use –default 1.9.3
VIM:
·
sudo
apt-get install vim-gnome
Bundler
·
gem
install bundler
·
bundle
init
·
bundle
install
Beyond the environment set up, I also have
to start learning ruby, because this is my first time trying this programming
language. So I took the little course to get started with ruby in tryruby.org,
also I searched others tutorials (that I have not finished yet). On the other
hand, some lectures and videos were assigned.
I read the chapters 1 and 2 of Clean
Code book (if you’re interested on improving your way, and how to make better code
that’s a perfect book). Basically, the lectures and video were about improving
code and the main things that I think would be helpful are:
- Functions and classes should be small.
- The name of each variable, function, class, etc must be very descriptive about what it means or does.
- We need to avoid, and we must quit the duplication in our code.
- Refactoring, we need to keep in mind that concept.
- Classes must have only one responsibility.
- Functions must do one thing.
- It is better to have a code with descriptive names, than have a code that has comments.
- Also it is better that functions do not receive any argument.
- If we have to pass arguments to a function, try to keep the number of them at the minimum.
- Never pass a Boolean as an argument of a function, because Robert C. Martin says that’s a sign that the function is doing more than one thing.
- As we augment the number of arguments to pass in a function, we are making it harder to understand.
- Robert C. Martin also says that the length of the name of a variable, function or whatever in the code should be inversely proportional to the scope of this.
- It is good to practice TDD; it makes you improve the code.
- You can’t do everything in a time; have in mind that big things are reached by small steps.
- One thing at a time.
- Keep code clean.
What’s coming?
In the next post I’m going to talk a little bit about
Clojure, SOLID, patterns. Also I started coding a Tic Tac Toe on Ruby and I’ll
have to apply all I have learned so far, so when I finish it, I’ll post the
link where you can find it.
Bibliography:
git.
(n.d.). Retrieved july 2013, from git-scm.com:
http://git-scm.com/book/en/Getting-Started-Installing-Git
Honsberg, A. (2012,
May 8). Retrieved july 2013, from Install RVM ( Ruby Version Manager ) in
Ubuntu 12.04 Linux for Ruby 1.9.3:
http://www.andrehonsberg.com/article/install-rvm-ubuntu-1204-linux-for-ruby-193
MARTIN, R. C. (
2008). Clean Code. PRENTICE-HALL INTERNATIONAL EDITION.
Martin, R. C.
(2010, may). Retrieved july 2013, from
http://www.infoq.com/presentations/Robert-C.-Martin-Bad-Code
Morin, M. (n.d.).
Retrieved july 2013, from ruby.about.com:
http://ruby.about.com/od/advancedruby/ss/Creating-And-Distributing-Gems-With-Bundler_2.htm
No hay comentarios:
Publicar un comentario