SlideShare a Scribd company logo
Funtional Programming
with 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
Concept
Assingnment를
기본하는 명령
의 나열
모든것은 객체
프로그램은 수학
함수를 모아놓은
것
계산의 결과가
무엇인지를 논리
식으로 표현
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일	 목요일
Prolog
PREDICATES
parent(person, child)
grandparent(GP,GC)
CLAUSES
parent(margaret,kim)
parent(margaret,kent)
parent(esther,margaret)
parent(esther,jean)
grandparent(GP,GC) :- parent(GP,P), parent(P,GC).
GOAL
grandparent(esther, child)
child = kim
child = kent
2 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) 0
else f(start) + sum(f)(start + 1, end)
}
sum:((Int)=>Int)(Int,Int)Int
2010년	 5월	 6일	 목요일
No Side Effects
Side Effect : 실 매개변수나 비지역변수의 값
이 바뀌어 의도하지 않았던 결과를 얻게 되는
현상
Call By Value
f(x) = y ( Referentially transparent)
Call By Reference
f(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 Conversion
import 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일	 목요일

More Related Content

PDF
Ambiental Microbiologia
PPTX
Java one2015 - Work With Hundreds of Hot Terabytes in JVMs
PPTX
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
PDF
Legislación aplicada
PDF
Geología del subsuelo
PDF
บทคัดย่อ
PDF
예제로 쉽게 배우는 Log4j 기초 활용법
PDF
Smart work
Ambiental Microbiologia
Java one2015 - Work With Hundreds of Hot Terabytes in JVMs
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
Legislación aplicada
Geología del subsuelo
บทคัดย่อ
예제로 쉽게 배우는 Log4j 기초 활용법
Smart work

Viewers also liked (8)

PDF
JAVA NIO
PDF
Netty @Apple: Large Scale Deployment/Connectivity
PDF
Ambiental Hidraulica
PDF
Ambiental Fisica ii
PDF
Ambiental Quimica organica
PDF
Petsil metinvestigacion
PDF
Petsil geologiapetroleo
PDF
Petsil dibujo
JAVA NIO
Netty @Apple: Large Scale Deployment/Connectivity
Ambiental Hidraulica
Ambiental Fisica ii
Ambiental Quimica organica
Petsil metinvestigacion
Petsil geologiapetroleo
Petsil dibujo
Ad

More from 오석 한 (11)

PDF
RPC protocols
PDF
Serialization (Avro, Message Pack, Kryo)
PDF
Cassandra
PDF
Smart Phone CPU
PDF
Linux tips
PDF
Apache Click
PDF
Vi 단축키명령어
PDF
Perl Script Document
PDF
Perl Script
PDF
정규 표현식 기본 메타문자 요약
PPT
정규표현식의 이해와 활용
RPC protocols
Serialization (Avro, Message Pack, Kryo)
Cassandra
Smart Phone CPU
Linux tips
Apache Click
Vi 단축키명령어
Perl Script Document
Perl Script
정규 표현식 기본 메타문자 요약
정규표현식의 이해와 활용
Ad

Functional progrmming with scala