Universit di Pisa Advanced Programming Giuseppe Attardi Dipartimento
- Slides: 48
Università di Pisa Advanced Programming Giuseppe Attardi Dipartimento di Informatica Università di Pisa
Language is an instrument of human reason, not merely a medium for the expression of thought. G. Boole, An Investigation of the Laws of Thought, 1854
Instructors Giuseppe Attardi Office: 292 Mail: attardi@di. unipi. it Haoyuan Li Office: 373 Mail: li@di. unipi. it
Introduction l Programming in the 21 century l Software as complex as ever l Command line interface not enough l Data must be structured in a DB l Single computer not enough l Software development is a group activity
Requirements l Cannot start from scratch l Reusable components are needed l OS + libraries not enough
Elements of a Solution l Software Framework l Component Model l Execution Environment
More Complex Software l Object-Oriented Programming allows ever larger applications to be built l Require increased high-level application and system oversight l Multi-tier applications development increases the choices on how to build applications l A new Software Architect Role is needed
Software Architect Creating, defining or choosing an application framework l Creating the component design l Structure a complex application into pieces l Understand the interactions and dependencies among components l Select the platform based on cost/performance criteria l Organize and supervise the “construction site” l
Application Framework l A software framework used to implement the standard structure of an application for a specific development environment
Software Framework l A collection of common code providing generic functionality that can be selectively overridden or specialized by user code providing specific functionality l Frameworks, like software libraries, provide reusable abstractions of code wrapped in a well-defined API
Framework Features l Inversion of control – unlike in libraries, the overall program's flow of control is not dictated by the caller, but by the framework – Hollywood Principle: Don’t call us, we’ll call you l Default behavior l Extensibility: usually by selective overriding l Non-modifiable framework code
OO Software Framework l Object-oriented programming frameworks consists in a set of abstract classes l An application can be built simply inheriting from pre-existing classes in the framework l Instantiation of a framework consists of composing and subclassing the existing classes
Examples of Frameworks l GUI – MFC – Gnome – Qt l General – Spring l Web – ASP. Net – GWT – Rails
Benefits of Frameworks l Drives solution – Dictates how to fill-in-the-blanks l Helps solving recurring problems – Designed for reuse – High value, since reduces cost of development
Framework Design l Intellectual Challenging Task l Requires a deep understanding of the problem domain l Requires mastering of software patterns, OO methods and polymorphism in particular
Course Objectives l Understand programming language technology: – Execution Models – Run-time l Analyze programming metaphors: – Objects – Components – Pattern Learn advanced programming techniques l Understand their limits ad how to overcome them l
Course Objectives Explain how high level programming concepts and metaphors map into executable systems and which are their costs and limitations l Acquaint with modern principles, techniques, and best practices of advanced software construction l Introduce techniques of programming at higher abstraction levels, in particular generative programming, component programming and web computing l Present state-of-the-art frameworks incorporating these techniques l
Syllabus
Programming Language Foundations Syntax, Parsing, Abstract Syntax Tree, Parser Generators l Names, Scope, Binding l Parameter Passing l Static and Dynamic Allocaltion: Stack, Heap l Types, Inheritance, Polymorphism, Overloading l Delegates, Closures l Exception Handling l
Run-time Systems l Virtual Execution Environment – Memory Management – Thread Management – Exception Handling – Security – Debugging Support – AOT and JIT Compilation – Dynamic Link/Load – Reflection – Verification l Language Interoperability
Advanced Techniques l Generic Programming – C++ templates – C# Generics – Java Generics l Generative Programming – Metaprogramming – Reflection – Template – Aspect Oriented Programming – Generators
Interoperability l Process level: interprocess communication l Language level: CORBA/IDL l Object level: DCOM
Component Based Programming l COM l Java. Beans l. NET (Assembly, Reflection, Interfaces, Attributes) l OSGi
Web Programming l Web Services, SOA l Web Frameworks l Web 2. 0
Web Services l XML, XML-Schema l SOAP, RPC, Rest l WSDL l UDDI
Web Frameworks and Applications l Asp. Net l ADO. Net l J 2 EE l Java Server Faces l AJAX: XHR, YUI, GWT l Mashup and Service Oriented Architecture
Scripting Languages l Perl l Python l Java. Script l PHP
Text Books Programming Language Pragmatics, third ed. , Michael L. Scott, Morgan-Kaufmann, 2009. Generative Programming: Methods, Tools, and Applications, Krzysztof Czarnecki, Ulrich Eisenecker, Addison-Wesley, 2000. Object Thinking , David West, Microsoft Press, 2004.
Assessment l Mid Term Paper: early November, one week homework l Term Paper: at the end of the course, one month homework
Run-time Environments
Run-Time Environments l Java Virtual Machine l. NET Common Language Runtime l Provide a virtual execution environment – Exposes a structure organized into elements – Not a simple abstraction of physical resources
Controlling execution l Avoid damages l Install/uninstall is a nightmare l Component software?
Benefits l Programmers – Use of library and tools – Shorter integration time – Higher productivity l Tool Developers – Avoid the need to care about infrastructure and interoperability l Administrators and Users – Benefit from packages solutions – Independence from processors or OS
Common Language Infrastructure l l l Exposes all items in a unified type system Packages elements in self-describing units Loads and resolves interdependencies at runtime Exposes information that allows verifying the type-safety Execution Engine enforces politics Metadata available at runtime enables dynamic and extensible solutions
Question l Is it feasible to build a runtime common to all programming languages?
More in detail l Prolog – How to implement logic variable? – Can one use the Warren-Abstract. Machine? l PHP 3 – Why assignment has unusual behavior? l LISP – How to handle multiple-values?
Prolog example append(X, Y, Z) : append(NIL, Y, Y) : append([A. X], Y, [A. Z] ) : - append(X, Y, Z). : - append([a. b. c], [d. e], R) R = [a. b. c. d. e]
Prolog backtrack : - append(X, Y, [a. b]) : - append(X, NIL, [a. b]) X = NIL Y = [a. b] X = [a] Y = [b] X = [a. b] Y = NIL
PHP Assignement $str = ‘Ciao. ’; $str 2 = $str; $str{strlen($str) – 1} = ‘!’; echo $str 2; l $var = $othervar – Performs copy of the value of $othervar l $var = &$othervar – Assignment by reference
Control l Can we implement tail-recursion in C? l How to handle synchronization? l Function pointers? l How to invoke an arbitrary function given a list of arguments?
General Function Invoker invoke(fun, arglist) { if (n==0) return f(); else if (n==1) return f(arg[0]); else return fun(arg[0], arg[1], . . , arg[n-1]); }
Basic Data Types l Strings in C, Pascal and C++ are different l Array in row or column order?
Language Interoperability l C# and Cobol bark at each other
C# dog using System; public class Dog { public virtual void Roll. Over () { Console. Write. Line("Scratch my tummy. "); Bark(); } public virtual void Bark () { Console. Write. Line("WOOF (C#)"); } }
Cobol Big. Dog 000010 CLASS-ID. Big. Dog INHERITS Dog. 000020 ENVIRONMENT DIVISION. 000040 CONFIGURATION SECTION. 000050 REPOSITORY. 000060 CLASS Dog. 000070 OBJECT. 000080 PROCEDURE DIVISION. 000090 METHOD-ID. Bark OVERRIDE. 000160 PROCEDURE DIVISION. DISPLAY "WOOF (COBOL)". 000210 END METHOD Bark. 000220 END OBJECT. 000230 END CLASS Big. Dog.
Barfing dogs public class Demo { public static void Main() { Dog d = new Dog(); Big. Dog b = new Big. Dog(); d. Roll. Over(); b. Roll. Over(); } }
Final Term Paper Aims at exercising ability to conceive and implement full solutions to a nontrivial problem l Examples: l – ASP Code generator with regular expression matcher – Implement a DSL for handling persistent object containers – SOAP protocol and SOAP server – Code generator for searching an object DB – Xpath and XSLT Intrepreter – Language for generating network protocols – AJAX Framework
Home Work l Develop a simplementation of primitives: – void* malloc(size_t size) – void free(void*) l Discuss the limits of the solution
- Gerardo attardi
- Dipartimento di medicina clinica e sperimentale pisa
- Dipartimento di economia pisa
- Dipartimento matematica pisa
- Dipartimento matematica pisa
- Scuio ip nanterre
- Universit
- Universit sherbrooke
- Erasmus school of economics
- Universit of london
- Example of imperative statement in assembly language
- Assembly language programming
- Dynamic programming bottom up
- Advanced programming in java
- Advanced internet programming
- Windows 10 system programming, part 1
- Integer programming vs linear programming
- Perbedaan linear programming dan integer programming
- Definisi integer
- Greedy programming vs dynamic programming
- Dipartimento protezione civile regione sicilia
- Dipartimento di chimica bari
- Fulvia furinghetti
- Dipartimento di matematica firenze
- Unipr dipartimento economia
- Dipartimento di chimica unipv
- Dipartimento medicina perugia
- Dipartimento delle istituzioni
- Dipartimento lingue unige
- Park sociologo
- Dipartimento di diritto privato e critica del diritto
- Dipartimento scienze economiche e aziendali
- Scienze mediche traslazionali
- Dipartimento di fisica ferrara
- Dipartimento ingegneria ferrara
- Relazione finale coordinatore di dipartimento lettere
- Dipartimento psicologia pavia
- Dipartimento del tesoro
- Dipartimento economia genova
- Ingegneria civile unical
- Nord (dipartimento)
- Metalcostruttori ticino
- Dinci unical
- Alessandro cicognani poesia
- Dipartimento scienze mediche ferrara
- Dipartimento cure primarie bologna
- Salute mentale arezzo
- Dipartimento di chimica pavia
- Dipartimento ingegneria trento