CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5,...

23
CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

Transcript of CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5,...

Page 1: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

CMPE 131 Software Engineering

September 5, 2017

Presented By

Melvin Ch’ng

Ruby on Rails Introduction

Page 2: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

Agenda• Native App vs Web App

• What is Ruby on Rails?

• MVC Architecture

• What can you do with Rails?

• What I have done with Rails?

• RESTful API

• Getting started with Rails & Material Framework

• Build and deploy a Web App in 10 min?

• Possible Rails project ideas

• Q&A

9/5/2017 © MELVIN CH'NG 2

Page 3: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

Native App vs Web App•Native App• Develop, build, and install on and for a device/platform

• Faster and more efficient

• More expensive to develop

• Usually can be access via app stores/distributor

• Web App• Any internet enabled device

• Do not need to download, but internet is required

• Higher costs of maintenance

• Lower quality control

9/5/2017 © MELVIN CH'NG 3

Page 4: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

Native App Scenario•Alice is the owner of a grocery store. She would like to

have a POS (Point Of Sale) solution for her business. She is looking for a system that is able to keep track of their inventory, sales, and cash. Each of the checkout counters should have one POS system.

•Why Web App is not the best choice?• Unable to access the application without internet access

• Note: Web App can run locally

9/5/2017 © MELVIN CH'NG 4

Page 5: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

Web App Scenario• Bob is the leader of a NGO (non-governmental

organization). He wants a solution for public to report to their organization via questionnaire. This is to ensure that their organization can improve based on the information they receive from public.

•Why Native App is not the best choice?• Not everyone is willing to install an app just to submit a

feedback or to perform a specific task that takes only a few seconds to complete

9/5/2017 © MELVIN CH'NG 5

Page 6: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

What is Ruby on Rails

•A server-side web application framework written in Ruby

•Model-View-Controller (MVC) framework• Structure for database, web

service, web pages

•Use web standards• JSON or XML for data transfer

• HTML, CSS and Javascript for display and UI

9/5/2017 © MELVIN CH'NG 6

Page 7: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

What is Ruby on Rails, cont’d

•Uses and emphasize the use of well-known software engineering patterns and paradigms• Convention over configuration (CoC)• Configuration files for default project structure have

been setup

• Don’t repeat yourself (DRY)• Does not require change in other logically unrelated

elements

• Active record pattern• Object instance tied to a database table

9/5/2017 © MELVIN CH'NG 7

Page 8: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

Model-View-Controller (MVC)

Source: http://www.whitesunrise.com/technology/ruby-on-rails-development/

9/5/2017 © MELVIN CH'NG 8

Page 9: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

What can you do with Rails?

• Challenge your creativity with limits

• From software to system integration

• Hardware interacting with Software, vice versa

Anything!

• http://awesomerails.com/

List of Apps Made with Rails

9/5/2017 © MELVIN CH'NG 9

Page 10: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

What have I done with Rails?• Conference Website • Jekyll on Rails

•Data Analysis Web Application• Analyze California State University Employees’ salary

•Quotation Generator Web Application• Generate quotation based on the measurements

• ChatBot Web Application• Integrates with API.ai

• 24 hours hackathon project, team of 4

9/5/2017 © MELVIN CH'NG 10

Page 11: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

What have I done with Rails?, cont’d• CorgiBot• Hardware and Software Integration (System)• An autonomous robot that moves and look for items• 24 hours hackathon project, team of 4• Top 10 teams in AngelHack Global Hackathon Series: SF• Best use of Amazon Web Services award

• SOMII• Hardware and Software Integration (System)• An interactive and educational booth that uses image

reorganization• 6 months long prototyping project, team of 4• Awarded 4th Place in Paseo Public Prototyping Challenge

9/5/2017 © MELVIN CH'NG 11

Page 12: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

What have I done with Rails?, cont’d• CorgiBot

9/5/2017 © MELVIN CH'NG 12

Page 13: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

What have I done with Rails?, cont’d• SOMII

9/5/2017 © MELVIN CH'NG 13

Page 14: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

Data Analysis Website•Data Analysis Website• Analyze California State University Employees’ salary

• Data available from Transparent California’s Website

• Downloaded and Imported as CSV

• About 70,000 – 90,000 rows of data each year

• http://SampleDataAnalysis.herokuapp.com

• Built in 36 hours

9/5/2017 © MELVIN CH'NG 14

Page 15: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

CorgiBot•Hardware and Software Integration (System)

•An autonomous robot that moves and look for items

• 24 hours hackathon project, team of 4• Top 10 teams in AngelHack Global Hackathon

Series: SF• Best use of Amazon Web Services award• Ruby on Rails, Action Cable, Heroku, PostgreSQL,

SparkPost, Redis, Intel Edison, Python, Python, Redis, Alexa, AWS IoT, S3, Lambda, and Rekognition.•www.hackathon.io/cats-and

9/5/2017 © MELVIN CH'NG 15

Page 16: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

9/5/2017 © MELVIN CH'NG 16

CorgiBot, cont’d

Intel Edison

AWS Lambda

USB Camera

Sensors, Motors, etc Battery

User

Echo Dot/ Echo Alexa Skill

Page 17: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

RESTful API • “Language of Internet”

• Take advantage of HTTP methodologies• GET, PUT, POST, DELETE Data

9/5/2017 © MELVIN CH'NG 17

Intel Edison

USB Camera

Sensors, Motors, etcBattery

User

Page 18: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

Getting Started with Rails• [FREE] Ruby on Rails Tutorial written by me• http://melvinchng.github.io/rails

• A lot of examples and screenshots

• [FREE] Michael Hartl’s Ruby on Rails Tutorial• https://www.railstutorial.org/book

9/5/2017 © MELVIN CH'NG 18

Page 19: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

Material Design Framework• Modern responsive CSS framework

based on Material Design by Google

• Can be seen in Apps created by Google

• Stock Android design

• Sample site: http://materialize-rails-template.herokuapp.com/

• Source code: https://github.com/melvinchng/Materialize-Rails

9/5/2017 © MELVIN CH'NG 19

Page 20: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

Question: Is it possible to…

•Set up Rails Web Application with the criteria below in less than 10 minutes. • Material Design Framework

• User Authentication

• Deploy to the Cloud

9/5/2017 © MELVIN CH'NG 20

Page 21: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

Question:Is it possible to…, cont’d

•Video Link: https://youtu.be/MAQRKCLDSH0

•Source: http://melvinchng.github.io/rails/SetupChallenge.html

9/5/2017 © MELVIN CH'NG 21

Page 22: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

Possible project ideas for CMPE 131

Pet rental service

• Short term (hours, days, weeks) – Long term (months)

1

Dating site for busy engineering students

• Determine the best match between users

2

DoorDash for Alcohol

• Tired of going out to get a drink?

3

9/5/2017 © MELVIN CH'NG 22

Page 23: CMPE 131 Software Engineering - melvinchng.github.io · CMPE 131 Software Engineering September 5, 2017 Presented By Melvin Ch’ng Ruby on Rails Introduction

9/5/2017 © MELVIN CH'NG 23