Cs3180 (Prasad)LSysVsScipt1 Scripting vs Systems Programming Languages u Designed for gluing applications : flexibility u Interpreted u Dynamic variable.

Slides:



Advertisements
Similar presentations
Intro to Scala Lists. Scala Lists are always immutable. This means that a list in Scala, once created, will remain the same.
Advertisements

1 Scheme and Functional Programming Aaron Bloomfield CS 415 Fall 2005.
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
A Crash Course Python. Python? Isn’t that a snake? Yes, but it is also a...
Language of the Month If it’s December, it must be Ruby! Adam Coffman and Brent Beer.
CSE 341, Winter Type Systems Terms to learn about types: –Type –Type system –Statically typed language –Dynamically typed language –Type error –Strongly.
GUIs Part 4 CS221 – 4/17/09. Professional Assignments Assignment #2 – Download and install Visual Studio 2008 Professional Trial Software –
ISBN Chapter 1 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Motivation Programming Domains.
Ruby The Gem of new programming languages. An interpreted scripting language.
Introduction to Python John Alexis Guerra Gómez CMSC433 Spring 2010 University of Maryland.
Data Structures Introduction. What is data? (Latin) Plural of datum = something given.
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
Scripting Languages CS 351 – Programming Paradigms.
Scripting Languages CS351 – Programming Paradigms.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
Unit Six Assignment 1 Chris Boardley.
Languages and tools. BY SA machine code.
Python.
CS 355 – Programming Languages
Cs784(Prasad)L1Intro1 Systematic Development of Programming Languages.
Scripting Languages Intro Jan Stelovsky, ICS 215.
1 Python CIS*2450 Advanced Programming Concepts Material for this lecture was developed by Dr. D. Calvert.
Java Packages and Libraries M Taimoor Khan
Programming language A programming language is an artificial language designed to communicate instructions to a machine,languageinstructionsmachine particularly.
By Neng-Fa Zhou1 Evolution of programming languages –Machine language –Assembly language –Sub-routines and loop (Fortran) –Procedures and recursion (Algol,
CS 355 – PROGRAMMING LANGUAGES Dr. X. Common LISP A combination of many of the features of the popular dialects of LISP around in the early 1980s A large.
Programming Languages and Paradigms Object-Oriented Programming (Part II)
Effective Java: Generics Last Updated: Spring 2009.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
CIS 644 Aug. 25, 1999 tour of Java. First … about the media lectures… we are experimenting with the media format please give feedback.
1 Programming Language History and Evolution In Text: Chapter 2.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
ICS 313 Fundamentals of Programming Languages Instructor: Abdul Wahid Wali Lecturer, CSSE, UoH
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
Intro to Python Adriane Huber Debbie Bartlett Python Lab #1Python Lab #1 1.
C463 / B551 Artificial Intelligence Dana Vrajitoru Python.
Comparative Programming Languages Language Comparison: Scheme, Smalltalk, Python, Ruby, Perl, Prolog, ML, C++/STL, Java, Haskell.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and web applications Very rich GUI libraries Portability (machine independence) A real Object.
An Introduction. What is Python? Interpreted language Created by Guido Van Rossum – early 90s Named after Monty Python
Anonymous Classes An anonymous class is a local class that does not have a name. An anonymous class allows an object to be created using an expression.
RUBY by Ryan Chase.
9-Nov-97Tri-Ada '971 TASH An Alternative to the Windows API TRI-Ada ‘97 Terry J. Westley
Programming Languages
More Java: Static and Final, Abstract Class and Interface, Exceptions, Collections Framework 1 CS300.
C H A P T E R T H R E E Type Systems and Semantics Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
Cs3180 (Prasad)L156HOF1 Higher-Order Functions. cs3180 (Prasad)L156HOF2 Equivalent Notations (define (f x y) (… body …)) = (define f (lambda (x y) (…
YG - CS Concept of Encapsulation What is encapsulation? - data and functions/methods are packaged together in the class normally.
Scripting Languages Info derived largely from Programming Language Pragmatics, by Michael Scott.
By: Chad Gallati, Melissa Plakyda, Jenny Wilkes References: /a-z_programming_languages_groovy/
Apache Avro CMSC 491 Hadoop-Based Distributed Computing Spring 2016 Adam Shook.
First appeared Features Popular uses Basic This language emphasises on ease of use, allowing general purpose programming to those with a small amount of.
Python : highlights Based on T. K. Prasad’s slides.
Programming Language History and Evolution
The language focusses on ease of use
CST 1101 Problem Solving Using Computers
Sixth Lecture ArrayList Abstract Class and Interface
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
Scripting Languages Info derived largely from Programming Language Pragmatics, by Michael Scott.
3 Introduction to Classes and Objects.
Introduction Python is an interpreted, object-oriented and high-level programming language, which is different from a compiled one like C/C++/Java. Its.
Unlocking the Development Power of Ignition with Python Scripts
Programming Language History and Evolution
Henning Schulzrinne Advanced Programming
Introduction to Computers and Python
Introduction to Python
Chapter 11 Introduction to Programming in C
Chapter 11 Introduction to Programming in C
(more) Python.
Presentation transcript:

cs3180 (Prasad)LSysVsScipt1 Scripting vs Systems Programming Languages u Designed for gluing applications : flexibility u Interpreted u Dynamic variable creation u Data and code integrated : meta-programming supported u Dynamic typing u Examples: PERL, TCL, Ruby, Scheme, Visual Basic, Python, Jython, Scala, Clojure, etc u Designed for building applications : efficiency u Compiled u Variable declaration u Data and code separated : cannot create/run code on the fly u Static typing u Examples: PL/1, Ada, Java, C/C++, C#, etc

cs3180 (Prasad)LSysVsScipt2 (cont’d) u Does application implement complex algorithms and data structures? u Does application process large data sets (>10,000 items)? u Are application functions well-defined, fixed? If yes, consider a system programming language. u Is the main task to connect components, legacy apps? u Does the application manipulate a variety of things? u Does the application have a GUI? u Are the application's functions evolving rapidly? u Must the application be extensible? u Does the application do a lot of string manipulation? If yes, consider a scripting language.

cs3180 (Prasad)LSysVsScipt3 Current Trends u Hybrid Languages : Scripting + Systems Programming –Recent JVM-based Scripting Languages »Jython : Python dialect »Clojure : LISP dialect »Scala : OOP +Functional –Recent.NET-based Scripting Languages »IronPython : Python dialect »ClojureCLR : LISP dialect »F#: OOP +Functional + Imperative

cs3180 (Prasad)LSysVsScipt4 Current Trends Multi-paradigm languages Language vs. Platform Multilingual Programming on Java or.NET platform

cs3180 (Prasad)LSysVsScipt5 Jython (for convenient access to Java APIs) I:\tkprasad\cs480>jython Jython 2.1 on java1.4.1_02 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> import javax.swing as swing >>> win = swing.JFrame("Welcome to Jython") >>> win.size = (200, 200) >>> win.show() >>> ^Z

cs3180 (Prasad)LSysVsScipt6 Java vs Jython map = new HashMap(); map.put("one",new Integer(1)); map.put("two",new Integer(2)); map.put("three",new Integer(3)); System.out.println(map.get("one")); list = new LinkedList(); list.add(new Integer(1)); list.add(new Integer(2)); list.add(new Integer(3)); map = {"one":1,"two":2,"three":3} print map ["one"] list = [1, 2, 3]

cs3180 (Prasad)LSysVsScipt7 (cont’d) for i in list: (* iterator *) newList = [function(i) for i in oldList] (* list comprehension *) for (Iterator i; i.hasNext();) { i.next(); } List newList = ArrayList() for (Iterator i; i.hasNext();) { Object obj = i.next(); newList.add(function(obj)) }

cs3180 (Prasad)LSysVsScipt8 Defining functions and expressions in P(J)ython (file: eg.py) (Python 2.75 incompatible with Python 3.3) list = [pow(i,i) for i in [1,2]] [1, 4] from math import * print(“PI=%f, e=%f” % (pi,e)) Y = range(1,9,1) Y [1,2,3,4,5,6,7,8] or range(1, 9) Y[1:3] [2, 3] or range(2, 4) Y[::2] [1, 3, 5, 7] or range(1, 9, 2) def fac(x) : ''' factorial function ''' if x <= 1: return 1 return x*fac(x-1) fac(20) print(fac(5), fac(20) ) print(fac.__doc__) factorial function x = 2 + 3j x.imag + x.conjugate() # (5 – 3j)

cs3180 (Prasad)LSysVsScipt9 More Jython code examples u Dynamic code evaluation print eval (“[1,3] + range(6,10,3)”) [1,,3, 6, 9] x = 2 + 3j exec “x = 5, x + x” (5, (4+6j)

cs3180 (Prasad)LSysVsScipt10 Cont’d u Exceptions def readfile (name): “return lines in file or None if unreadable” try: file = open(name, ‘r’) try: # raise IOError return file.readlines() finally: file.close() except IOError, ioe: print “Exception –”, ioe

cs3180 (Prasad)LSysVsScipt11 Cont’d u Jython Functional Programming apply(lambda x,y : x*y, (10, 20)) # 200 map(lambda x,y: x + y, [[1,2],[“a”]], [[“3”],[“b”]]) # [[1, 2, ‘3’], [‘a’, ‘b’]] reduce(lambda x,y: x + y, [1,2,3], 100) # 106 filter(lambda x: x > 0, range(10,-5,-3)) # [10, 7, 4, 1]

cs3180 (Prasad)LSysVsScipt12 import java.lang as lang import javax.swing as swing import java.awt as awt names = ["Groucho", "Chico", "Harpo"] quotes = {"Groucho": "Say the secret word", "Chico": "Viaduct?", "Harpo": "HONK!"} def buttonPressed(event): field.text = quotes[event.source.text] def exit(event): lang.System.exit(0) def createButton(name): return swing.JButton(name, preferredSize=(100,20), actionPerformed=buttonPressed) Java functionality through Jython

cs3180 (Prasad)LSysVsScipt13 win = swing.JFrame("Welcome to Jython", size=(200, 200),windowClosing=exit) win.contentPane.layout = awt.FlowLayout( ) field = swing.JTextField(preferredSize=(200,20)) win.contentPane.add(field) buttons = [createButton(each) for each in names] for eachButton in buttons: win.contentPane.add(eachButton) win.pack( ) win.show( )