0% found this document useful (0 votes)
35 views10 pages

Altcademy S Back-End Web Development Syllabus

The document provides an overview of Altcademy's back-end web development syllabus which focuses on teaching Ruby on Rails. It explains that Ruby on Rails was chosen as the framework to teach because Ruby code is easy to learn, Rails uses conventions over configurations, and it has a long history. The syllabus covers installing Ruby, Ruby basics like variables and data types, program structure with methods and control flow, data structures like arrays and hashes, object oriented programming with classes and objects, and exercises to practice Ruby skills.

Uploaded by

jawadwafa795
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views10 pages

Altcademy S Back-End Web Development Syllabus

The document provides an overview of Altcademy's back-end web development syllabus which focuses on teaching Ruby on Rails. It explains that Ruby on Rails was chosen as the framework to teach because Ruby code is easy to learn, Rails uses conventions over configurations, and it has a long history. The syllabus covers installing Ruby, Ruby basics like variables and data types, program structure with methods and control flow, data structures like arrays and hashes, object oriented programming with classes and objects, and exercises to practice Ruby skills.

Uploaded by

jawadwafa795
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Altcademy’s Back-end Web

Development Syllabus
Ruby Programming
Programming language for Ruby on Rails

Why Ruby and Rails?


Unlike front-end, where the core languages are fixed, namely HTML, CSS, and JavaScript.
Back-end web applications can be written in many different languages and frameworks. Our
goal is not to teach you a particular framework, but to teach you the fundamental back-end
concepts which are transferable. We need a system that won’t get in the way of our teaching,
and will just function nicely. The criteria that we went with for selecting the framework for our
web development curriculum are the following:

1. The programming language should be easy to pick up for beginners.


2. The framework should be convention based and has strong model view controller
structure.
3. The framework should require the least effort to setup.
4. The framework should have a long history of development and a continuity outlook of at
least five years.

Based on these, we chose Ruby on Rails because Ruby code is very readable and easy to
learn. Rails is based on conventions rather than configurations which means a lot of design
decisions are already made for you; it has a strong model view controller structure, which is
arguably the most important concept in back-end server applications; it’s easy to setup and to
get going; and has been around since 2005 and will likely stay around for years to come.

But why not JavaScript and Node.js? Yes, using JavaScript for back-end too means you only
have to learn one programming language. However, JavaScript back-end frameworks are
mostly configuration based which means they tend to require a lot of setup and decision
making. The other downside is JavaScript frameworks tend to go out of fashion every two to
three years. And you end up having to learn a brand new one when it is the hot new thing, and
repeat this process every now and then.

That’s not to say you shouldn’t learn a Node.js framework in the future. But learning all the
crucial concepts through Ruby on Rails will make future transitions much more manageable.
To learn Ruby on Rails, you first need to learn basic programming in Ruby. You won’t have to
dive too deep into Ruby programming as generic back-end web server applications rarely
requires advanced programming concepts.

Part 1: Ruby Installations


Part 2: Ruby Basics
Part 3: Program Structure
Part 4: Data Structure
Part 5: Object Oriented Programming
Part 6: Ruby Exercises

Part 1: Ruby Installations


Getting Ruby setup is quite simple, we will provide you installation guides for Mac, Windows,
and Linux. After installing Ruby, you will learn how to execute a Ruby script file in your terminal.

Part 2: Ruby Basics


You will learn about the different value types in Ruby, operators for manipulating and comparing
data, and built in methods for different values.

● Values​ ​and Types​ - Back-end web development is all about dealing with data. So you
need to know the types of data you use in Ruby. A quick overview of Numbers, Strings
and Booleans is minimum. Also review the different operators for Numbers, such as ​+, -,
*, /, %, **.​ And how to concat strings in Ruby.
● Comparison and Logical Operators​ - Study how to compare values in Ruby using
comparison operators ​==, >=, <=, !=.​ Learn to combine comparison operators using
logical operators ​and, or, not​.
● Built-in Methods​ - Ruby comes with plenty of built-in methods for its data types.
Noteworthy ones include ​odd?​ and ​even?​ For Numbers; ​reverse​ and ​to_i​ for Strings. Get
comfortable manipulating different data types using methods and method chaining.

Part 3: Program Structure


As you will learn, the constituents of writing programs for most programming languages are
quite similar. It can generally be broken down into variables, statements, conditionals, loops,
and functions.

But different languages will have different strictness. A stricter programming language requires
the programmer to define more details in a program. Such as the datatype of the parameters a
function accepts, or how to handle errors when it happens.
More old school languages such as C++ and Java are stricter and harder to learn. While Ruby
and JavaScript are less strict and easier to pick up. You will learn the syntax of Ruby and how to
create basic programs.

● Variables​ - Variables are memory boxes used to remember values so they can be used
later. Learn to create variables in Ruby; assign and re-assign values to them; learn the
list of reserved words that cannot be used as variables names.
● Functions / Methods​ - Function is a box of program that takes inputs and returns an
output. In Ruby, functions are also called methods. Learn to define custom methods that
accept parameters and return outputs; and learn how to execute custom methods.
● Control Flow​ - Ruby executes programs in a top down flow. We can alter this flow by
adding control flow statements to our programs. These include conditional statements
that will only execute programs when certain condition is true; for loops and while loops
that let you repeat certain programs over and over again. Learn to incorporate control
flow into methods too.
● Ruby Best Practices​ - You will adopt a good best practice guide for code indentation
and variable naming convention. Keeping your code consistent and clean will make it
easy to read and extremely beneficial when it comes to bug finding.

Part 4: Data Structure


Apart from standard data values such as Numbers and Strings, you will learn how to create,
read, and manipulate data structures such as Array and Hashes. These are frequently used to
structure data sent between front-end and back-end applications, and are common data types
amongst most programming languages.

● Array​ - Array are used to store a collection of data. Usually, you would keep data of the
same type in an array. You will learn to create arrays, read values, and manipulate
arrays. Also learn to use array methods such as ​push, pop, shift, unshift​, and how to
iterate arrays using loops.
● Hashes​ - A hash, also called a dictionary, is a data structure used to store a collection of
arbitrary data. A hash is made up of properties, each property will have one key, and one
value. The key is used to retrieve the value, and each key needs to be unique in a hash.
You will learn how to create a new hash; how to read, add, and remove properties; and
how to iterate a hash.

Part 5: Object Oriented Programming


Object Oriented Programming, or OOP, is a design pattern for writing computer programs. Many
significant languages such as Java, C++, C#, Python, Ruby, Objective-C are OOP languages.
Ruby is also an OOP language. You will understand the fundamental design idea of OOP and
how it’s applied in Ruby programming.
● Class​ - A class is a concept in OOP where certain types of objects belong to the same
class. An analogy would be that ​Cats​, ​Dogs,​ ​Lions​ all belong to the ​Animal​ class.
Because they share certain common characteristics. Different breeds of cats will then be
subsets of the ​Cats​ class. And A ​ nimal​ is the superset of all those classes. You will learn
how to define custom classes.
● Instance​ - Classes can be thought of as blueprints, which are used to create actual
objects from. The objects created from a class are called class instance. Learn to
generate object instances from classes using the ​new​ keyword.
● Inheritance​ - A class will inherit methods and properties from its superclass, e.g. ​Cats
and ​Dogs​ will inherit from the ​Animal​ class. This reduces redundancy so code that is
common across multiple classes do not have to be repeated. Learn to declare
inheritance when creating a new class.
● Attributes​ - Learn to create instance attributes in Ruby classes that have both read and
write capabilities. Also learn to instantiate attributes during the class instance creation
process and to define default attribute values.
● Attribute Visibility​ - You can set the visibility of class methods and attributes to one of
three values, ​public, protected, ​or​ private.​ Public attributes can be accessed outside of
the class definition, while protected and private attributes can only be accessed during
class definition. Protected attributes are inherited by subclasses but private attributes are
not. Learn to create all three types of class attributes.
● Instance vs Class Attributes​ - Instance attributes are independent between class
instances, edits to one won’t affect others. But we can also create class attributes too.
Class attributes are tied to a class, it can be used to store data that needs to be shared
amongst class instances. Learn to create class attributes during class definition.
● Super​ - When you create a new subclass that inherits a parent class but you have a
method in the subclass that shares the same name as a method in the parent class, the
subclass method will completely overwrite the parent class method. If you want the
method of the parent class to run before the subclass method executes, you can use the
super​ keyword in the definition of the subclass method. This is also useful for instance
initialization so that attribute instantiation code doesn’t have to be repeated in
subclasses.

Part 6: Ruby Exercises


You need to get comfortable coding in Ruby before learning how to write Ruby on Rails
applications. The best way to improve is to practice. We will provide you plenty of Ruby
programming exercises.

👋 If you are looking for a full fledged program with mentorship and career guidance, check out
our ​Full-stack Web Development Program​.
Back-end Development in Ruby on Rails
Storing and manipulating data permanently

What does a back-end web server application do?


If you have noticed, front-end is mostly just the UI (user interface) view of an application. All of
the front-end website that you build are not able to remember states, unless you connect them
with a back-end application.

A back-end web server application deals with data storage and business logic. It’s all about
creating, retrieving, modifying, and deleting data. Say a message board such as Twitter, where
the core business logic is tweet creation and tweet retrieval. But of course there are also other
things to consider, such as user authentication, data validation, and security.

So how does a back-end server application interaction work? Well there are three parts to it.
First, the party that wants to interact with the back-end has to send a request. This is usually a
person on a web browser. For example, Lily who wants to post a new tweet on her Twitter feed.

1. Lily types a message and clicks the tweet button. The JavaScript program in the browser
that handles this action translates it into a ​Post​ request and sends it to the back-end of
Twitter.
2. The Twitter back-end receives the request and starts processing it. It adds the tweet to
the database and does whatever tasks it needs to.
3. Twitter back-end then sends a response back to Lily’s browser. Most likely saying that
the tweet has been successfully added. Also, the data of the new tweet is usually sent
back with the response as well.

At this point, the job of the back-end is done. It is up to the front-end how to deal with the
response. If the tweet was successfully added, then the front-end will likely update Lily’s feed to
reflect that. Otherwise, it will show an error message.

But here’s the thing, a back-end server is only able to execute the tasks it is programmed for.
You cannot send a request to post a new tweet on your Twitter account to Google’s back-end
server. So, how do we know what kind of tasks a back-end server can carry out?

This is exactly the purpose of an ​Application Programming Interface (API).​ An API is a set of
definitions of routines. For a back-end web application, an API refers to the logic of all the
requests it is programmed to handle. APIs will generally come with API documentation too,
which is how other programmers can learn how to use a particular back-end API.
You will learn the model-view-controller (MVC) structure of a Ruby on Rails back-end
application. How to define routes for a back-end server. How to create, edit, delete data in a
database. How to process requests and send back responses. How to write application features
such as user authentication, photo upload, email sending. How to write automated tests. And
finally deploy your back-end application live onto the web.

Part 1: Rails Installations


Part 2: What is Model-View-Controller
Part 3: Writing Back-end Web Application with Ruby on Rails
Part 4: Learn by Example - ToDo List
Part 5: Deploying Your Application
Part 6: Model Validations
Part 7: User Authentication
Part 8: Project - Twitter Clone
Part 9: Libraries and Integrations

Part 1: Rails Installations


If you have Ruby installed successfully, installing Rails becomes fairly straightforward. Since
Rails is really just a Ruby package, it only takes one command line instruction to install.

● Third Party Services​ - After installing Rails, create your accounts for Heroku and
Amazon Web Services (AWS). Heroku is a minimal setup hosting service for web
applications, we will be deploying our back-end applications on Heroku. AWS is a suite
of tools for web hosting when you need fine control over your servers. We will use some
of its services for data storage.

Part 2: What is Ruby On Rails


Ruby on Rails is a web application framework built using the programming language Ruby. Its
purpose is to provide web developers tools and standards to build back-end web applications
very quickly.

The key difference between Ruby on Rails and other web frameworks is its convention over
configuration philosophy. In Ruby on Rails, much of the mundane decisions are already made
for you by ways of convention. So programmers can focus on things that actually matter, i.e. the
business logic.

● What is Model-View-Controller​ - Model-View-Controller (MVC) is an architectural


concept for developing computer applications. It was widely adopted in web application
development, the Rails’ application structure is based on the MVC pattern. ​Model
handles the data side of the application, and much of the business logic. ​View​ is
responsible for creating a user interface output that will be sent to the user client. This is
either in the form of a front-end web page (HTML, CSS, JavaScript), or just pure data.
Controller​ is the interface between ​Model, ​and ​View​. It handles incoming requests,
instructs the ​Model​ for data manipulation tasks, and instructs the ​View​ for rendering
output.
● Intro to Rails​ - MVC sits at the core of a back-end application. But there are many other
components that require management too. For example, route management, database
configuration, package dependency, application versioning, environment control, etc.
Rails is a suite that offers to take care of all things in web development. You will start by
learning how to create a new Rails application, run the server, and visit its homepage on
your browser.

Part 3: Writing Back-end Web Application with Ruby on Rails


You will learn the complete process of how to create a back-end application with Ruby on Rails.
Study topics such as database, migrations, associations, testing, routing, and the crucial MVC
components.

● Database​ - Back-end applications’ primary task is permanent data storage. You will
understand the concept behind ​relational databases​. Which is a type of database
structure popular for mission critical applications amongst financial institutions and large
internet companies. Also learn about database schema and migration.
● Model​ - Model is the first component of MVC. It's the core of data management in Rails
because it lives between the controller and the database. Rails has a feature called
Object-relational Mapping​ which lets you interact with the database without using the
database’s native programming language. Learn to create new models in Rails using the
generator command; add data attributes to migration files and run migration to edit the
database; and create a new data entry using the Rails console.
● Controller​ - Controller is the interface between model and view. When a request is sent
to the back-end, it will first be filtered by route management, then passed to the
corresponding controller for handling. In the controller file, you can define how you want
to handle and process the request. Learn to create controller methods and
corresponding route end points for GET/POST/PUT/DELETE requests; learn to test your
end points with the Postman app; learn to craft text and JSON responses directly in the
controller; and learn to read request params in the controller.
● Database Migrations​ - Migrations are a convenient way to alter database structure over
time in a consistent and simple manner. Traditionally, you have to write raw SQL to
modify the database schema. In Rails, you only need to write Ruby code to do the
migrations. Learn to add tables, attributes, and modify the database structure by using
migration.
● Associations​ - Association is a connection between two data tables. For example, you
can have a table for authors, and a table for books. And you can create a connection
between the books and their authors. This kind of connection is called an association.
Learn to add associations such as ​has_many, has_one, belongs_to​ to Rails models.
● Gemfile​ - The Gemfile allows us to define which Ruby libraries (gems) we want to use
for our Ruby project. Gemfile can be used for all Ruby projects, so it's not unique for
Rails. Learn how to read the Gemfile, and how to add gems to it.
● Testing​ - Automated testing is important in back-end applications. Often, test
specifications would be written for model, controller, and view, and the tests would be
run when changes are made to ensure everything works as expected. Learn to use the
rspec​ gem to add automated testing to your Rails application.
● Views​ - Back-end applications have the ability to return responses in different formats,
such as HTML, JSON, XML. The view component is in charge of determining the
response format. You will focus on using Rails as a pure API application and only write
responses in JSON for now. Learn to use the ​Jbuilder​ gem to construct JSON views.
● Environments​ - In Rails, there are three main environments: development, test and
production. Essentially, environments are segregated boxes where your actions in one
box don't affect other boxes. This allows you to do whatever you want in one
environment without worrying about messing up another environment. Learn to set up
different environment variables, gems, and behaviors for your Rails application.

Part 4: Learn by Example - ToDo List


Plan and implement the API endpoints of a ToDo list application. There is one model, and five
endpoints. The front-end application is already written and ready to connect with the API
endpoints.

● Tasks model​ - a model containing 3 attributes, ​content, completed, timestamps​. And a


validation that ​content​ must be present.
● GET /tasks​ - return all tasks from database.
● POST /tasks​ - create a new task based on given parameters.
● DELETE /tasks/:id​ - delete a task identified by its object id.
● PUT /tasks/:id/mark_complete​ - update a task to change completed to true.
● PUT /tasks/:id/mark_active​ - update a task to change completed to false.

👋 If you are looking for a full fledged program with mentorship and career guidance, check out
our ​Full-stack Web Development Program​.

Part 5: Deploying Your Application


It doesn’t matter how awesome your application is unless you are able to deploy it live. Also,
there are often many kinks in the way when you try to deploy a local project. So it is
recommended to deploy your application as early as possible, even if it doesn’t do anything yet.
So that you have the deployment process ironed out.

● Deploy to Heroku​ - Heroku is a simple to use application hosting service provider. It


acts as a layer on top of Amazon Web Services (AWS) that manages all the small details
of running your web server instance for you. Learn to create and deploy your local Rails
application to Heroku.

Part 6: Model Validations


When you submit a tweet on Twitter, it has a default limit of 140 characters. The best place to
validate this is in the model. Since model is the MVC component that manages all the business
logic for data. To do this, we use something called ​model validations​. Learn to add model
validations such as ​length, presence, absence, uniqueness, allow_blank.​

Part 7: User Authentication


When you post a new tweet on Twitter, the back-end needs to make sure you are the owner of
the account. Without a user authentication mechanism in place, users will be able to
impersonate each other. You will learn how to setup a login system to enable user
authentication.

● User​ - User authentication starts with a user model. Websites often use the user model
to hold information such as contact email, username, first and last name, and password.
Learn to create a user model to store username and password for a ToDo list application
so users can sign up for an account.
● Session​ - Once users can sign up, they need to be able to sign in too. Signing in
requires a concept called ​session​. A session is simply a database entry that records a
user’s unique sign in token which is also stored on a user’s browser. Everytime a user
makes a request from the browser, this token is sent together with the request. The
back-end application then checks and validates this unique token to authenticate the
user, before carrying out the tasks requested. Learn to implement the session system
and use it to ensure users are authenticated before carrying out tasks in other API
endpoints.
● Encrypting Passwords​ - If we store user passwords as plain text, we risk exposing
them if the server or database is compromised. This is especially damaging when users
use the same password across many different websites. Making their accounts on
multiple websites vulnerable. To combat this, we should encrypt the user’s password
stored in our database. Learn to use BCrypt to encrypt passwords for storing and
decrypt them when users login.

Part 8: Project - Twitter Clone


You are going to combine all the concepts you learned and build the API back-end for a Twitter
clone. The application comes with a front-end application that is ready to consume the API
endpoints you create. There will be three models and nine endpoints.
● Models​ - You will create three models, ​Users,​ ​Sessions​, and ​Tweets​.
● POST /users​ - create a new user based on given parameters.
● POST /sessions​ - create a new session based on given parameters.
● GET /authenticated​ - validate user authentication by comparing cookie with session
token.
● DELETE /sessions​ - delete session token from database to logout a user.
● POST /tweets​ - create a new tweet based on given parameters.
● DELETE /tweets/:id​ - delete tweet based on given id.
● GET /tweets​ - get all tweets by all users.
● GET /users/:username/tweets​ - get all tweet by one user.
● GET /tweets/search/keyword​ - get all tweet based on given keyword.

Part 9: Libraries and Integrations


Learn to add more features to a Rails back-end application by integrating third party libraries for
handling email sending and image uploads. These features will be incorporated into the Twitter
clone project.

● Photo Upload​ - Features in Rails can be quickly implemented by leveraging open


source libraries. Learn to use the ​Paperclip​ gem to add image upload capability to your
Twitter project. Learn to modify your database, model, controller, and view to allow users
to upload an image when creating a new tweet.
● Photo Upload with AWS S3​ - Heroku servers are not designed for permanent data
storage. So we need to store the images in a dedicated file storage server. Learn to
create an AWS S3 bucket for cloud data storage. And configure your Twitter project to
store the user uploaded images to S3 instead.
● Mailer​ - Emailing is a huge part of web applications. It's used for email confirmation,
notifications and more. Learn to add mailing capability to your Twitter project and send
out an email notification whenever a user successfully posts a new tweet.

You might also like