doc-src/isac/CTP-userinterfaces.tex
branchdecompose-isar
changeset 38100 905c8bfcf39a
parent 38099 a3cae5ca93eb
child 38101 09b428a6b09d
equal deleted inserted replaced
38099:a3cae5ca93eb 38100:905c8bfcf39a
   251 
   251 
   252 Scala is pure object-oriented, this means every value is an object. The same is true for primitive data types, because compiler-generated byte code is using primitive data types. Known design patterns from OOP can be used with Scala as well. Data types and behaviors of objects are described by classes and traits\cite{[wiki]}. Traits not only consist of definitions, they also can contain implementations of methods. To avoid the problems of multiple inheritance, classes are able to extend various traits, this is a flexible mixin-based mechanism. The keyword Object is used to implement a Singleton-Class.
   252 Scala is pure object-oriented, this means every value is an object. The same is true for primitive data types, because compiler-generated byte code is using primitive data types. Known design patterns from OOP can be used with Scala as well. Data types and behaviors of objects are described by classes and traits\cite{[wiki]}. Traits not only consist of definitions, they also can contain implementations of methods. To avoid the problems of multiple inheritance, classes are able to extend various traits, this is a flexible mixin-based mechanism. The keyword Object is used to implement a Singleton-Class.
   253 
   253 
   254 In Scala every function is a value, hence Scala is also a functional language. Functions in Scala are first-class objects, this means it is possible to pass a function as a parameter, return a function from a subroutine, or assign to a variable. Scala also supports case classes, which are used for pattern matching. Case classes are regular classes which export their constructor parameters\cite{[wiki-11-1s]}. Furthermore Scala supports higher-order functions, currying and allows functions to be nested.
   254 In Scala every function is a value, hence Scala is also a functional language. Functions in Scala are first-class objects, this means it is possible to pass a function as a parameter, return a function from a subroutine, or assign to a variable. Scala also supports case classes, which are used for pattern matching. Case classes are regular classes which export their constructor parameters\cite{[wiki-11-1s]}. Furthermore Scala supports higher-order functions, currying and allows functions to be nested.
   255 
   255 
   256 Scala is more statically typed than Java, but is able to infer types by usage. So most static type declarations are optional. This static type system ensures a safe and coherent use of abstraction. Scala supports:
   256 Scala is more statically typed than Java, but is able to infer types by usage. So most static type declarations are optional. This static type system ensures a safe and coherent use of abstraction. Scala supports \footnote{TODO}:
   257 
   257 
   258 \begin{itemize}
   258 \begin{itemize}
   259 \item generic classes
   259 \item generic classes
   260 \item variance annotations
   260 \item variance annotations
   261 \item upper and lower type bounds
   261 \item upper and lower type bounds
   276 %%http://creativekarma.com/ee.php/weblog/comments/why_scala_instead_of_java/
   276 %%http://creativekarma.com/ee.php/weblog/comments/why_scala_instead_of_java/
   277 %%http://www.scalasolutions.com/scala
   277 %%http://www.scalasolutions.com/scala
   278 
   278 
   279 
   279 
   280 \subsection{Support for parallel processing}\label{actors}
   280 \subsection{Support for parallel processing}\label{actors}
   281 Concurrency has lately become more and more attention, because multicore processors make concurrency very important for efficient program execution, by running multiple threads parallel and so concurrent programming gets indispensable and distributed computing,web services and mobile environments are naturally concurrent.
   281 Concurrency has lately become more and more attention, because multicore processors make concurrency very important for efficient program execution, by running multiple threads parallel and so concurrent programming gets indispensable and distributed computing,web services and mobile environments are naturally concurrent. A very attractive model is message-based concurrency, which is based on the actor model.
   282 
       
   283 A very attractive model, because of the fact that it might addresses multicore processors and several techniques which are basically concurrent, is message-based concurrency. Most of these are based on the actor model.
       
   284 
   282 
   285 %Most of the message passing systems, which are used in practice, are based on the actor model.
   283 %Most of the message passing systems, which are used in practice, are based on the actor model.
   286 
   284 
   287 An actor is a concurrent process that executes a function. The state of an actor gets never shared, so it doesn't need to compete for locks of shared data. Actors own a mailbox where incoming messages are stored in. A mailbox is mainly a queue with several producers and one consumer, which are other actors. Actors share data by sending Messages which are sent asynchronously. Messages are unchangeable, so they don't require a lock. By creating new actors, by sending messages to known actors, or changing its behavior, an actor is able to reply to a message. The actor-based process is combined with pattern matching for messages.
   285 An actor is a concurrent process that executes a function. The state of an actor gets never shared, so it doesn't need to compete for locks of shared data. Actors own a mailbox where incoming messages are stored in. A mailbox is mainly a queue with actors, which operate as several producers and one consumer. Actors share data by sending Messages which are sent asynchronously. Messages are unchangeable, so they don't require a lock. By creating new actors, by sending messages to known actors, or changing its behavior, an actor is able to reply to a message. The actor-based process is combined with pattern matching for messages.
   288 
   286 
   289 The Erlang programming language is a functional programming language that supports message-based concurrency, which operates with actors. It was developed for real-time control systems. Such systems are telephone exchanges, network simulators and distributed resource controllers \cite{[IoC]}. These systems use a very popular lightweight implementation and a large number of concurrent processes, which can active simultaneously.
   287 The Erlang programming language is a functional programming language that supports message-based concurrency, which operates with actors. It was developed for real-time control systems. Such systems are telephone exchanges, network simulators and distributed resource controllers \cite{[IoC]}. These systems use a very popular lightweight implementation and a large number of concurrent processes, which can be active simultaneously.
   290 
   288 
   291 Operating system threads and threads of virtual machines are too heavyweight for the implementation of such processes. The standard concurrency for mainstream platforms were shared-memory threads with locks. Such a platform is the Java Virtual Machine (JVM), which suffers from high memory consumption and context-switching overhead.
   289 Operating system threads and threads of virtual machines are too heavyweight for the implementation of such processes. The standard concurrency for mainstream platforms were shared-memory threads with locks. Such a platform is the Java Virtual Machine (JVM), which suffers from high memory consumption and context-switching overhead.
   292 The main reasons are:
   290 The most disadvantageous consequences are:
   293 \begin{enumerate}
   291 \begin{enumerate}
   294 \item quick exhaustion of virtual address space
   292 \item quick exhaustion of virtual address space
   295 \item locking mechanisms often lack suitable contention managers
   293 \item locking mechanisms often lack suitable contention managers
   296 \end{enumerate}
   294 \end{enumerate}
   297 \cite{[IoC]}\\
   295 \cite{[IoC]}\\