程序代写代做代考 asp.net javascript Haskell algorithm database interpreter Bioinformatics python cache scheme jquery SQL compiler ada data structure hbase prolog Java CGI ocaml COMP284 Scripting Languages – Handouts

COMP284 Scripting Languages – Handouts

COMP284 Scripting Languages
Lecture 1: Overview of COMP284

Handouts

Ullrich Hustadt

Department of Computer Science
School of Electrical Engineering, Electronics, and Computer Science

University of Liverpool

Contents

1 Introduction
Motivation
Scripting languages

2 COMP284
Aims
Learning outcomes
Delivery
Assessment

COMP284 Scripting Languages Lecture 1 Slide L1 – 1

Introduction Motivation

How many programming languages should you learn?

1 Academic / Educational viewpoint:
Learn programming language concepts and
use programme languages to gain practical experience with them
– imperative / object-oriented — C, Java
– functional — Maude, OCaml, Haskell
– logic/constraint — Prolog, DLV
– concurrent
then all (other) programming languages can be learned easily

2 An employer’s viewpoint:
Learn exactly those programming languages that the specific employer
needs

3 Compromise: Spend most time on 1 but leave some time for 2 to
allow more than one language from a class/paradigm to be learned

4 Problem: Which additional language do you cover?
; Look what is used/demanded by employers

COMP284 Scripting Languages Lecture 1 Slide L1 – 2

Introduction Motivation

Programming languages: Job ads

Software Developer
(Digital Repository)
University of Liverpool – University Library

£31,020 – £35,939 pa

To work as part of a small team based in the University Library, working closely

with the University’s Computing Services Department on the institutional digital

repository, recommending and developing technical solutions, tools and

functionality to integrate the repository with other internal systems and to enable

research outputs to be shared externally. You will be an experienced Software

Developer with knowledge of LAMP technologies such as XML, XSLT, Perl and

Javascript. You will hold a degree in Computer Science or a related discipline

and/or have proven industrial experience of software development. The post is

full time, 35 hours per week.

Job Ref: A-576989

COMP284 Scripting Languages Lecture 1 Slide L1 – 3

Introduction Motivation

Programming languages: Job ads

Senior Software Development Manager
IMDb Video and Recommendations (Seattle, WA)

IMDb (a wholly-owned subsidiary of Amazon) is recruiting for a Senior Software

Development Manager to lead our “What to Watch” team. You’ll be charged

with transforming IMDb from a reference site to a place where hundreds of

millions of people find and discover what to watch across a variety of video

providers, and seamlessly connect them with watching the movies and TV shows

best suited for them, wherever and whenever they may be.

Basic qualifications:
• Bachelor’s degree in Computer Science, Computer Engineering or

related technical discipline
• 10+ years of experience as a software developer
• 5+ years experience managing people
• Software development experience in OOP, Java, Perl, HTML, CSS,

JavaScript, Linux/UNIX, AJAX, MySQL

COMP284 Scripting Languages Lecture 1 Slide L1 – 4

Introduction Motivation

Programming languages: Job ads

Full-time Remote Worker
AOL Tech (Engadget, TUAW, Joystiq, Massively)

AOL Tech is looking for a great front-end developer who can help us take
Engadget and our other blogs to new levels.

The ideal candidate is highly proficient in JavaScript/jQuery, comfortable with

PHP / mySQL and experienced in web design, optimization and related

technologies for desktop and mobile. A solid understanding of mobile-first design

is a must.

Requirements:
• High proficiency in JavaScript/jQuery
• Familiar with spriting, lazy loading, and other general

performance-optimized techniques
• Mac access for compatibility with current tools
• HTML5/CSS3
• Git, SSH

COMP284 Scripting Languages Lecture 1 Slide L1 – 5

Introduction Motivation

Websites and Programming Languages

Website Client-Side Server-Side Database

Google JavaScript C, C++, Go, Java,
Python, PHP

BigTable, MariaDB

Facebook JavaScript Hack, PHP, Python,
C++, Java, . . .

MariaDB, MySQL,
HBase Cassandra

YouTube Flash,
JavaScript

C, C++, Python, Java,
Go

BigTable, MariaDB

Yahoo JavaScript PHP MySQL, PostgreSQL

Amazon JavaScript Java, C++, Perl Oracle Database

Wikipedia JavaScript PHP, Hack MySQL, MariaDB

Twitter JavaScript C++, Java, Scala MySQL

Bing JavaScript ASP.NET MS SQL Server
Wikipedia Contributors: Programming languages used in most popular websites. Wikipedia, The Free Encyclopedia,
20 October 2017, at 11:28. http://en.wikipedia.org/wiki/Programming_languages_used_in_most_popular_websites
[accessed 23 October 2017]

COMP284 Scripting Languages Lecture 1 Slide L1 – 6

http://en.wikipedia.org/wiki/Programming_languages_used_in_most_popular_websites

Introduction Scripting languages

Scripting languages

Script

A user-readable and user-modifiable program that performs simple
operations and controls the operation of other programs

Scripting language

A programming language for writing scripts

Classical example: Shell scripts

#!/bin/sh

for file in *; do

wc -l “$file”

done

Print the number of lines and name for each file in the current directory

COMP284 Scripting Languages Lecture 1 Slide L1 – 7

Introduction Scripting languages

Scripting languages: Properties

• Program code is present at run time and starting point of execution
• compilation by programmer/user is not needed
• compilation to bytecode or other low-level representations

may be performed ‘behind the scenes’ as an optimisation

• Presence of a suitable runtime environment is required for the execution
of scripts

• includes an interpreter, or just-in-time compiler, or bytecode compiler plus
virtual machine

• typically also includes a large collection of libraries

• Executation of scripts is typically slower then the execution of code that
has been fully pre-compiled to machine code

#!/bin/sh

for file in *; do

wc -l “$file”

done

COMP284 Scripting Languages Lecture 1 Slide L1 – 8

Introduction Scripting languages

Scripting languages: Properties

• Rich and easy to use interface to the underlying operating system,
in order to run other programs and communicate with them

• rich input/output capabilities, including pipes, network sockets, file I/O,
and filesystem operations

• Easy integration within larger systems
• often used to glue other systems together
• can be embedded into other applications

#!/bin/sh

for file in *; do

wc -l “$file”

done

COMP284 Scripting Languages Lecture 1 Slide L1 – 9

Introduction Scripting languages

Scripting languages: Properties

• Variables, functions, and methods
typically do not require type declarations
(automatic conversion between types, e.g. strings and numbers)

• Some built-in data structures
(more than in C, fewer than in Java)

• Ability to generate, load, and interpret source code at run time
through an eval function

JavaScript:
var x = 2;

var y = 6;

var str = “if (x > 0) { z = y / x } else { z = -1 }”;

console.log(’z is ’, eval(str )); // Output: z is 3

x = 0;

console.log(’z is ’, eval(str )); // Output: z is -1

COMP284 Scripting Languages Lecture 1 Slide L1 – 10

Introduction Scripting languages

Scripting languages: Properties

• The evolution of a scripting language typically starts
with a limited set of language constructs for a specific purpose

Example: PHP started as set of simple ‘functions’
for tracking visits to a web page

• The language then accumulates more and more language constructs
as it is used for a wider range of purposes

• These additional language constructs may or may not fit well together
with the original core and/or may duplicate existing language constructs

• During this evolution of the language, backward compatibility
may or may not be preserved

; Language design of scripting languages is often sub-optimal

COMP284 Scripting Languages Lecture 1 Slide L1 – 11

COMP284 Aims

Aims

1 To provide students with an understanding of
the nature and role of scripting languages

2 To introduce students to some popular scripting languages
and their applications

3 To enable students to write simple scripts using these languages
for a variety of applications

COMP284 Scripting Languages Lecture 1 Slide L1 – 12

COMP284 Learning outcomes

Learning Outcomes

At the end of the module students should be able to

1 compare and contrast languages such as JavaScript, Perl and PHP
with other programming languages

2 document and comment applications witten using a scripting language

3 rapidly develop simple applications, both computer and web-based,
using an appropriate scripting language

COMP284 Scripting Languages Lecture 1 Slide L1 – 13

COMP284 Delivery

Delivery of the module (1)

1 Lectures

• Structure:
16 to 18 lectures

• Schedule:
1 or 2 lectures per week spread over 9 weeks

See your personal timetable and e-mail announcements for details

• Lecture notes and screencasts are available at
cgi.csc.liv.ac.uk.uk/~ullrich/COMP284/notes

• Revise the lectures before the corresponding practical
• Additional self study using the recommended textbooks

and the on-line material is essential

COMP284 Scripting Languages Lecture 1 Slide L1 – 14

cgi.csc.liv.ac.uk.uk/~ullrich/COMP284/notes

COMP284 Delivery

Delivery of the module (1)

2 Practicals

• Structure:
– 7 practicals with worksheets (3 Perl, 2 PHP, 2 JavaScript)

; gain understanding via practice
; get answers to questions about the lecture material

– Up to 3 additional practicals for questions about the assignments

• Schedule:
1 practical per week for about 10 weeks

Practicals start in week 2

• Practicals assume familiarity with Linux and departmental Linux systems
; To recap, use the worksheets available at

cgi.csc.liv.ac.uk.uk/~ullrich/COMP284/notes

• Practicals assume familiarity with the related lecture material

COMP284 Scripting Languages Lecture 1 Slide L1 – 15

cgi.csc.liv.ac.uk.uk/~ullrich/COMP284/notes

COMP284 Delivery

How to learn a new programming language

• Once you know how to program in