web application development and advanced web app development cs1019/cs2012 introduction bruce...

36
Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Upload: mariah-lover

Post on 01-Apr-2015

223 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Web Application Development and

Advanced Web App DevelopmentCS1019/CS2012

Introduction

Page 2: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Why are you here?

Write answer down on piece of paper and discuss it with the person next to you

Page 3: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

This course sets up your programming experience

• Programming language• Programming concepts• Programming tools • Bootstrap you so that you know how to

deal with unforeseen events

Page 4: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

The two course organisers

• Nigel Beacham for Web App Development• Bruce Scharlau for Advanced Web App Dev

Page 5: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Take control of your own learning

• Lectures once a week• Practical sessions once a week• Coursework at regular times• Book list• Web sites

Also course guides to help you - so read them first

Page 6: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

This week’s practical puts software on your laptop

• Bring your laptop to this week’s practicals• There are often little problems to resolve,

so install software ahead of time before proper practicals start next week.

• Come and see how it’s done if you intend to install it on desktop at home

• See what problems you may need to watch for when you do it on your own

Page 7: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Use a virtual Linux machine

We STRONGLY recommend you install a virtual Linux machine on your laptop if you’re on a Windows laptop

Using a Linux box to learn Ruby programming will make your life easier and has proven to be a better practice by previous students

Page 8: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Programming needs practice• You are expected to spend at least an hour a

day working through examples to learn to program

• You need time to become familiar with programming so that you understand how the examples work

Page 9: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Programming needs practice

You are unlikely to pass the course, if you do not spend the time practicing examples

Page 10: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

There is no substitute for time at the keyboard

• You need to practice so that you assimilate the materials

• This means you should do an hour of programming exercises each day –over and above classwork

Time spent practicing now pays off with better course marks

Page 11: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Bookmark and use the web sites

MyAberdeen will have most everything you need – Recorded lectures– Quizes

You can also find most materials at:

http://homepages.abdn.ac.uk/b.scharlau/pages/teaching/CS5550/practicals/

Page 12: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Check Q & A in forums at MyAberdeen

• Put questions in discussion forum on webCT and we and your classmates can answer them for you.

• Everyone can see the answer.

Page 13: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Use these books on the course • Hunt, Andy.

Pragmatic Thinking and Learning: Refactor Your Wetware Pragmatic Bookshelf, 2008. For your learning

• Ruby, Sam. Agile Web Development with Rails (4th edition), 2011.  Pragmatic Bookshelf. This is the latest edition and covers Rails 3. For Rails

• Wynne, Matt and Hellesoy, Aslak. The Cucumber Book: Behaviour-Driven Development for Testers and Developers. January 2012 Pragmatic Bookshelf. For testing Ruby and Rails

Links on website and MyAberdeen

Page 14: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Use this software on the course

Application/Library and version numbers

• Ruby – Ruby 1.9.x• RubyGems – package installer• plus assorted gems as detailed elsewhere

• Rails – Rails 3.0.x • Sqlite3 for the database• Git for version source control

Page 15: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

You also need a text editor• Text editor provides clean place to write

programs. • Komodo Edit is free on all platforms

– http://www.activestate.com/komodo_edit/

MS Word is NOT a text editor

Page 16: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

text editor is needed because …

• It shows all of the characters in a file• A word processed file has many other

characters in the file than are shown on the screen

• Your program needs to only run what you give it

Page 17: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Assessment work is important

• Assessment work accounts for 50%• A ruby one for 25% and a rails one for 25%• Exam counts for 50% of mark

• Assessment work accounts for 100%• 20 weekly assignments, 30% on team

assignment & 50% individual assignment

WAD

AWAD

Page 18: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Coursework is important

In order to pass the course you MUST submit

assessments

You cannot rely upon only passing the exam

Page 19: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Why study programming?• Because it's a combination of intelligent and

creative work.• The pride of seeing your work used by other

people.• Get paid to have fun.• Be able to program anywhere, anytime, with

my choice of platform, programming language, and architecture.

• http://www.ddj.com/architect/196603871

Page 20: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Agile development process

• We’ll focus on agile development • http://agilemanifesto.org/ • Our concern is: incremental and iterative

development • Do small steps often in other words

Page 21: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Use software tests to support your code

• We’ll also focus on writing tests for our code to check it does what it should

• This provides a safety net so we know when we broke the app with our new code

Page 22: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Let us know if there are problems

• We rely upon YOU to give us feedback• Let us know what’s working well• Let us know what’s not working• Let us know where you’re having problems

understanding something

If you tell, us then we can do something.If you don’t tell us, then we don’t know.

Page 23: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

What is programming?

• Write it down on page…

• Share it with person next to you…

Page 24: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

‘what is programming?’: answer

• Telling the computer what to do• Warning:

– (a) it follows your instructions, so if you get it wrong…

– (b) if you leave out an instruction, then …

Page 25: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

We write programs to make instructions easier to maintain

• Use programming language to make it easier for us

• Computer only understand binary• 01100011 01101111 01101101 01110000 01110101 01110100

01100101 01110010 01110011 00100000 01101111 01101110 01101100 01111001 00100000 01110101 01101110 01100100 01100101 01110010 01110011 01110100 01100001 01101110 01100100 00100000 01100010 01101001 01101110 01100001 01110010 01111001

Page 26: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

There are a lot of programming languages out there

• Compiled languages– C, C++, Lisp, Visual Basic, others

• Interpreted languages– Shell scripting such as bash, csh, and others– Interpreted languages PHP, JavaScript– Intermediate interpreted languages

• Python, Ruby• Java and C# are first compiled to virtual machine

code and then interpreted

Page 27: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

We’ll use Ruby

• Public since 1995, same as Java• Hit massive growth with public release of

Rails in Feb 2005• Growing impact in programming world

• http://en.wikipedia.org/wiki/Ruby_(programming_language• http://www.ruby-lang.org/en/

• http://en.wikipedia.org/wiki/Ruby_on_Rails • http://rubyonrails.org/

http://en.wikipedia.org/wiki/File:Ruby_logo.svg

Page 28: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Ruby offers lots of advantages

• Easy to read• Object orientated, so easy to use

– Objects, classes, methods• Less frustrating to use, so you make fewer

errors• Runs on lots of platforms, and is free• Plenty of ‘extra’ libraries you can add for

other features to cover math, graphics, etc

Page 29: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Time for a demo

• We need the following – Text editor to write program– Command line to run/execute the program

Page 30: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

We used strings and integers

• Strings are between quotations marks• Integers are numbers• If we multiply strings then they are printed

out that many times• Puts means ‘print string and add a new

line’

Page 31: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Have a strategy to handle errors

• Read the error message- there is often a clue there

• Think through the steps you put in the code – sometimes you put the steps out of order

• Google the error message – others will have probably also had the problem

Page 32: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Variables are assigned values

a = 23

name = ‘fred’

b = ‘twenty’

a = b

• Variables are like labels on boxes, and some boxes have more than one label

• So what’s the value of ‘a’ at the end?

Page 33: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Assignment uses the = symbol

Always assign the variable on the left with the value on the right

a = 23

a = a+23

name = ‘fred ’ + a.to_s

What’s the value of ‘a’?

Page 34: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Use gets for keyboard input

puts ‘what\’s your name?’

name = gets

puts ‘Hello ‘ + name

• Why is there a \ (backslash)?• Why is there a space after Hello?

Page 35: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Also be developing web apps

• You’ll be putting web apps online before the end of term

• Start with basic Ruby first so that you understand what’s happening in Rails code

Page 36: Web Application Development and Advanced Web App Development CS1019/CS2012 Introduction Bruce Scharlau, University of Aberdeen, 2012

Bruce Scharlau, University of Aberdeen, 2012

Practice

The DIT labs have all that you need to run Ruby so you can run through some of the exercises that are in any of the books

Read first few chapters before the practical

Also start reading the course guide