CS 403: Programming Languagescs403.cs.ua.edu/Previous_Semesters/Fall...

Preview:

Citation preview

©2004 Joel Jones1

CS 403: Programming Languages

Fall 2004Department of Computer Science

University of AlabamaJoel Jones

Industrial Coloquium Series

6:00pm,Tuesday, November 16th. East Engineering 119(free food is provided during the talk)

William EngelkeMercedes-Benz (MBUSI) Information Technology Careers in Enterprise Resource Planning (ERP)

Sponsored by the ACM and the Department of Computer Science

Visit the website at http://cs.ua.edu/industrial.asp

For more information contact: roan001@bama.ua.edu

NEED A JOB??? CARE Research & Development Lab

is looking for bright, motivated students

Skills desired: Previous .NET experience Web programming experience Graphics skills are a plus

Contact Kerri Keith at 348-5934 or kkeith@cs.ua.edu

For more information about our offices visit: http://care.cs.ua.edu

Ruby

• an interpreted scripting language used for object-oriented programming

• All data is an object, like we saw in Smalltalk

• Its syntax and design was influenced by Perl

• It has no functions, only method calls

• Simple Syntax

What is Ruby?

What is it used for?• Text Processing

• System Management (Databases)

• XML Programming

• GUI Programming

• It is very similar to Perl in text editing, but considered newer and better.

• Handles exceptions like in Java

• Like Smalltalk, it only supports single inheritance and also uses code blocks.

• It provides a number of features that Python is still working toward

How does it compare with other languages?

Interesting Facts:• Ruby is not an acronym. It was named after the jewel.

Sources:

http://www.rubycentral.com/misc/intro.html

http://www.ruby-lang.org/en/

LISPUses:

• real world programming anywhere from web development to finance, prevalent in academia, and also in AI• Yahoo! Store web commerce site originally coded in LISP

Differences:

• Lisp does not require the programmer to specify the data type of variables• Lisp code can also be denser (i.e. there is more expressed in a single line)

Tiffany Cooper

11/11/2004 Chris Butler7

ASP.NET

Chris Butler

CS403

Homework 1

11/11/2004 Chris Butler8

ASP.NET

Active Server Page

The implementation behind the ASP page was created by

Microsoft and intended as an open technology server-side

framework, giving web developers the freedom to develop

dynamic web sites.

ASP can be object oriented. ASP scripting host is language-independent. So you can script

with Python, Rexx, PerlScript, JScript and VBScript. There are many different reasons and ways to use asp, such as

html/web server controls, user controls, forms, form viewstate and form validation, caching, object, accessing databases, security options, and XML Web services.

11/11/2004 Chris Butler9

Form Viewstate

What is Viewstate? It works in two parts…

The first part is client detection and dynamic adjustment of the html being sent to the client.

The second part controls the viewstate via hidden form fields. http://butlerit.net/cs403/viewstate/. The client sends the state of the form along with the form each time it is sent to the server. Along with this the server sends back the state to the client in the form of the hidden field.

Note that this information is not stored on the server and it’s not done by client-side software via ActiveX or Java. The state is maintained by standard html.

The downside to this is the increase in the size of the page.

11/11/2004 Chris Butler10

<%@ Page Language="VB" %><script runat="server">

Sub Page_Load(Sender As Object, E As EventArgs)If Request.Form("txtName") <> "" Then

lblSentence.Text = Request.Form("txtName") _& " selected " &

Request.Form("ddlColor")End If

End Sub</script>

<html><head><title>ASP.NET Viewstate Form Sample #1</title></head><body bgcolor="#FFFFFF">

<form action="form1.aspx" method="post">

Enter Your Name:<input type="text" id="txtName" name="txtName" />

Pick a Color:<select id="ddlColor" name="ddlColor">

<option>Red</option><option>Orange</option><option>Yellow</option><option>Green</option><option>Blue</option><option>Indigo</option><option>Violet</option>

</select>

<input type="submit" id="btnSubmit" text="Submit" />

</form>

<asp:label id="lblSentence" runat="server" />

</body></html>

<%@ Page Language="VB" %><script runat="server">

Sub btnSubmit_Click(Sender As Object, E As EventArgs)lblSentence.Text = txtName.Text & " selected " _

& ddlColor.SelectedItem.TextEnd Sub

</script>

<html><head><title>ASP.NET Viewstate Form Sample #2</title></head><body bgcolor="#FFFFFF">

<form id="frmViewState" action="form1.aspx"method="post" runat="server">

Enter Your Name:<asp:TextBox id="txtName" runat="server" />

Pick a Color:<asp:DropDownList id="ddlColor" runat="server">

<asp:ListItem>Red</asp:ListItem><asp:ListItem>Orange</asp:ListItem><asp:ListItem>Yellow</asp:ListItem><asp:ListItem>Green</asp:ListItem><asp:ListItem>Blue</asp:ListItem><asp:ListItem>Indigo</asp:ListItem><asp:ListItem>Violet</asp:ListItem>

</asp:DropDownList>

<asp:button id="btnSubmit" text="Submit"onClick="btnSubmit_Click" runat="server" />

</form>

<asp:label id="lblSentence" runat="server" />

</body></html>

Form1.aspx Form2.aspx

11/11/2004 Chris Butler11

References

http://www.asp101.com This is where the examples and tutorials came from.

http://www.asp.net The official Microsoft ASP. net site.

Bradford Hester

Bradford Hester

What is Groovy?• Groovy is an objected oriented language that

uses Java-like syntax.

• It’s purpose is to be able to use the same powerful and concise coding syntax of Ruby or Python but allowing you to stay on the Java Virtual Machine.

• You can use Jython and JRuby, which are ports for Java but they share the look and feel of their ancestors.

• Groovy gives you this ability with out having to learn a new syntax.

Bradford Hester

Groovy Examples

• Dynamic typing like Smalltalk

• Range Syntax

• Negative Indexing

SQR

Daniel Robinson

SQR

SQR is a programming language specifically designed for SQL database reporting and information processing.

SQR Script Language Built-in output formatting Used mostly for creating reports Has SQL as it’s base Runs on serveral different platforms

Resources http://www.ontko.com/sqr/ http://www.codefactory.net/lesson1.htm

Tool Command Language (tcl)

Originally intended to be a reusable command language

These command languages were developed quickly and designed poorly

Developers then concentrated on implementing a general-purpose command language that could be easily integrated into new applications.

Syntax is a mixture of C and UNIX

Suzanne Howard

Pros and Cons of tcl

Interpreted language

High-level scripting language

Runs on many platforms

Extensible

Embeddable in applications

Free!

Interpreted language Strange syntax Weak facilities for namespace control and modularity Weak data structures Difficult to organize/debug

Suzanne Howard

Katrina Roan 21

Haskell

Katrina Roan 22

Haskell

Functional Language The standard version is Haskell-98 It is different from that it uses lazy evaluation

– i.e. it only implements enough of the code to get the answer.

A lot of the programs I found that were written in Haskell were for thesis or dissertation work.

There is an implementation of Quake written in Haskell.

Katrina Roan 23

Haskell

Haskell.org boasts that Haskell code is “shorter, clearer, and more maintainable” and that using Haskell “offers you substantially increased programmer productivity.”

There are several derivatives that implement object orientation. These include: Haskell++, O’Haskell, and Mondrian.

MIT and Glasgow University each developed a version called Parallel Haskell for parallel computing.

PostScript Programming

All Text in Italics were taken from the following website:E. Weingar A First Guide to PostScript. [Online] Available http://

www.cs.indiana.edu/docproject/programming/postscript/postscript.html, January 18, 1997

David Crawford

PostScript

• What is PostScript?“PostScript is a programming language optimized for printing graphics and text (whether on paper, film, or CRT is immaterial). In the jargon of the day, it is a page description language.”

• Why PostScript? “The main purpose of PostScript was to provide a convenient language in which to describe images in a device independent manner. This device independence means that the image is described without reference to any specific device features (e.g. printer resolution) so that the same description could be used on any PostScript printer (say, a LaserWriter or a Linotron) without modification. In practice, some PostScript files do make assumptions about the target device (such as its resolution or the number of paper trays it has), but this is bad practice and limits portability.”

David Crawford

PostScript

• Developed by Adobe in the early 1980’s• PostScript is widely used on many platforms as a page description

language.• Probably most widely used page description language in use today.• Commonly used for Desktop publishing.• Most Printers support PostScript• Alternatives to PostScript: HPGL, PCL, GDI, etc…• PostScript is a flexible language and “could” be used for application/game

development, but this would be difficult.

David Crawford

PostScript

• Stack Based Language using something similar to reverse polish notation.

• PostScript is an Interpreted language.• Uses arguments, operators, comments and a

lot of other good stuff other programming languages have.

• Fern Example:

David Crawford

Darwin

--In order to achieve fast learning and adaptation, the syntax of the language resembles the standard C language syntax.

--The DARWIN language is designed to be a simple genetic algorithm oriented language.

--DARWIN language has a special syntax construct called moderators.

--A moderator is a function that associates an operation on a data structure, creating the effect of encapsulation present in Object Oriented

programming.

--For example, the gene construct has the print, initialize, crossover, mutate and evaluate operations defined on it.

--A DARWIN program is generally composed of three parts - -the genetic algorithm constructs specification, -the moderator definitions, -and the user-defined set of functions. Josh Naro

Glade

April GuyCS 403

11/08/2004

Glade is a free user interface builder for GTK+ and GNOME that is released under the GNU General Public Liscense

• Using Glade to create interfaces is slightly different to other widget sets because instead of having fixed positions and sizes for widgets, Glade uses containers such as horizontal boxes and tables to arrange widgets. This feature makes it easier to support resizing of windows and allows easy conversion into alternate languages.

Glade windows

• Main window - lists all of the windows and dialogs making up a project

• Widget palette - shows icons representing all of the available widgets

• Property editor - allows user to alter the properties of widgets, such as the widget size or the label text

Gonvert

• Gonvert is a conversion utility that allows conversion between many units like Ancient, Imperial with many categories like length, mass, numbers, etc. All units converted values shown at once as you type. Easy to add/change your own units.

Kellan Burt

Dylan (Dynamic Language) Intended for rapid Application and System

Development Combines best qualities of static languages

(small, fast programs) with the best qualities of dynamic languages (rapid development, code that's easy to read, write, and maintain)

Facilities for Database and GUI programming have been implemented

Kellan Burt

What Makes Dylan Special? Automatic memory management Clean, consistent syntax Fully and consistently object-oriented

model Dynamic as well as static type

checking First-class functions and classes

Kellan Burt

Dylan vs. Other Languages Syntax structure resembles Scheme Similar to Smalltalk: everything is an object, has

an interactive prototyping environment

Mercury.

john hayes

About it.- A logical programming language (like Prolog)- In fact, could be described as what Prolog should’ve

been.- Strongly typed, strongly moded

e.g. :- pred func(int, int, int).:- mode func(in, out, out) is det.

- nondet, multi, semidet modes

From the Mercury site: “Mercury is designed for the construction of large, reliable, efficient software systems by teams of programmers.”

Some more about it.- Compiler actually creates C code as intermittent step,

then uses shell script to run gcc. :-\- Seems to have some advantages:

- "Half of the typical programming errors cannot even be expressed using Mercury and a lot of the others are automatically caught and pinpointed," — Dr Zoltan Somogyi

- Disadvantages:- Documentation is lacking- Syntax is difficult to read

Who cares?- Microsoft, apparently. ~ $500,000 donated to

University of Melbourne for Mercury research.- Then again, it only takes Microsoft Corp about 22

minutes to generate that much money…- Project is now targeting .NET.

- If you do, look athttp://www.cs.mu.oz.au/research/mercury/

Recommended