Wednesday, July 4, 2012

ERLANG



Erlang is a general-purpose concurrent, garbage-collected programming language and runtime system. The sequential subset of Erlang is a functional language, with strict evaluation, single assignment, and dynamic typing. It was designed by Ericsson to support distributed, fault-tolerant, soft-real-time, non-stop applications. It supports hot swapping, so that code can be changed without stopping a system.


While threads are considered to be a complicated and error-prone topic in most languages, Erlang provides language-level features for creating and managing processes with the aim of simplifying concurrent programming. Though all concurrency is explicit in Erlang, processes communicate using message passing instead of shared variables, which removes the need for locks.
The first version was developed by Joe Armstrong in 1986.It was originally a proprietary language within Ericsson, but was released as open source in 1998.


HISTORY
The name "Erlang", attributed to Bjarne Däcker, has been understood as a reference to Danish mathematician and engineer Agner Krarup Erlang, and (initially at least) simultaneously as an abbreviation of "Ericsson Language".
Erlang was designed with the aim of improving the development of telephony applications. The initial version of Erlang was implemented in Prolog and was influenced by the programming language PLEX used in earlier Ericsson exchanges. According to Armstrong, the language went from lab product to real applications following the collapse of the next-generation AXE exchange named AXE-N in 1995. As a result, Erlang was chosen for the next ATM exchange AXD.
In 1998, the Ericsson AXD301 switch was announced, containing over a million lines of Erlang, and reported to achieve a reliability of nine "9"s.Shortly thereafter, Erlang was banned within Ericsson Radio Systems for new products, citing a preference for non-proprietary languages. The ban caused Armstrong and others to leave Ericsson.The implementation was open sourced at the end of the year.The ban at Ericsson was eventually lifted, and Armstrong was re-hired by Ericsson in 2004.
In 2006, native symmetric multiprocessing support was added to the runtime system and virtual machine.

THOUGHTS ON ERLANG
"I do not believe that other languages can catch up with Erlang anytime soon. It will be easy for them to add language features to be like Erlang. It will take a long time for them to build such a high-quality VM and the mature libraries for concurrency and reliability. So, Erlang is poised for success. If you want to build a multicore application in the next few years, you should look at Erlang."
                                   -  Ralph Johnson

HELLO WORLD!

-module(helloworld).
-export([start/0]).

start() ->
    io:fwrite("Hello, world!\n").
REFERENCES
http://www.thegeekstuff.com/2010/05/erlang-hello-world-example/
www.erlang.org/
http://en.wikipedia.org/wiki/Erlang_(programming_language)


GROUP MEMBERS:
Zhid Christian A. Sale
Vince Eric F. Tapang
CMSC124 T-7L

Pascal

Pascal Programming Language


Description

Pascal is a strongly typed, block structured programming language. The "type" of a Pascal variable consists of its semantic nature and its range of values, and can be expressed by a type name, an explicit value range, or a combination thereof. The range of values for a type is defined by the language itself for built-in types, or by the programmer for programmer defined types. Programmer-defined types are unique data types defined within the Pascal TYPE declaration section, and can consist of enumerated types, arrays, records, pointers, sets, and more, as well as combinations thereof. When variables are declared as one type, the compiler can assume that the variable will be used as that type throughout the life of the variable (whether it is global to the program, or local to a function or procedure). This consistent usage of variables makes the code easier to maintain. The compiler detects type inconsistency errors at compile time, catching many errors and reducing the need to run the code through a debugger. Additionally, it allows an optimizer to make assumptions during compilation, thereby providing more efficient executables. As John Reagan, the architect of Compaq Pascal, writes, "it was easy to write Pascal programs that would generate better code than their C equivalents" because the compiler was able to optimize based on the strict typing.

Declaring variables in Pascal is straightforward. The Pascal VAR declaration section gives the programmer the ability to declare strings, integers, real numbers and booleans (to name a few built-in types), as well as to declare variables as records or other programmer defined types. A variable defined as a RECORD allows a single variable to track several data components (or fields).

History

The Pascal programming language was originally developed by Niklaus Wirth, a member of the International Federation of Information Processing (IFIP) Working Group 2.1. Professor Niklaus Wirth developed Pascal to provide features that were lacking in other languages of the time. His principle objectives for Pascal were for the language to be efficent to implement and run, allow for the development of well structured and well organized programs, and to serve as a vehicle for the teaching of the important concepts of computer programming. Pascal, which was named after the mathematician Blaise Pascal, is a direct descendent from ALGOL 60, which Wirth helped develop. Pascal also draws programming components from ALGOL 68 and ALGOL-W. The original published definition for the Pascal language appeared in 1971 with latter revisons published in 1973. It was designed to teach programming techiques and topics to college students and was the language of choice to do so from the late 1960's to the late 1980's.

Interview with Sir Koy

Sample Hello World Program

program HelloWorld(output);
begin
  WriteLn('Hello world!')
end.

Group Members’ Insights

The Pascal programming language has its limits therefore we cannot use it in hardcore programming.

References

http:/http://groups.engin.umd.umich.edu/CIS/course.des/cis400/pascal/pascal.html
http://www.pascal-central.com/ppl/chapter2.html#Architecture

Group Members

Luis Julius G. Bragais 2008-31420
Reuel Carlo P. Virtucio 2010-19846

Tuesday, July 3, 2012

what is COOL? ==> C#

using System;
namespace HelloWorld
{
  class Hello 
  {
    static void Main() 
    {
       Console.WriteLine("What is COOL?");
       Console.WriteLine("Of course, C# is COOL!");
       Console.WriteLine("Press any key to exit.");
       Console.ReadKey();
     }
  }

Behind the Creation of C#

      It was Microsoft that developed C# for the new .NET platform as an alternative to Java, inspired as it by C++, Delphi and Java. Its development team is led by Anders Hejlsberg with Scott Wiltamuth, and Peter Golde in 1999, and officially announced the official name C# in July 2000.

'COOL' to 'C#'

     According to Anders, C# was originally called COOL, which stood for C-style Object-Oriented Language, and the team liked the name. However, the trademark lawyers do not seem to like it, so the language naming committee needed to revise it. They wanted to have a reference to the language's C heritage in the name, and finally settled to C#. Anders recalled that oher candidates for the name were e-C, Safe C, C-square, C-cube, C-star, and Cesium. Anders mentioned that he is pretty happy that they chose C# as the name of the language.     

All about C#

      C# is a multi-paradigm programming language that is encompassing object-oriented programming principles, garbage collection, strong type checking, and array bound checking. It is intended to be a simple, modern, general-purpose, object-oriented programming language.
     Since C# was developed in .NET platform, it can be mixed with other languages in the platform like C++, Pascal, Python, Java, Cobol and Fortran. Because of this, they can share same objects.
     C# is one of the programming languages designed for Common Language Infrastractures (CIL). It compiles into an intermediate language called Common Intermediate Language (CIL), which runs on a virtual machine called Common Language Runtime (CLR).
    The language was standardized by ECMA-334, which gives the C# language specifications, along with ISO (ISO/IEC 23270:2006).

          A new form of iterator in C# employs co-routines via a functional-style keyword similar to the one found in the Python language.
  1. Anonymous methods provide closure functionality.
  2.  Generics or parameterized types support some features not supported by C++ templates such as type constraints on generic parameters. However, expressions cannot be used as generic parameters as in C++ templates. In constrant to the Java implementation, parameterized types are first class objects in the virtual machine, allowing for optimizations and preservation of type information.
  3. Nullable types facilitate interaction with SQL databases. Sample nullable type declaration: int? variableName = null;
  4. Partial types allow the separation of a class implementation into more than one source file. This feature was implemented primarily so Visual Studio generated code can be kept separate from developer code.


Opinions on C#

Instructors Say...


"It's a good alternative for an OO development, especially on a windows platform. And that's because of the .NET framework on windows.

Pero on other platforms, there are other OOPLs that can scale better."

- Sir Allister Alambra 

"First, C# supports internationalization. Serious developers are now separating  their english form their apps. Second, C# is general-purpose like Java, meaning you can develop almost any app using C#. Disadvantage though is the performance. Just like Java, it is slower than most specialized languages. Third, C# is mature enough to have an IDE, so it has a good support for developers. Making it easier to develop apps in shorter periods of time. Also there are considerable volumes of libraries you can already use just like Java."
- Sir Rommel Bulalacao

Students Say...

"C# can be easily learned even with just a bit of basic object-oriented programming. There would be no problem adapting with the syntax. It's also programmer-friendly and gets the job done (UI particularly)."                 -Maritess Verana

"C# is a powerful yet simple programming language since it combines the capabilities of C, C++, and Java together with the features of Microsoft Visual Basic, thus allowing numerous tasks to be accomplished in a simpler way."                                               - Frances Camille Ventocilla

"Madaling gamitin lalo na sa pagggawa ng UI kasi drag and drop. Tapos para sa mga sanay sa Java, adaptable ang C# kasi halos apreho lang din ng syntax."  
                                                  - Emmanuel Misolas

"Easy to use! Okay gamitin kung kailangan ng UI."  
                                                  - Rizianne Veluz





Contributed by:
cmsc124T group

GROUP MEMBERS
Maritess Verana | 2010-43032
Regina Arellano | 2008-56620 
Frances Camille Ventocilla | 2009-64533
Rizianne Veluz | 2010-05862
Emmanuel Misolas | 2006-35661

Thanks to
     Sir Rommel Bulalacao     Sir Allister Alambra

References

      Morris, Richard. (19 March, 2009). "Anders Hejlsberg: Geek of the Week". Simple-talk. Retrieved from http://www.simple-talk.com/opinion/geek-of-the-week/anders-hejlsberg-geek-of-the-week/, July 03, 2012.
            C#: The Java of Microsoft. Scriptol Retrieved from http://www.scriptol.com/programming/csharp.php, July 03, 2012.
         C_Sharp_Language.jpg. Retrieved from http://www.computermindservice.com/logo/C_Sharp_Language.jpg, July 03, 2012.
            Hello World -- Your First Program (C# Programming Guide). Retrieved from http://msdn.microsoft.com/en-us/library/k1sx6ed2.aspx, July 04, 2012
        Standard ECMA-334: C# Standard Specification(4th ed.). Ecma International. June 2006. Retrieved from http://www.ecma-international.org/publications/standards/Ecma-334.htmJuly 03, 2012
  Sanskruti. (2007, April 7). Overview of C#. Retrieved September 30, 2012, from Go4Expert:http://www.go4expert.com/forums/showthread.php?t=379
Al
        
Al

LISP




DESCRIPTION


Lisp (historically, LISP) is a family of computer programming languages with a long history and a distinctive, fully parenthesized Polish prefixnotation. Lisp is the second-oldest high-level programming language in widespread use today; only Fortran is older (by one year). Like Fortran, Lisp has changed a great deal since its early days, and a number of dialects have existed over its history. Today, the most widely known general-purpose Lisp dialects are Common Lisp and Scheme.


It quickly became the favored programming language for Artificial Intelligence (AI) research. As one of the earliest programming languages, Lisp pioneered many ideas in computer science, including Tree Data Structures, Automatic Storage Management, Dynamic Typing, and the Self-Hosting Compiler.




HISTORY



LISP was invented by John McCarthy  in 1958 at  Massachusetts Institute of Technology (MIT). 
  • McCarthy published its design in a paper in Communications of the ACM in 1960, entitled "Recursive Functions of Symbolic Expressions and Their Computation by Machine
  • Lisp was first implemented by Steve Russell on an IBM 704 computer. Russell had read McCarthy's paper, and realized (to McCarthy's surprise) that the Lisp eval function could be implemented in machine code. The result was a working Lisp interpreter which could be used to run Lisp programs, or more properly,          evaluate Lisp expressions.'
  • In 1962, the first complete LISP compiler was implemented by Tim Hart and Mike Levin at MIT.
  • in 1970s, LISP became a hard system to implement because of its compiler techniques and stock hardware. Garbage collection, developed by Daniel Edwards  made it practical to run LISP on general purpose computing system. Yet, the efficiency was sacrificed then LISP Machines were created dedicated to run LISP programs.
  • 1980s and 1990s, A great effort was done to unify the Lisp dialects into a single programming language. Common Lisp became compatible with the dialects it replaced. 
  •  In 1994, ANSI (American National Standards Institute) published the Common Lisp standard, "ANSI X3.226-1994 Information Technology Programming Language Common Lisp." 


LISP for Artificial Intelligence

Lisp WAS used in AI until the end of the 1980s. In the 80s, though, Common Lisp was oversold to the business world as the "AI language"; the backlash forced most AI programmers to C++ for a few years. These days, prototypes usually are written in a younger dynamic language (Perl, Python, Ruby, etc) and implementations of successful research is usually in C or C++ (sometimes Java).
If you're curious about the 70's...well, I wasn't there. But I think Lisp was successful in AI research for three reasons (in order of importance):
  1. Lisp is an excellent prototyping tool. It was the best for a very long time. Lisp is still great at tackling a problem you don't know how to solve yet. That description characterises AI perfectly.
  2. Lisp supports symbolic programming well. Old AI was also symbolic. It was also unique in this regard for a long time.
  3. Lisp is very powerful. The code/data distinction is weaker so it feels more extensible than other languages because your functions and macros look like the built-in stuff
(Sanders, 2008)
 

___________________________________________


what do they say about LISP?...


"LISP programmers know the value of everything 
and the cost of nothing".



"We toast the LISP programmer who pens his thoughts within nests of parentheses."



Alan Jay Perlis
American Computer Scientist, 1st recipient of the Turing Award



"I suppose I should learn LISP, but 
it seems so foreign"
-Paul Graham
Co-founder ViaWeb(eventually became Yahoo! Store)
and Y Combinator


"Those who do not know LISP are doomed to reinvent it."

 - Erik Naggum
Norwegian  Computer Programmer



___________________________________________

Some ICS Instructors and Professors say...


- Ailea Kathleen M. Garcera, ICS Instructor

Danilo J. Mercado, ICS Professor


Arian J. Jacildo, ICS Professor

___________________________________________


Some Students say...


"LISP is very complex in nature. 
As a functional programming language
it is hard for an ordinary person to understand it. But What's good about functional programming 
languages is that it is ideal for problem solving which is the 
core objective of any programmer..."


- Gilmar N. San Buenaventura, BSCS Batch '10


"LISP has many flavors that may be more suitable 
for what a modern programmer 
needs. It is suggestible to use some newer and more used flavors 
of scheme like Scheme and Common LISP...."

-Adrian Paul L. Anacay, BSCS Batch '10


"Programming LISP is like a trip in Wonderland."

- Mary Alexis O. Solis, BSCS Batch '10

"In programming LISP you have to think Mathematically and  
Out  of the common"

- Katherine Loren M. Tan, BSCS Batch '10


___________________________________________


Sample LISP Codes






















Sample program that prints "Hello World"
 
 
 


















Sample program in LISP that gets the factorial of an integer 


___________________________________________


References:

http://en.wikipedia.org/wiki/Lisp_(programming_language)
http://progopedia.com/language/lisp/
http://groups.engin.umd.umich.edu/CIS/course.des/cis400/lisp/hworld.html
http://stackoverflow.com/questions/130475/why-is-lisp-used-for-ai
http://www.gigamonkeys.com/book/introduction-why-lisp.html


Group Members:
CMSC 124 T - 4L
Solis, Mary Alexis
Tan, Katherine Loren
San Buenaventura, Gilmar
Olazo, Vianese Jasmine
Anacay, Adrian Paul

Monday, July 2, 2012

Python

Python Programming Language





About Python

Python is a remarkably powerful dynamic programming language that is used in a wide variety of application domains. Python is often compared to Tcl, Perl, Ruby, Scheme or Java. Some of its key distinguishing features include:
    • very clear, readable syntax
    • strong introspection capabilities
    • intuitive object orientation
    • natural expression of procedural code
    • full modularity, supporting hierarchical packages
    • exception-based error handling
    • very high level dynamic data types
    • extensive standard libraries and third party modules for virtually every task
    • extensions and modules easily written in C, C++ (or Java for Jython, or .NET languages for IronPython)
    • embeddable within applications as a scripting interface

Python is powerful... and fast

Fans of Python use the phrase "batteries included" to describe the standard library, which covers everything from asynchronous processing to zip files. The language itself is a flexible powerhouse that can handle practically any problem domain. Build your own web server in three lines of code. Build flexible data-driven code using Python's powerful and dynamic introspection capabilities and advanced language features such as meta-classes, duck typing and decorators.
Python lets you write the code you need, quickly. And, thanks to a highly optimized byte compiler and support libraries, Python code runs more than fast enough for most applications. The traditional implementation of CPython uses a bytecode virtual machine; PyPy supports just-in-time (JIT) compilation to machine code. Also, Jython and IronPython (see below) support JIT compilation on their respective virtual machine implementations.

Python plays well with others

Python can integrate with COM, .NET, and COBRA objects.
For Java libraries, use Jython, an implementation of Python for the Java Virtual Machine.
For .NET, try IronPython , Microsoft's new implementation of Python for .NET, or Python for .NET.
Python is also supported for the Internet Communications Engine(ICE) and many other integration technologies.
If you find something that Python cannot do, or if you need the performance advantage of low-level code, you can write extension modules in C or C++, or wrap existing code with SWIG or Boost.Python. Wrapped modules appear to your program exactly like native Python code. That's language integration made easy. You can also go the opposite route and embed Python in your own application, providing your users with a language they'll enjoy using.

Python runs everywhere

Python is available for all major operating systems: Windows, Linux/Unix, OS/2, Mac, Amiga, among others. There are even versions that run on .NET, the Java virtual machine, and Nokia Series 60 cell phones. You'll be pleased to know that the same source code will run unchanged across all implementations.
Your favorite system isn't listed here? It may still support Python if there's a C compiler for it. Ask around on news:comp.lang.python - or just try compiling Python yourself.

Python is friendly... and easy to learn

The Python newsgroup is known as one of the friendliest around. The avid developer and user community maintains a wiki, hosts international and local conferences, runs development sprints, and contributes to online code repositories.
Python also comes with complete documentation, both integrated into the language and as separate web pages. Online tutorials target both the seasoned programmers and the newcomer. All are designed to make you productive quickly. The availability of first-rate books completes the learning package.

Python is Open

The Python implementation is under an open source license that makes it freely usable and distributable, even for commercial use. The Python License is administered by the Python Software Foundation.


Nerd you heard?




Guido van Rossum  is the author of the Python Programming Language. The Python community refers to him as the BDFL  (Benevolent Dictator For Life), a title straight from a Monty Python skit. He was called BDFL because even if he is currently working in Google, he still spends half of his time on Python development process.




Caught Python Quotes



I would guess that the decision to create a small special purpose language or use an existing general purpose language is one of the toughest decisions that anyone facing the need for a new language must make.
      -Guido van Rossum a.k.a BDFL (Benevolent Dictator for Life)


My favorite language for maintainability is Python. It has simple, clean syntax, object encapsulation, good library support, and optional named parameters.
     -Bram Cohen (inventor of BitTorrent)


         Kung scientist ka or physicist, mag-python ka.
              -Joseph Anthony Hermocilla (Assistant Professor, ICS, UPLB)

         Python is cool.
             -Sir Reginald Recario (Assistant Professor 1 ,ICS, UPLB)

         Python is better than JAVA.
             -Sir Ludwig Tirazona (Instructor, ICS, UPLB)

         Makamandag. Functional Parang Lisp pero OOP pa din.

             -Sir LK Lactuan (Instructor, ICS, UPLB)

     
Some things to remember when programming in python...


   Python Identifiers

          Python identifiers a name used to identify a variable, function, class, module, or other object. It starts with any letter (uppercase or lowercase), and underscore (_) followed by letters , underscores , digits or just the underscore itself. It does not allow punctuation characters like @, $, and % within identifiers. Python is a case sensitive programming language thus School and school are different identifiers.
           Here are following identifier naming convention for Python:
  • Class names start with an uppercase letter and all other identifiers with a lowercase letter.
  • Starting an identifier with a single leading underscore indicates by convention that the identifier is meant to be private.
  • Starting an identifier with two leading underscores indicates a strongly private identifier.
  • If the identifier also ends with two trailing underscores, the identifier is a language-defined special name.

    Reserved Words:

    The following list shows the reserved words in Python. These reserved words may not be used as constant or variable or any other identifier names.
    Keywords contain lowercase letters only.
    andexecnot
    assertfinallyor
    breakforpass
    classfromprint
    continueglobalraise
    defifreturn
    delimporttry
    elifinwhile
    elseiswith
    exceptlambdayield




Some basic things to know when programming in python...


          Python Programming in Command Line


          Assuming that one has already installed Python, when you type in the command 'python' (without the quotes), it will open python in interactive mode.


          Programming in Python using the command line is very good for beginners. But of course you could also write your codes using text editor as long as you save it with the extension .py, then you can execute it in the command line.
          Just like any other languages, the first program I will introduce is the Hello World program. At the command line, type print "Hello World!" (with quotes) and then press enter. You'll see the output of that just below your command.


     
          Python delimiter is the new line (\n) but you do not have to specify it. Just press enter and it will know that it is the end of statement. However, it allows the use of continuation character (\) to denote that the line should continue.



            Python uses infix notation. The equal sign (=) is used to assign a value to a variable.


              In the example above, you can see that when I multiplied the 'difference' with 'e' I got an error. That is because variables must be assigned a value first before they can be used. That is also the reason why 'sum = a+b' was working because 'a' already has a value (2)just like 'b'(32). A value can be assigned to several variables at a time.

              >>> a = b = c = d = e = 888     #Variables a, b, c, d, e all will have the value 888.

              Strings in python can be expressed using single or double quotes. And it can be indexed (starting is zero). There is no character type. A character is simply a string of size one. Python strings cannot be changed. If you assign something to an indexed position, it will result to an error. Also, you can specify a substring using slice notation - two indices separated by a colon.



           
               Python also has list and it can be written as a list of comma-separated values (items) between square brackets. These items need not all have the same data type.  Also, these items can be accessed using indices. They can also be sliced, concatenated and be changed. List also has built in function append() and len() that can be used. It can also be nested (list within a list).

             

                 Comments in python begins with hash (#).

                 >>> #This is a comment.


                  Another thing to remember when programming in Python is that there are no braces to indicate blocks of codes for class and function definitions and flow control.   Indentation is  strictly enforced to denote block of codes.


Some python codes...

            Here is a simple code of converting temperature in Celsius to Fahrenheit and vice versa. The program will output a menu for the user to select whether to convert Celsius to Fahrenheit or the other way around. Once the user selected a choice, the program will ask the value to be converted. After giving the value, it will then output the converted value. The program loops from the top unless the user chooses option 3, which will terminate the program.




           Here is also a simple program that determines if a given string is a Palindrome or not.






Another program: This program is a game wherein the user enters his/her name and the program will then start the game.

The Game is named eye spy number edition wherein the computer will take note of a number between 1-10 and the user will guess the number with a maximum of 3 times. Every after guess of the user, the program will guide the user if the number is higher or lower. If three turns were made and all are wrong, the sorry message will show, but if the number is guessed within 3 times, the congratulatory message will show.






Exploring classes in Python

The example classes simulate basic character and item interaction. It uses the object-oriented paradigm side of Python. A user can create a character. Item class can be extended as a potion or as a weapon. Characters can carry items, as well as use them.









What we say about Python...

Python is very simple, yet very FUNCTIONAL. It is a powerful object-oriented programming language.
- Patrick

Python is easier to understand than Scheme.
- Roel

Python is awesome. It is simple yet you can make many program from it. It is also easy to understand because it is not too wordy and the syntax are simple.
- Emily

Python just makes things easier; quite readable code. And in my book, easier is fun.
- Nathan

Python is an easy to understand programming language. Even though I just used it with only a short period of time, I was able to understand how the language works.

- Roi



Group Name: UP Python Maroons (T-7L)

Members:

Hernandez, Patrick T.
Ledda, Roel O.
Mayuga, Emily DG.
Moldez, Nathan G.
Teodoro, Roi Marc A.


Sources:
http://www.python.org/
http://www.python.org/~guido/
http://www.python.org/~guido/pics.html
http://www.brainyquote.com/quotes/keywords/python.html
http://www.tutorialspoint.com/python/python_basic_syntax.htm
Mam Zenith Arnejo's Python Laboratory Handouts