Monthly Archives: April 2013

Other Things I Am Excited About

AE21SLIDEIn recent developments

  1. The founder of RailsApps Tutorials has been in touch and gifted me a pro subscription plan to the website! I have already seen an app I want to build 
  2.  

  3. I have registered to go to the RailsGirls Event in Brisbane – I just need to buy my flight
  4.  

  5. I am fantasising about an internship and Rails course at Shopify with HackerYou in Ottawa, for “Hands-on, project-based learning from industry-leading professionals”. Obviously it is a long shot, (not only because you have to be approved to be accepted, but also because I would have to pay a tonne of money for the course, flights, accommodation, living expenses PLUS the cost of replacing myself at work – which is what comes of working for yourself) 

I can fantasise can’t I? (Have you ever fantasised about being an old woman intern?)

 

Leave a reply

So What Exactly is Ruby on Rails?

So I have been learning Ruby and Ruby on Rails for a little while now, using lots of different resources and trying to get my head around it. For clarification in my own mind, I wanted to write this summary of my overall learnings and understandings so far (inspired by this excellent post):

What is Ruby on Rails?

Rails is a software library used to extend the Ruby programming language. When you build something using Ruby on Rails you are building a web application that uses the Ruby programming language to dynamically assemble HTML, CSS and JavaScript files from a collection of component files, (often adding content from a database).

Ruby on Rails Structure

Every Rails application will be a collection of folders/files, the structure of which is standard to Rails. Below I have copied the layout of the Rails folder structure from the Ruby on Rails Documentation

File/Folder Purpose
app/ Contains the controllers, models, views and assets for your application. You’ll focus on this folder for the remainder of this guide.
config/ Configure your application’s runtime rules, routes, database, and more. This is covered in more detail in Configuring Rails Applications
config.ru Rack configuration for Rack based servers used to start the application.
db/ Contains your current database schema, as well as the database migrations.
doc/ In-depth documentation for your application.
Gemfile
Gemfile.lock
These files allow you to specify what gem dependencies are needed for your Rails application.
lib/ Extended modules for your application.
log/ Application log files.
public/ The only folder seen to the world as-is. Contains the static files and compiled assets.
Rakefile This file locates and loads tasks that can be run from the command line. The task definitions are defined throughout the components of Rails. Rather than changing Rakefile, you should add your own tasks by adding files to the lib/tasks directory of your application.
README.rdoc This is a brief instruction manual for your application. You should edit this file to tell others what your application does, how to set it up, and so on.
script/ Contains the rails script that starts your app and can contain other scripts you use to deploy or run your application.
test/ Unit tests, fixtures, and other test apparatus. These are covered in Testing Rails Applications
tmp/ Temporary files
vendor/ A place for all third-party code. In a typical Rails application, this includes Ruby Gems, the Rails source code (if you optionally install it into your project) and plugins containing additional prepackaged functionality.

All these files can be edited in normal text editors.

Rails applications use the Model – View – Controller  pattern to organise code. (Sometimes known as MVCr, where the r stands for Routes, which you can read a bit more about here, even though that article is quite ancient.).

 

Ruby on Rails Controllers, Models and Views

(This image I took as a screenshot from a free part of a Lynda tutorial)

The relevant objects in Rails are:

  • ActionController (controller)
  • ActionView(view)
  • ActiveRecord (model)

Ruby Gems

One of the key advantages of Ruby is the use of gems, which are software libraries. Every application built in rails has a Gemfile included, which will list every gem used by the application. Bundler is the program that you use to add new gems to your development environment.

Some gems are required by every Rails app and others are optional and can be used to add functionality or make development easier. Knowing which gems to use for any project, is a skill that will need to be developed as you make more apps.

Testing

Ruby on Rails includes a baked-in test framework, and while it isn’t required, Rails encourages Test Driven Development. This means, writing a test before you write your code, (rather than the other way around).

I don’t completely understand the ideas behind Test Driven Development, or how to do it, so I will come back later and read this answer from StackOverflow on How to get started with Ruby on Rails TDD.

 

Leave a reply

More Ruby and Rails Resources for Beginners

If I am a tight-arse that refuses to pay lots of money for development training, then it is my own fault  if I can’t find a great resource that will teach me….right? Still, I am teaching myself with a patchwork of free and affordable resources online.

Let me go through and talk about a few of the ‘beginners’ resources for Ruby on Rails that I have been trying to learn from.

Net Tuts Recommendation

I have discovered a lot of people new to Rails are actually already programmers, and so the resources they provide/use to learn Rails go way over my head. Case in point, Net Tuts recommended video which I mentioned in my last post.  The presenter, Jeffrey, is obviously very experienced at Ruby and Ruby on Rails, but unfortunately for me, he also seemed to have a lot of other programming experience, so that within the first 4 minutes of the 40 minute video – I was lost. It also didn’t help that I was frantically pausing and unpausing, due to the speed at which he spoke.

This video made me feel like a bit of a moron. I’m not even sure I will go back to it when I know more, because the frenetic pace was kind of stressful, and it was made in 2011, so I think there are more recent things I could watch.

Lynda Intro to Ruby On Rails

I mentioned this Lynda course in my last post – and I have indeed had time to go and watch the introductory videos. I was encouraged by the pace and the fact that in only the first few free videos they had explained a Ruby on Rails concept to me that all the other resources had not yet had a chance to do. In fact, this would have really helped me when stumbling through my Treehouse project. When building my Treehouse app I was using controllers, views and models in my Ruby on Rails framework – but I had no real idea of what they were and how they were related. Thank you for this explanation Lynda:

Ruby on Rails Controllers, Models and Views

 

 

On the plus sides: The pace, it is for beginners (with some coding knowledge), it is 12 hours long so it is quite thorough, it is free for 7 days!

On the minus side: I have concerns about the fact that it was uploaded in October 2010. How will I know if things have changed?

Online Tutorials from Richard Schneeman

On StackOverflow I stumbled across a link to these Rails videos from University of Texas lecturer Richard Schneeman. It is a series of tutorials offered as a free introduction to Ruby on Rails. The guy who wrote them is a Ruby developer who started out as a mechanical engineer (career change, always makes me love a person).

Each week has a set of videos, plus a tutorial with working files you can download from GitHub.

I like his friendly approach, slow pace, and easy slides. A big difference between this and other resources I am trying is that he starts out first with an introduction to databases. This is a different approach and probably brings forward to me some concepts which I need to know and which haven’t been explained in the other resources I have used. This shows why it is good to use lots of different resources (even though I am dreaming of the one perfect resource).

It is also relatively up to date compared to those above two resources – these videos were uploaded in July 2012. Since this is free, I would recommend this as one of a number of resources you could use to start to understand Rails (keep in mind, I’ve only watched the first 2 videos, so I should update this after I watch all 10).

Rails for Zombies

Rails for Zombies is built by code school, and it is a combination of video and code challenges.

This one starts in yet another place – Ruby plus databases. It is assuming a bit of both Ruby and Database knowledge, so it is a bit hard for me, but the code challenges are easy to pass even if you are only rote-repeating. Which is bad I know.

It isn’t my favourite, and I feel quite lost already – but I am going to push through and try and complete it.

 

Codecademy

This isn’t a Ruby on Rails resource, but it can teach you Ruby – which of course you will need! It is a series of free tutorials that teach you and require you to complete code challenges. I have completed all the Ruby tutorials and found them very useful. I am concerned that I found them easy though – does that mean I didn’t learn much?

The easiness makes me think, also, that perhaps it doesn’t go very far into Ruby. Still they are always adding modules so there might be more at some point.

The big plus is that it is free. I would also like to note that I have done all the Codecademy current courses now except for some Python, and I found the Ruby lessons to be some of the best.

Treehouse

I know I already gave my opinion on Treehouse’s Ruby on Rails, but I just want to reiterate that while the video tutorials show you exactly how to make a small application – and while building an application is probably the best way to learn – there isn’t enough ‘theory’ here to enable me to expand on that knowledge or explore the Ruby on Rails framework. In combination with many other resources though, I’m sure Treehouse adds value.

I might say though, that if you wanted a free resource (Treehouse is paid subscription), you might try this project on Rails Girls, which helps you create your first app very quickly – much quicker than Treehouse. And while it doesn’t give any theory – well, neither does Treehouse, and this is free!

Real World Classes

Last post I talked about the $10k 10 week intensive course I had found in Sydney that teaches Ruby on Rails end to end in 10 weeks – this is by Sydney Dev Camp. I would love to do this course, because it really sounds excellent (though I have not met anyone that has done it), but the price is prohibitive. Even keeping in mind the $500 discount I would get for being a minority (woman), I can’t  currently justify that kind of spend, and I actually would be interested to see the demographics of their student body to see who can.

There is also the General Assembly school of coding, which has opened a Sydney campus. I was turned off these people earlier in the year when I didn’t win their competition to go to Silicon Valley (yes, as soon as I enter a competition I assume I have won, and feel robbed when you give the prize to someone else. Must stop entering competitions). This school also does a 10 week development course – and has lots of other resources – but I am being scabby and not wanting to pay a lot of money at the moment. (Update: I enrolled, and love it).

It’s All TOO MUCH

I also am considering going to this Rails Girls event in Brisbane - it is a free event, which is excellent, but I am not sure about coughing up for the air fares, or waiting for a Sydney event, or helping to create a Sydney event.

I came across another resource today, which is distracting me from Lynda and Schneems… It is this website and git repository for Rails tutorials. I am so grateful there are so many resources online, but it can feel a bit overwhelming!

Coder Friends

No, I don’t know any developers, and don’t have anyone to help guide me. This makes me sad. So if you are a Ruby coder in Sydney that wants a sidekick, or wants to do some kind of trade…hit me up on Twitter.

 

1 Reply

Getting Stuck with Ruby on Rails

Ok, so, I think I am hating on Treehouse. I was going along, doing my Ruby development course on there, learning the Ruby On Rails system and at the same time practicing Ruby on Codecademy.

I had watched all the Treehouses lessons on building the web app in Ruby on Rails and was moving on to the advanced, second section. However, at that point I was all of a sudden completely lost, and thought, I better go back and start again from the beginning, and build something myself so I really understand it.

I thought I would kind of follow what they were doing, but create something a bit more customised to what I wanted – that is, instead of just having an app that showed a user and a status update like they did, I wanted to have users that could record books they had read, the authors and comments about the books.

I think this made the database more complicated than Treehouse wanted me to learn – at which point I discovered that Treehouse wasn’t actually teaching you how to build something in general – they were teaching you only to build something very simple and very specific, without a general overview of Rails, the different parts of Rails, what could be done with it, etc.

I wanted something to teach me exactly how to build things in Ruby on Rails, but also to understand what Ruby on Rails was used for in general, and I am starting to suspect that Treehouse is not the way. Not only was the course very narrow, but the forums were pretty hopeless. Questions were going unanswered, and the community just wasn’t there like it was in Codecademy. This might be because Codecademy is free, and therefore has more members – but at the same time, Treehouse is a paid subscription, and so you would think they would get some staff or moderators to go in and help their paying students out!

As far as understanding Rails goes, I felt like I had come to a dead end. So, I am going to have to go elsewhere to learn…

Net Tuts has recommended a route to learning Ruby on Rails;

  1. Learn Ruby – they recommend tryruby.org. I am learning via Codecademy, and hopefully that has taught me some good stuff – but I might see if it stacks up against Try Ruby.
  2. Install Ruby and Ruby on Rails – I have already done this via Treehouse.
  3. A 40 minutes Net Tuts screencast about starting with Ruby on Rails,…maybe I will try it – because it’s free, and also because this is the kind of thing Treehouse completely glossed over.
  4. Rails for Zombies from Code School. I was thinking about doing that anyway, and it is free, so it is on my to-do list.  There is a second part that isn’t free – but obviously I will wait to see what I think of the first one.
  5. It then recommends a text book – Agile Web Development with Rails. I am not sure how I feel about learning coding through a text book – I feel like it will be dense, long and difficult….but this book was also recommended by Stack Overflow, so if I get this far, I might do it (Although, Stack Overflow recommendations don’t mean too much to me, because I assume that all the people on there have a lot more knowledge than me, and that I shouldn’t be using the same resources because I won’t understand them).
  6. This is the point in the list where I got bored. It goes on to say make a blog, then make that blog more complicated, then make something else, then stay up to date…but that is all a long way away for me I think…

I feel like the beginning of that list is do-able anyway. Treehouse has made me want to give up on Rails entirely, but I’m sure it is really good, and I just need another teacher. Let’s see if this Net Tuts screencast can redeem it for me.

Also, I am thinking of re-subscribing to Lynda and doing this course. It will also take you through an example (building a CMS), but it seems like it will give more information about what all the different parts of Ruby on Rails are. That Lynda course says Ruby knowledge would be good, but not completely necessary – so I assume that the Ruby I have learnt on Codecademy should be sufficient.

If I do this Lynda course it will take 12.5 hours just to watch all the videos, which, if I did an hour a day (my time budgeted), would take me almost to the end of the month, and I might not even have built my little app yet! 

I will try hard to catch up this weekend – but I am not going to beat myself up about it too much.

In other coding news – I have discovered a Ruby development school in Sydney that teaches an intensive course – it is $10,000 for 10 weeks! I understand that it would be a lot of face to face hours, and probably worth it if you could get a job in Ruby development after – but where are people getting 10k to splash around? That’s what I want to know! And if you do have $10k cash to spend – maybe you shouldn’t be changing career!

 

 

 

Leave a reply

Ruby Blocks, Procs & Lambda’s

Blocks Procs & Lambda's in RubyAfter completing the Ruby course in Treehouse, I have to be honest. I was feeling discouraged. Treehouse’s video format can be excellent, but I felt that it rushed through a lot of Ruby syntax and didn’t test me enough to make sure I understood it. (Multiple choice tests are the easiest things to scam in the world, especially in Treehouse where often the word your are looking for as an answer is actually in the question.)

ANYWAY, I did the Ruby course and felt like I had no idea what was going on – especially when they spoke about blocks. What did they mean? A block is just a bit of code right? But what makes it different from any other bit of code? And what on earth are Procs and Lambdas?

So, after I did the Treehouse course, I decided to go back to Codecademy and do their Ruby course – and you know what? I feel like that really cemented it in my brain. I feel like I understand it – even procs and lambdas.

Here is my summary

Blocks

These are a bit of code, and they can be contained in EITHER

do…end

OR

{ }

Treehouse did not explain this clearly, so I had no idea that these two different syntax (es? ie?) were the same thing. On Stack Overflow I read that {} is good for one-line code, and otherwise use do..end – although that is just a forum, so who knows how truthful that is.

You can pass these blocks to some methods like .each{put a block here I think}

Procs

A proc is a block which can be saved as a variable and used over and over.

variable = Proc.new do |x|

Do whatever

end

Lambda

A lambda is like a proc, only it cares about the number of arguments it gets (a proc doesn’t care, it will return nil if it doesn’t have the right number of arguments). Also a lambda returns to its calling method and keep executing code, while a proc will return straight after it is run (i.e. it will leave the method and execute no more code).

I don’t feel that Treehouse explained that very well to me, but Codecademy did it in a really easy way.  So, my big recommendation to other beginners in Ruby – do the combination of Treehouse and Codecademy. (Or maybe just Codecademy if you have no money, because Treehouse is subscription only. Maybe I would have understood well enough with just codecademy, the Ruby chapter is really good).

 

Leave a reply