Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Jython
An introduction
by Thinh Le
precursor_Python
!
Google App Engine
!
Dropbox
!
PyGTK (Gnome)
!
Vim (embedded)
!
BitTorrent/Morpheus
!
Civilization/Battlefield
Jython
!
Interpretation of Python (1997)
!
Jim Hugunin & Frank Wierzbicki
!
Python written in C
!
Rewrite in Java
!
Runs on JVM
!
Interpreted Language
!
Object-Oriented
Scripting Language
!
Easy to learn and code
!
Expressive
!
Minimal structure (less lines of code)
!
Does not require compilation
!
Supports functional programming
!
Runs external programs
Hello World
!
print Hello, world!
!
does not need to be enclosed in class or func
!
Jython does it behind the scenes
File I/O
!
file = open( fileName.txt , r )
for line in file.readlines():
print line
file.close()
Event Handling
!
from javax.swing import *
def hello(event):
print Hello, world!
frame = JFrame( Hello There )
button = JButton( Hello , actionPerformed = hello)
frame.add(button)
Method Overloading
!
from java.lang import Float, Double
foo(Float(9.5))
foo(Double(9.5))
Classes
!
class Hello:
def _init_(self, name= John Smith ):
self.name = name
def greeting(self):
print Hello, %s % self.name
jane = Hello( Jane Smith )
joe = Hello( Joe )
default = Hello()
jane.greeting()
joe.greeting()
default.greeting()
Advantages/Disadvantages
!
Readability
!
Increase programmer efficiency
!
Code is dynamically converted to Java byte code
!
eliminate performance issues
!
Cross-platform compatible
!
Slow
!
cannot detect undefined variable (caught at
runtime)
Implementation
!
IBM WebSphere (App server)
!
IBM Rational (SDLC)
!
WebLogic Server
!
Sikuli Demo
Questions?
Objective-C
•
An introduction
•
by Thinh Le
Objective-C
!
Developed in the 1980s by Stepstone
!
Superset of C
!
!
Any C program compilable as Obj-C
Object syntax derived from Smalltalk
!
Dynamic typing, message based
Objective-C 2.0
!
Introduced with Mac OS 10.5
!
Only supports runtime systems
!
!
!
GNUStep, Cocoa, Cocoa Touch
Supports garbage collectors, properties,
dot notations, fast enumerations
iOS devices (iPhone, iPad)
Classes / Types
!
Class (methods, instance variables)
!
Inheritance (can have super class)
!
No single root class like Java
!
Object Types:
!
!
id, nil, self ( this in Java), super
All C-Types can be used (int, float, short)
Methods / Messaging
!
Methods on object called via messaging
!
Sends msg w/message name to receiver
!
Msg can have return value (0 or nil)
!
Nested messagess: [[receiver msg1] msg2]
!
Parameters: [rectangle setX: 5 y: 10]
!
Dot Syntax: rectangle.width = 15;
Memory / Protocols
!
Objects created are allocated memory
!
!
Must be released when scope ends
Protocols similar to Java interfaces
!
List of methods independent from class
Protocol - Example
Exception Handling
!
!
Similar to Java
@throw myException
@try {
}@catch (NSException *e) {
NSLog(@ Caught %@: %@ , [exception name],
[exception reason]);
}
@finally{ }
Hello World
!
#import <stdio.h>
int main (int argc, const char *argv[])
{
printf ( hello world\n );
return 0;
}
DEMO
!
http://ideone.com
GO
•
An introduction
•
by Thinh Le
What is Go?
!
Experimental
!
Tools & packages still in development
!
Concurrent and Garbage-collected
!
Systems programming (compilers, web server)
!
Created by Robert Griesemer, Ken Thompson,
Rob Pike of Google (2009)
Purpose of Creation
!
Resource demands by applications
!
Bigger libraries
!
More dependencies
!
Growth of clusters in Client/Server systems
!
Main stream multi-core processors
!
Internet and networking becoming pervasive
Goals of Go
!
Efficiency and ease of use
!
Performance within 10-20% of C
!
Type safe and Memory safe
!
Concurrency ( http://langalot.com/ )
!
Garbage Collected
!
High-Speed Builds
!
Fast compilation & linking
Example
!
package main
import fmt
//package for Printf func
func main() {
//functions have func
keyword
fmt.Printf( Hello World! )
}
Loop
!
!
func main() {
sum := 1
i := 1
for i <= 5 {
sum += i;
i++
}
fmt.Printf( Sum is %d , sum)
}
for loop is only loop supported in Go
Functions as Objects
!
func for_all(arr []int, foo func(int)) {
for i := 0; i<len(arr); i++ {
foo(arr[i]) }
}
func print(i int) {fmt.Printf( %d , i) }
func main() {
for_all([] int {1,2,3}, print);
}
!
Similar to functional language. ie. Closjure
Structures
!
type Point struct {
x, y int
}
func main() {
p := Point {10, 20}
fmt.Printf( p value is = %v , p)
}
Methods
!
type Point struct {
x, y int
}
func (p Point) Print() {
fmt.Printf(“p value is = %v”, p)
}
func main() {
p := Point {10, 20}
fmt.Print()
}
Demo
!
http://ideone.com