<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://kidoos.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Sunish's Blog : Java</title><link>http://kidoos.net/blogs/sunish/archive/tags/Java/default.aspx</link><description>Tags: Java</description><dc:language>en</dc:language><generator>CommunityServer 2008 (Build: 30417.1769)</generator><item><title>Functional Programming - An Overview</title><link>http://kidoos.net/blogs/sunish/archive/2010/01/17/functional-programming-an-overview.aspx</link><pubDate>Sun, 17 Jan 2010 13:56:00 GMT</pubDate><guid isPermaLink="false">6156fb29-6a47-46ec-8ff3-1f4c0ca10f9f:654</guid><dc:creator>Sunish Sugathan</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://kidoos.net/blogs/sunish/rsscomments.aspx?PostID=654</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://kidoos.net/blogs/sunish/commentapi.aspx?PostID=654</wfw:comment><comments>http://kidoos.net/blogs/sunish/archive/2010/01/17/functional-programming-an-overview.aspx#comments</comments><description>&lt;p&gt;&lt;span style="font-size:small;"&gt;Let us start this blog post on
&amp;lsquo;Functional Programming&amp;rsquo; with a widely accepted definition of computer
programming &amp;ndash; &amp;ldquo;computer programming is the process of creating a
sequence of instructions which will enable a computer to do something&amp;rdquo;.
Computer programming is a means to translate problems in the real world
that need solving, into a format that computers can process. &lt;br /&gt;
&lt;br /&gt;
Computer programming languages help convey instructions to computers.
The goal of programming languages is to translate human language to
machine code, the native language that computers understand. &lt;br /&gt;
&lt;br /&gt;
Before we move on to have an overview of functional programming, let us
have a look at the different types (or paradigms) of programming
languages. Please note that a given language is not limited to the use
of a single paradigm, a classic case is that of Java programming
language that has elements of both procedural and object oriented
paradigms. &lt;br /&gt;
&lt;br /&gt;
a) Procedural Programming Languages: These languages specify a list of
operations that a program must execute to reach a desired state. Each
program will have a starting state, a list of operations or
instructions to complete and an ending state. Two popular examples of
procedural programming languages are BASIC (Beginners All purpose
Symbolic Instruction Code) and FORTRAN (The IBM Mathematical FORmula
TRANslating System).&lt;br /&gt;
&lt;br /&gt;
b) Structured Programming Languages: Structured programming can be
considered as a special type of procedural programming, which requires
the program to be broken down into small pieces of code, thereby
increasing readability. Local variables (local to each subroutine) are
preferred over global variables. These languages support a design
approach called &amp;lsquo;top-down approach&amp;rsquo; in which the design starts with a
high-level overview of the system. System designers then add more
details to the components in an iterative fashion until the design is
complete. Popular languages include Pascal, Ada and C.&lt;br /&gt;
&lt;br /&gt;
c) Object Oriented Programming Languages: This paradigm is the latest
and considered the most powerful of all programming language paradigms
so far. Here, system designers define both the data structures and the
type of operations that can be applied to those data structures. This
pair of data and operation(s) on the data is known as an object. A
program can then be viewed as a collection of objects, which interact
with one another. The important concepts associated with the
object-oriented paradigm include classes/templates, inheritance,
polymorphism, data encapsulation and messaging. However, a detailed
note on these concepts is beyond the scope of our current discussion.
Popular languages following this paradigm include Java, Visual Basic,
C#, C++ and Python.&lt;br /&gt;
&lt;br /&gt;
d) Functional and Other Programming Languages: The fourth list includes
functional programming and other paradigms like concurrent programming
and event driven programming, which is not included above. &lt;br /&gt;
&lt;br /&gt;
We will now return to the focus of our discussion &amp;ndash; Functional Programming. &lt;br /&gt;
&lt;br /&gt;
In Mathematics, &amp;lsquo;functions&amp;rsquo; express the connection between parameters
(inputs, in the case of computers) and the result (the output, in the
case of computers) of certain processes. In each computation, the
result depends on the parameters in a particular way and hence a
&amp;lsquo;function&amp;rsquo; is a good way of specifying a computation. This is the basis
of &amp;lsquo;Functional Programming&amp;rsquo;.&lt;br /&gt;
&lt;br /&gt;
The above notion is also more close to the &amp;lsquo;human world&amp;rsquo; than to the
world of a computer where in the initial days of computing, programs
consisted of instructions to modify the memory, executed by the central
processing unit. Thus, functional programming languages match the
mathematical idea of functions. Functional programming is a new
approach to solve certain classes of problems, which we will cover
later in this discussion. &lt;br /&gt;
&lt;br /&gt;
The main characteristics of functional programming are as below:&lt;br /&gt;
&lt;br /&gt;
(a) power and flexibility &amp;ndash; many general, real world problems can be solved using functional constructs&lt;br /&gt;
(b) simplicity &amp;ndash; most functional programming languages have a small set of key words and concise syntax for expressing concepts&lt;br /&gt;
(c) suitable for parallel processing &amp;ndash; with immutable values and
operators functional programs are more suited for asynchronous and
parallel processing&lt;br /&gt;
&lt;br /&gt;
Since the concept of &amp;lsquo;functions&amp;rsquo; is core to Functional programming, let us define a function before we proceed further.&lt;br /&gt;
&lt;br /&gt;
&amp;ldquo;A function is fundamentally a transformation. It transforms one or more inputs into exactly one output&amp;rdquo;.&lt;br /&gt;
&lt;br /&gt;
An important property of functions is that they yield no side effects &amp;ndash;
this means that the same inputs will always yield the same outputs, and
that the inputs will not be changed as a result of the function. Every
symbol in functional programming language is immutable.&lt;br /&gt;
&lt;br /&gt;
Functional programming treats computations &amp;ndash; running a program, solving a numeric calculation &amp;ndash; as the evaluation of functions.&lt;br /&gt;
&lt;br /&gt;
Some of the classes of problems, which can benefit from a functional programming approach, are as below:&lt;br /&gt;
&lt;br /&gt;
(i) multi-core and multi-threaded systems&lt;br /&gt;
(ii) sophisticated pattern matching&lt;br /&gt;
(iii) image processing &lt;br /&gt;
(iv) machine algebra&lt;br /&gt;
(v) lexing and parsing&lt;br /&gt;
(vi) artificial intelligence&lt;br /&gt;
(vii) data mining&lt;br /&gt;
&lt;br /&gt;
Advantages of Functional Programming&lt;br /&gt;
&lt;br /&gt;
(a) Unit Testing: We have already noted that every symbol in a
functional programming language is final and hence immutable. This
implies that no function can modify variables outside of its scope and
hence there are no side effects caused by functions. This also implies
that the only effect of evaluating a function is its return value and
the only thing that affects the return value of function is its
arguments (Please see the definition of &amp;lsquo;function&amp;rsquo; above). This makes
unit testing much easier since the boundary values of arguments need
only be unit tested. &lt;br /&gt;
&lt;br /&gt;
(b) Debugging: The absence of side effects as explained at (a) above
makes debugging easier since bugs are local to a function. An
examination of the stack quickly reveals the cause of error.&lt;br /&gt;
&lt;br /&gt;
(c) Concurrency: Functional programming does not allow data to be
modified by two different threads or twice by the same thread. Hence,
there is no scope for deadlocks and race conditions. This allows ease
of programming in concurrent systems. &lt;br /&gt;
&lt;br /&gt;
Apart from being a more appropriate tool for certain classes of
computing problems, functional programming also allows programmers to
make more efficient use of multi-core systems, develop
concurrent/parallel algorithms easily and utilize the growing number of
cloud computing platforms.&lt;br /&gt;
&lt;br /&gt;
Functional programming is also considered as a means for programmers to
improve their problem solving skills; it also allows programmers to
look at problems from a different perspective and become more
insightful object-oriented programmers as well. &lt;br /&gt;
&lt;br /&gt;
Popular functional programming languages include LISP, Haskell and F#.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://kidoos.net/aggbug.aspx?PostID=654" width="1" height="1"&gt;</description><category domain="http://kidoos.net/blogs/sunish/archive/tags/Java/default.aspx">Java</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/Python/default.aspx">Python</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/cloud+computing/default.aspx">cloud computing</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/Pascal/default.aspx">Pascal</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/LISP/default.aspx">LISP</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/data+mining/default.aspx">data mining</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/parsing/default.aspx">parsing</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/Functional+Programming/default.aspx">Functional Programming</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/F_2300_/default.aspx">F#</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/artificial+intelligence/default.aspx">artificial intelligence</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/image+processing/default.aspx">image processing</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/lexing/default.aspx">lexing</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/Ada/default.aspx">Ada</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/Haskell/default.aspx">Haskell</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/Visual+Basic/default.aspx">Visual Basic</category></item><item><title>Technology Choices For 2009 And Beyond...</title><link>http://kidoos.net/blogs/sunish/archive/2008/09/24/technology-choices-for-2009-and-beyond.aspx</link><pubDate>Wed, 24 Sep 2008 05:48:00 GMT</pubDate><guid isPermaLink="false">6156fb29-6a47-46ec-8ff3-1f4c0ca10f9f:635</guid><dc:creator>Sunish Sugathan</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://kidoos.net/blogs/sunish/rsscomments.aspx?PostID=635</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://kidoos.net/blogs/sunish/commentapi.aspx?PostID=635</wfw:comment><comments>http://kidoos.net/blogs/sunish/archive/2008/09/24/technology-choices-for-2009-and-beyond.aspx#comments</comments><description>&lt;p&gt;

&lt;span style="font-size:small;"&gt; &lt;/span&gt;&lt;span style="color:#3333ff;font-size:small;"&gt;When talking
about technology choices for 2009 and beyond, Java technology [and its
flavors for desktop, mobile and enterprise] seems to be clearly leading
the pack.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color:#3333ff;font-size:small;"&gt;However, there
seems to be a a lot of new trails which are closely associated with
Java. For example, Jython, derived from Python offers almost seamless
interoperability with Java. Python is also the first language to be
supported by Google in its App Engine initiative. JRuby also provides a
bridge between Java and Ruby. GWT is another technology from Google
which provides a connection between Java and widely used AJAX in web
applications.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color:#3333ff;font-size:small;"&gt;Another
relatively new [first public release in 2003] language, Scala, designed
and built by the team led by Prof. Martin Odersky (EPFL, Switzerland)
[Prof. Odersky has also influenced the development of Java as a
co-designer of Java generics and as the original author of the current
javac reference compiler] also seems to be promising. On a related
note, in the article titled &amp;quot;Java EE meets Web 2.0&amp;quot; written by
Constantine Plotnikov, Artem Papkov and Jim Smith in developerWorks,
November 2007), the authors identifies principles of the Java EE
platform that are incompatible with Web 2.0 and introduces
technologies, including Scala, that close the gap.&lt;/span&gt;&lt;span style="font-size:small;"&gt;&lt;/span&gt;&lt;span style="color:#3333ff;font-size:small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color:#3333ff;font-size:small;"&gt;When it comes
to methodologies used in Software Engineering, Agile methodologies is
clearly the leader. The biggest reason for the success of Agile
methodologies could be the fact that it results in:&lt;/span&gt;&lt;span style="font-size:small;"&gt;  &lt;/span&gt;&lt;span style="color:#3333ff;font-size:small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style="color:#3333ff;font-size:small;"&gt;Customer satisfaction by rapid, continuous delivery of useful software&lt;/span&gt;&lt;span style="font-size:small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="color:#3333ff;font-size:small;"&gt;   Working software is delivered frequently (weeks rather than months)&lt;/span&gt;&lt;span style="color:#3333ff;font-size:small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="color:#3333ff;font-size:small;"&gt;Working software is the principal measure of progress&lt;/span&gt;&lt;span style="font-size:small;"&gt;  &lt;/span&gt;&lt;span style="color:#3333ff;font-size:small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span style="color:#3333ff;font-size:small;"&gt;&amp;nbsp;~ Sunish&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;


&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://kidoos.net/aggbug.aspx?PostID=635" width="1" height="1"&gt;</description><category domain="http://kidoos.net/blogs/sunish/archive/tags/Agile+Methodologies/default.aspx">Agile Methodologies</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/Jython/default.aspx">Jython</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/GWT/default.aspx">GWT</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/Java/default.aspx">Java</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/EPFL/default.aspx">EPFL</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/Ruby/default.aspx">Ruby</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/Python/default.aspx">Python</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/JRuby/default.aspx">JRuby</category><category domain="http://kidoos.net/blogs/sunish/archive/tags/Scala/default.aspx">Scala</category></item></channel></rss>