Scala
is a program language created by Mr. Martin Odersky and others. It is intended to be an elegant blend between
object-oriented design and functional programming. There is a belief within its ranks that every
function is a value and every value is an object. Development began on the language in 2001
followed by the initial release in 2003.
After an attempt to improve Java, the project spun off into its own
formulated specifically for component style software engineering. The data types of the language are
common. Numbers can be in the form of
doubles, floats, longs, ints, shorts and bytes.
Strings, long form sequence of alphanumeric or Unicode characters, are
from the Java library. There are also
individual characters as chars and true/false values as Booleans. There is some uniqueness as units, iterables,
maps, options, sets and lists are added to the mix of instantiable data types. Even “empty” sets are possible with nothing
and null objects. Scala has five primary
keywords for creation as class, object, def, val and var are needed to identify
user definitions. Classes are the design
for what an object can be while objects are just a single instance. Another keyword new is used to convert the
class to a created object. The main
method to run an application is customarily contained in a user defined
object. The def keyword is used to
create functions. The keyword is
followed by the name, the parameters in parentheses, a colon, the return type,
an assignment operator and the set of instructions contained in brackets. Val signifies a place holder where the
assigned value will not be changed while var can be modified later in
usage. The syntax calls for either the
val or var keyword followed by the name then colon, datatype and finally with
what is being assigned to it. Scala also
has user defined types. The keyword type
is placed before the name and then you assign a predefined type with the
assignment operator. As file
organization goes, Scala is very similar to Java in the matter of naming
convention. Also like Java, Scala uses
the keywords package and import to define project scope and add external files
respectively. Scala features two forms
of generics. One is the traditional
abstract class where you provide a simple framework to be used later. Very analogous to abstract classes is the concept
of traits. Traits also allow variables
and methods that are inheritable to another class. The inheritance occurs with the keyword
extends. The capability of concurrent
processing is very heavily associated with the ‘java.util.concurrent’
package. There are two points to this
topic. The first is having two library methods
of callable which returns a value and runnable that does not. Then you will have to look at various of
threading possible with synchronous and asynchronous tasks. Where Scala shows promise is in how vast and
dynamic it can be. The possibility to
implement nested functions is another positive addition. For me, a drawback is how closely relatable
it is to Java and running on a Java virtual machine.
The
difference between Scala and C would be akin to comparing Java and C. Start with the time period to get a better
understanding. C was created in 1972 and
Scala in 2001. C is the basis for many programming
language concepts since its inception. Scala
is a fairly newer language and is heavily dependent on Java. Much of the grunt work that developer had to
do in C has been made much easier within built-in libraries for Scala. The major difference you could point to would
be the same in comparing other languages.
All languages will have a particular syntax for committing common
tasks. The level of complexity is
dependent upon the features included into the language but again they maybe
more time dependent as concepts were created by pioneers and deciphered to be made
simpler for users to come later down the line.
To complete project one in Scala would be helped by the automatic
sorting array feature but much of the rest would be similar.
[2] Odersky, M. et al. An Overview of the Scala Programming Language. EPFL Technical Report. 2nd Edition. 2004.
[3] Odersky, M. Scala By Example. 2014.
[4] Odersky, M. A Brief History of Scala. http://www.artima.com/weblogs/viewpost.jsp?thread=163733. 2006.
[5] Venners, B. and Sommers, F. The Origins of Scala. http://www.artima.com/scalazine/articles/origins_of_scala.html. 2009.
[6] https://www.tutorialspoint.com/scala/index.htm
[7] Concurrency in Scala. https://twitter.github.io/scala_school/concurrency.html
References
[1] http://www.scala-lang.org/index.html[2] Odersky, M. et al. An Overview of the Scala Programming Language. EPFL Technical Report. 2nd Edition. 2004.
[3] Odersky, M. Scala By Example. 2014.
[4] Odersky, M. A Brief History of Scala. http://www.artima.com/weblogs/viewpost.jsp?thread=163733. 2006.
[5] Venners, B. and Sommers, F. The Origins of Scala. http://www.artima.com/scalazine/articles/origins_of_scala.html. 2009.
[6] https://www.tutorialspoint.com/scala/index.htm
[7] Concurrency in Scala. https://twitter.github.io/scala_school/concurrency.html
No comments:
Post a Comment
Thank you very much for viewing this entry and I hope you are able to return soon to continue to enjoy more of the site.
Please share your thoughts in the comment section.
Be blessed and enjoy life!