Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/about.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ All source code for TryRuby (this website) is available on
### Contact

This website was created by Ivo Herweijer. I am a software developer and
live The Netherlands. You can contact me via
live in the Netherlands. You can contact me via
<a href="https://github.com/ruby/TryRuby/issues" target="_blank">GitHub</a>.
24 changes: 12 additions & 12 deletions source/articles/2015-01-01-try-ruby-version-4.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "TryRuby's history"
date: 2015/01/01
author: Ivo Herweijer
the_summary: Some information about the history of TryRuby and the reasons for being of TryRuby<sup>R4</sup>.
the_summary: Some information about the history of TryRuby and the reasons behind TryRuby<sup>R4</sup>.
---

## History
Expand All @@ -15,15 +15,15 @@ the lucky stiff', a.k.a. \_Why. You can read more about him on
and David Miani. Next Eric Allam and Nick Walsh took over (Codeschool/EnvyLabs).

### Why_
This fourth iteration of TryRuby was created for several reasons.
This fourth iteration of TryRuby was created for several reasons.

- The lesson content was getting a bit dated. For instance the stuff about reading and writing
disk files does not really belong in an entry level course these days. Writing blog software
is also not very appealing anymore
- The lesson content was getting a bit dated. For instance, material about reading and writing
disk files does not really belong in an entry-level course these days. Writing blog software
is also no longer very appealing
- Lesson content also missed some important information (like __if__ statements)
- All previous TryRuby versions consisted of an irb interpreter with a web front-end.
Even though some security measures have been taken (isolating and restricting the irb process
and whitelisting input), this still sounds like a bad idea from a security perspective!
Even though some security measures were taken (isolating and restricting the irb process
and whitelisting input), this still sounded like a bad idea from a security perspective!
TryRuby<sup>R4</sup> runs inside the web browser

### Changes
Expand All @@ -32,25 +32,25 @@ I had to make some alterations to the TryRuby lesson content. Also updated some

- Opal uses immutable strings, so [ ] based string manipulation was replaced with gsub
- File reading and writing removed and replaced by getting a json file from the internet
- Since irb is not used anymore, it is possible (necessary) to run entire programs, not enter
- Since irb is no longer used, it is possible (and necessary) to run entire programs, not enter
commands line-by-line
- Removed the pop-up stuff
- Removed mousehole stuff
- Improved the feedback given to the user based on the program's output a bit
- Added support for lesson content in multiple languages. The Spanish, Brazilian Portuguese,
Japanese, Russian, Ukrainian, Macedonian, Dutch, Turkish and French translations are available.
__If YOU would like to add a translation to TryRuby you are most welcome !__
- Added explanation of if/else statements
- Added an explanation of if/else statements
- Changed the subject of the "Class" tutorials from building a blog (so last decade) to making an
instant messaging app called: Blurbalizer<sup>TM</sup>
- Used markdown with frontmatter for editing lesson content
- Used middleman as development environment
- Added some articles with more background information for aspiring software developers
- Added articles with more background information for aspiring software developers

### Next
Where can TryRuby<sup>R4</sup> be improved ? Couple of things I've thought of.
Where can TryRuby<sup>R4</sup> be improved? Here are a couple of things I've thought of.
Your opinion is most welcome:

- Add some self evaluation questions at the end of each chapter
- Maybe remove the lessons about classes. It's a bit advanced for an absolute beginners
- Maybe remove the lessons about classes. It's a bit advanced for an absolute beginner
course
10 changes: 5 additions & 5 deletions source/articles/2015-01-02-testing.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ Testing software is one of the most important aspects of software development. I
you are writing is doing what it is supposed to do. Now and in the future.

Having a comprehensive set of tests for your code gives __you__ confidence that it does what it is
supposed to do. It also helps bestow that confidence on __others__. Other people who are using or maintaining
supposed to do. It also helps convey that confidence to __others__: people who use or maintain
your code.

Running tests some time after you created your code, for instance after some components you rely on have been
updated, will tell you if your code still works or you need to make changes.

### Different tests for different purposes
There are a lot of different kinds of test. I've list a couple here, in order in which they are used in a
There are many different kinds of tests. I've listed a few here, in the order they are commonly used in a
real programming project:

- Unit tests
Expand Down Expand Up @@ -83,13 +83,13 @@ Here is an example from <a href="https://docs.cucumber.io/" target="_blank">Cucu
> &nbsp;&nbsp;&nbsp;&nbsp;__When__ I try to post to "Expensive Therapy"
> &nbsp;&nbsp;&nbsp;&nbsp;__Then__ I should see "Your article was published."

Each feature usually has many scenario's.
Each feature usually has many scenarios.

### Test tools and automation
Ruby has one of the most advanced set of testing tools available anywhere.
Ruby has one of the most advanced sets of testing tools available.

For supporting TDD style testing both __rspec__ and __minitest__ are very popular.
BDD style testing is often done with __cucumber__. Cucumber lets you translate functional
BDD-style testing is often done with __cucumber__. Cucumber lets you translate functional
requirements written in plain English into executable (!) tests for your Ruby code.

Testing is not supposed to involve additional work. This would soon lead to less testing.
Expand Down
22 changes: 11 additions & 11 deletions source/articles/2015-01-03-app-development.html.markdown
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
title: "Is there an App for that ?"
title: "Is there an App for that?"
date: 2015/01/03
author: Ivo Herweijer
the_summary: Is there an App for that, or how to deliver your fantastic new service to your customers.
---

## Is there an App for that ?
## Is there an App for that?

This article is about how to deliver a service (aka your software) to your customers.

Expand All @@ -14,7 +14,7 @@ Life used to be very simple for software developers. You made some code, copied
sent it to a customer. Next came the internet, so you could distribute code via a download.
Or the website itself became the product.

Then computers started to shrink to the size of tablets, smartphone and wristwatches, with small
Then computers started to shrink to the size of tablets, smartphones, and wristwatches, with small
touch operated screens, without a real keyboard and sometimes requiring your code to run on the
device itself.

Expand All @@ -24,35 +24,35 @@ a website usable from a variety of computers and devices, plus a native app for
platforms (Android, iOS).
A lot of different technologies to learn!

Life for software developers isn't that simple anymore. What are your options ?
Life for software developers isn't that simple anymore. What are your options?

### HTML5
The first route available to you is to only create a web based version of your service.
The first route available to you is to create only a web-based version of your service.
Web browsers are getting more powerful every year. Giving you better control over the look
and feel of your website, regardless of the size or type of device used by your customer.

But your customer will still need constant internet access to use your service. Fortunately
the web browser can help us here as well. HTML 5 enabled web browsers support something called
local storage and service workers, which you can use to make the customer think he/she is still
local storage and service workers, which you can use to make the customer feel like they are still
connected to your service. When an internet connection becomes available again, you can sync changes.
I am not saying that this is easy to do, far from it, but it's do-able.
I am not saying this is easy to do, far from it, but it's doable.

One thing that can make life easier is to use <a href="http://opalrb.com/" target="_blank">Opal</a>.
This means that you can run Ruby code in the webbrowser. Normally webbrowsers only run Javascript,
This means that you can run Ruby code in the web browser. Normally web browsers only run Javascript,
but Opal cleverly translates your Ruby code to Javascript. This saves you having to learn Javascript.
It is also very handy to use the same language for both the front-end (webbrowser) and the back-end
It is also very handy to use the same language for both the front-end (web browser) and the back-end
(webserver with Rails for instance).

> TryRuby uses Ruby and Opal for everything.

### Native apps
The other possible route is to go native. Create an app for every mobile platform that you want
to support. Native apps give you ultimate control over the look and feel off your program.
to support. Native apps give you ultimate control over the look and feel of your program.
You will also have better access to the sensors built into the device (movement, position, ...).

Huge drawback to this approach is that every mobile platform uses a completely different development
environment and programming language. You might need to learn about Java, Objective-C, Swift,
C-Sharp and others.

But you are in luck ! There are cross-platform tools available where you create you app once and
But you are in luck! There are cross-platform tools available where you create your app once and
distribute it to multiple mobile platforms.
8 changes: 4 additions & 4 deletions source/articles/2015-01-04-web-development.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ the_summary: One of the areas of software development where Ruby really shines i
One of the areas of software development where Ruby really shines is web development. From creating
a simple website to a full cloud based webservice, it is all easily attainable.

### Ruby-on-rails
### Ruby on Rails
I should mention Ruby on Rails. You have been learning the Ruby language, how to speak it.
But Rails is a very powerful and popular toolkit for building websites.

Ruby-on-rails, or RoR, consists of set of Ruby libraries. These libraries help you do things that
Ruby on Rails, or RoR, consists of a set of Ruby libraries. These libraries help you do things that
websites commonly need. Like routing an incoming request to the correct handler. Or interacting with
the database. Or returning a fully rendered webpage.

RoR makes creating a website easy, __if__ you follow the RoR conventions. This also means that you
do not have to setup a lot of complicated stuff in order to get RoR to work.
do not have to set up a lot of complicated stuff in order to get RoR to work.
RoR people call this principle _convention over configuration_.

One important convention is called: _Model-View-Controller_ (for purists it is a design pattern). It means that you should separate code
Expand All @@ -27,7 +27,7 @@ controller).

If you're interested in learning about Rails, I would
<a href="http://rubyonrails.org/" target="_blank">head over there</a>
right away. Start using your Ruby skills proper!
right away. Start putting your Ruby skills to proper use!

### Other frameworks
One disadvantage of RoR is that, because there are so many libraries and conventions, it takes
Expand Down
28 changes: 14 additions & 14 deletions source/articles/2015-01-05-what-i-left-out.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
title: What I've left out
date: 2015/01/05
author: Ivo Herweijer
the_summary: TryRuby is a Ruby course for beginners. Its not possible to tell you everything about Ruby in 15 minutes. Here is an overview of what I have left out.
the_summary: TryRuby is a Ruby course for beginners. It's not possible to tell you everything about Ruby in 15 minutes. Here is an overview of what I have left out.
---


## What I've left out

TryRuby is a Ruby course for beginners. Its not possible to tell you everything about Ruby in
TryRuby is a Ruby course for beginners. It's not possible to tell you everything about Ruby in
30 minutes. Here is an overview of some of the things that I have left out.

### Comments
To add text to your Ruby file, you can do so with comments. Comments can be used for
documentation, explain parts of your code or anything else you'd like.
To add text to your Ruby file, you can use comments. Comments can be used for
documentation, to explain parts of your code, or anything else you'd like.

Single line comments

Expand Down Expand Up @@ -71,20 +71,20 @@ And there is an alternate form:
end

### Regular expressions
Sometimes you have a string and you want to test if that string contains some text. For instance if
Sometimes you have a string and you want to test whether it contains some text. For instance, whether
'user\_123' starts with 'user\_'. You could use a test like __my_string[0..4] == 'user\_'__, but
there is a much more elegant and flexible way to do this kind of string testing, called
regular expressions.

Reason this isn't in TryRuby lessons is the fact that regular expressions have a syntax that is so
The reason this isn't in the TryRuby lessons is that regular expressions have a syntax that is so
strange at first, it might make your head explode. If you see a complex regular expression for the
first time, it is like a monkey has been randomly bashing away on a keyboard.

The regex for the example mentioned above is relatively simple:

my_string.match( /^user_(\d+)/ )

This will return __nil__ if my_string didn't conform to the regex, or a matchdata object if it did.
This will return __nil__ if my_string didn't conform to the regex, or a MatchData object if it did.
In the last case it will also give you the 123 part as the matched data.

The Ruby <a href="http://www.ruby-doc.org/core/Regexp.html" target="_blank">documentation</a> has
Expand All @@ -100,8 +100,8 @@ Now you can handle the missing method as if it existed. For instance you might w
a _sort\_by\_variable_ method. Where _variable_ is the name of one of your class variables.

### Inspection
Ruby can give you a lot of information about objects when a program is running. What an object is and
what methods it responds to.
Ruby can give you a lot of information about objects when a program is running, including what an object is
and what methods it responds to.

# Inspection
s = 'abc'
Expand All @@ -110,9 +110,9 @@ what methods it responds to.
puts s.respond_to?(:match)

### Error handling
Reality is that all programs can run into errors. Errors that only raise their ugly heads when your
The reality is that all programs can run into errors. Errors that only raise their ugly heads when your
program is running. And even when your code is flawless. That just happens.
You can let your program crash, but it is usually nicer if you let your program continue and politely tell
You can let your program crash, but it is usually nicer to let your program continue and politely report
that an error has occurred and it can't continue what it was doing.
Ruby has a couple of facilities for this purpose:

Expand All @@ -130,7 +130,7 @@ stupid).
raise "Yo dude seriously ? You can't enter zero for a divisor" if divisor == 0

### IO
You will often need to read or write diskfiles. That is easy in Ruby. For instance reading can be done with
You will often need to read or write disk files. That is easy in Ruby. For instance, reading can be done with
<a href="http://www.ruby-doc.org/core/IO.html#method-i-read" target="_blank">IO.Read</a>.

# Read a file
Expand All @@ -146,7 +146,7 @@ on whether the left hand side is smaller, equal to or bigger than the right hand
'a' <=> 'b' => Returns -1

### Class inheritance
When you are coding objects (classes) that model some real life situation, you will often encounter
When you are coding objects (classes) that model some real-life situation, you will often encounter
objects that are a subset of other objects. And there are many of such subsets.
This is where class inheritance comes to the rescue.

Expand Down Expand Up @@ -227,7 +227,7 @@ to give you a quick start to solve your coding problem. Gems are also very easy

### DRY
Not really a (Ruby) technique, but more a concept, DRY stands for __D__on't __R__epeat __Y__ourself.
Meaning: do not write te same piece of code twice.
Meaning: do not write the same piece of code twice.
When you are coding you will often find you need to write a bit of code that is the same as, or very similar
to, something you wrote before. Stop writing new code right then !!!
Instead find the existing similar code and extract it into a new method. Call the new method from the
Expand Down
12 changes: 6 additions & 6 deletions source/articles/2015-01-06-what-to-do-next.html.markdown
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: What's next
title: What's next?
date: 2015/01/06
author: Ivo Herweijer
the_summary: So, you finished the TryRuby lessons. Are you hungry for more ? Here are some tips to let you continue on the path to Ruby enlightenment.
the_summary: So, you finished the TryRuby lessons. Are you hungry for more? Here are some tips to help you continue on the path to Ruby enlightenment.
---

## What's next ?
So, you finished the TryRuby lessons. Are you hungry for more ?
## What's next?
So, you finished the TryRuby lessons. Are you hungry for more?

You can use the
<a href="/playground">TryRuby Playground</a>
Expand All @@ -26,9 +26,9 @@ You can find websites with lots more ideas (and suggested solutions) for coding
Maybe you can read a book on Ruby. I'm not giving any suggestions since I want to remain
impartial.

Follow an online course, of which there are many. And many are also free.
Follow an online course, of which there are many. Many are also free.

Regardless what you do, you will find the Ruby
Regardless of what you do, you will find the Ruby
<a href="http://www.ruby-doc.org/core/" target="_blank">documentation</a>
an invaluable resource.

Expand Down
2 changes: 1 addition & 1 deletion source/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description: Learn to program in Ruby in 30 minutes
</h1>

<div id="tryruby-content">
<p>Ruby is a programming language from Japan which is revolutionizing software development.</p>
<p>Ruby is a programming language from Japan that is revolutionizing software development.</p>
<p>The beauty of Ruby is found in its balance between simplicity and power.</p>
<p>You can type some Ruby code in the editor and use these buttons to navigate:</p>

Expand Down
Loading