The Many Languages of Web Development
Before going ahead with creating your own Rails application, here's an overview of the different languages you'll encounter
Getting started with web development involves learning about many different technologies. You need to learn about the whole "stack" of languages involved in creating a website, from the language the server uses to the one used to display a web page. Within each specific domain, you will still come across multiple languages and variants. Here's a quick overview of the stack of languages used in general web development and specific ones used in Ruby on Rails.
The Language Stack
A website that deals with users and data consists of many different components. The actual data (such as user information and the posts they create) is stored in a database and generally accessed with SQL. This data is displayed on web pages to users, which are structured with HTML. The presentation of web pages (such as colors and fonts) are controlled with CSS. The actual web application runs on a server (the "backend") and can be written in any general-purpose programming language. The web pages themselves can run additional code in the user's browser with a specific programming language - JavaScript.
The table below summarizes this information.
task | language | stands for |
---|---|---|
handle data | SQL | Structured Query Language |
structure page | HTML | HyperText Markup Language |
style page | CSS | Cascading Style Sheets |
run code on server | Any Programming Language | |
run code on page | JS | JavaScript |
Alternative Languages within each Domain
The above languages are essential for creating web applicationsAssuming they use a standard database, etc., but developers can also use additional languages within a domain to get more features or a more concise syntax. These "more-powerful" language variants are then converted into one of the above basic languages. For example, in Ruby on Rails it's common to use the languages in the column 3 as a substitute or in addition to the original language in the column 2:
Task | Language | Rails Substitute/Addition | Explanation |
---|---|---|---|
handle data | SQL | Rail's ActiveRecord | Uses concise Ruby to generate SQL |
structure page and content | HTML | Ruby ERB (and Haml) |
Ruby is needed within an HTML page to communicate with Rails. (Haml is optionally used to generate HTML) |
style page | CSS | Sass | A variant of CSS that provides more features |
run code on page | JavaScript | CoffeeScript | A variant of JavaScript commonly used by Rails developers |
(Beginners should learn the above languages in bold.)
Dealing with so many different languages can be confusing for a beginner, so it's best to focus on what's actually required. As a Rails beginner, you can just use Rail's ActiveRecord to communicate with the database instead of writing any SQL directly. (Later, you will need some SQL for full control.) Web pages are written in HTML, but you'll need Ruby code to display data from the backend inside the page, and Ruby will be useful for creating forms and links. (You don't need to worry about using Haml, an HTML 'shortcut' tool, and can just stick with HTML.) Sass adds some features on top of CSS, but you don't need to worry about them at the beginning. CoffeeScript provides a cleaner syntax than Javascript, but I think it's simpler to just use JavaScript at the beginning, since that's what you'll see in the browser and the examples you'll come across online.
While there are still many different languages to learn, you can focus on one at a time, building something with each one before moving on to the next. Before you know it, you'll be familiar with the full-stack that websites are built with!