Funtional Programmingwith Scala
Han O Seok
2010년 5월 6일 목요일
Programming Paradigm
Imprative Programming
Object Oriented Programming
Functional Programming
Logical Programming
2010년 5월 6일 목요일
Imperative Programming
Object Oriented Programming
Functional Programming
Logical Programming
Languages C, Fotran, Cobol, Algol, Pascal
Simula, C++, Java, Smalltalk, Ruby
Lisp, ML, Scala, Erlang, Haskell, Scheme
Prolog, CLP
ConceptAssingnment를 기본하는 명령의 나열
모든것은 객체프로그램은 수학함수를 모아놓은것
계산의 결과가 무엇인지를 논리식으로 표현
Programming Paradigm
2010년 5월 6일 목요일
Von Neumann Architecture
Stored Program Concept
Assignment
Operation
Memory
Imprative Programming
2010년 5월 6일 목요일
Object Oriented Programming
Abstraction
Encapsulation
Inheritance
Polymorphism
2010년 5월 6일 목요일
PrologPREDICATES
parent(person, child)grandparent(GP,GC)
CLAUSESparent(margaret,kim)parent(margaret,kent)parent(esther,margaret)parent(esther,jean)grandparent(GP,GC) :- parent(GP,P), parent(P,GC).
GOALgrandparent(esther, child)
child = kimchild = kent2 Solution
Logical Programming
2010년 5월 6일 목요일
Scalability Glueing Functions, Glueing Programs
Modularize
No Assignment
Referentially transparent
No Side Effect
Memory Management
Performance
Functional Programming
2010년 5월 6일 목요일
Moore’s Law
Multicore Processor
2010년 5월 6일 목요일
Singlecore VS Multicore
2010년 5월 6일 목요일
Scalable Language [Skah-lah]
The language is so named because it was designed to grow with the demands of its users.
- Programming Scala, p3
2010년 5월 6일 목요일
Scala
Multi Paradigm ( OOP + FP )
Strength of variable languages(Haskell, ML, Java, Earlang, Smalltalk ...)
Very Short Code : About 1/2 of Java Code
Increase Readability
Scalability
Type Inference ,Implicit Conversion
2010년 5월 6일 목요일
Simple Code
public class Person{private String name;public Person(String name){
self.name = name;}public String getName(){
return name;}public void setName(String name){
self.name = name;}}
class Person(var name:String)
2010년 5월 6일 목요일
Scalability
if(StringUtils.isBlank(str)){...}
if(str.isBlank()){...}
2010년 5월 6일 목요일
Higher-order Functions
def sum(f: Int => Int) (start:Int, end:Int): Int = {if (start > end) 0else f(start) + sum(f)(start + 1, end)
}
sum:((Int)=>Int)(Int,Int)Int
2010년 5월 6일 목요일
No Side EffectsSide Effect : 실 매개변수나 비지역변수의 값이 바뀌어 의도하지 않았던 결과를 얻게 되는 현상
Call By Valuef(x) = y ( Referentially transparent)
Call By Referencef(instance) = ? (Side Effect 가능성)
2010년 5월 6일 목요일
Type Inference
def plus (x:Int, y:Int) = {x + y
}
plus: (Int, Int) Int
2010년 5월 6일 목요일
Scalability
if(StringUtils.isBlank(str)){...}
if(str.isBlank()){...}
2010년 5월 6일 목요일
Implicit Conversionimport org.apache.commons.lang._
class CustomString(var str:String){! def isBlank():Boolean = StringUtils.isBlank(str)}
object CustomString{implicit def customString(s:String):CustomString = {
! new CustomString(s)!}
}
2010년 5월 6일 목요일
Actor
100,000 Factorial
http://kldp.org/node/107470
2010년 5월 6일 목요일
JVM
Powerful Type System
Functional Programming Object Oriented Programming
2010년 5월 6일 목요일
on
Reliable, high performance code
Flexible , Full featured Language
Steve Jenson, Alex Payne and Robey Pointer said….. http://www.artima.com/scalazine/articles/twitter_on_scala.html
2010년 5월 6일 목요일
Scala Study
2010년 5월 6일 목요일
Thanks (-:
2010년 5월 6일 목요일