i101 Final Group Project - Active Database Solution for Local Nonprofit
Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.
-
Upload
sophie-cummings -
Category
Documents
-
view
216 -
download
1
Transcript of Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.
![Page 1: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/1.jpg)
Programming LanguagesProgramming Languages
Informatics I101Informatics I101
March 22, 2004March 22, 2004
John C. PaolilloJohn C. Paolillo
![Page 2: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/2.jpg)
ComputersComputers
• Programmable, general-purpose deviceProgrammable, general-purpose device– performs any desired computationperforms any desired computation
– the program is an arrangement of logical relations of the program is an arrangement of logical relations of bitsbits
• How does one accomplish the programming?How does one accomplish the programming?– Hard-wiring (ENIAC)Hard-wiring (ENIAC)
– Machine instructions (“code”)Machine instructions (“code”)
![Page 3: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/3.jpg)
Interacting with ComputersInteracting with Computers
• OriginallyOriginally– Computer instructions are binary numbersComputer instructions are binary numbers
• ““machine code”machine code”
• Low-level languages (“assembly language”)Low-level languages (“assembly language”)– Easily-remembered mnemonics translated Easily-remembered mnemonics translated
directly into machine codedirectly into machine code
![Page 4: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/4.jpg)
![Page 5: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/5.jpg)
![Page 6: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/6.jpg)
![Page 7: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/7.jpg)
![Page 8: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/8.jpg)
![Page 9: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/9.jpg)
High-Level LanguagesHigh-Level Languages
• CompiledCompiled– Translated into machine code in two-stepsTranslated into machine code in two-steps
• compile (into “relocatable object code”)compile (into “relocatable object code”)
• link (with various resources into machine code)link (with various resources into machine code)
– Not interactiveNot interactive
• InterpretedInterpreted– Translated into machine code and executed Translated into machine code and executed
directlydirectly
![Page 10: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/10.jpg)
Some High-level LanguagesSome High-level Languages
CompiledFORTRAN
PascalCC++
TeXPerl, Java
Interpreted
LISPPascal
Unix Shell lgsDOS .BAT filesJavaScript, C#PHPPostscript
PurposeScientific,Other applications
Interactive Shells
Web support
Typesetting
![Page 11: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/11.jpg)
QuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.
![Page 12: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/12.jpg)
D.C. Engelbart’s system with mouse; Bootstrap Alliance
![Page 13: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/13.jpg)
D.C. Engelbart’s original mouse, 1964; Bootstrap Alliance
![Page 14: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/14.jpg)
D.C. Engelbart’s original mouse, 1964; Bootstrap Alliance
![Page 15: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/15.jpg)
User Interface LanguagesUser Interface Languages
• Command-line systemsCommand-line systems– UNIXUNIX– DOSDOS– VAX, TOPS-20VAX, TOPS-20– MULTICSMULTICS
• Graphic User InterfacesGraphic User Interfaces– Windows, Icons, Menus and Pointers (WIMP)Windows, Icons, Menus and Pointers (WIMP)
• Xerox StarXerox Star• MacOSMacOS• WindowsWindows• X-WindowsX-Windows
![Page 16: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/16.jpg)
![Page 17: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/17.jpg)
What’s in a High-level What’s in a High-level Language?Language?
• Commands and built-in functionsCommands and built-in functions• Sequence/order of executionSequence/order of execution• Variables (to hold values) and assignmentVariables (to hold values) and assignment• Operators (especially for arithmetic)Operators (especially for arithmetic)• Constructs for defining Constructs for defining
– Data structuresData structures– Algorithms (programs, subroutines, functions)Algorithms (programs, subroutines, functions)
• Control structuresControl structures– if/then/else, loopsif/then/else, loops– Recursion (through the program stack)Recursion (through the program stack)
![Page 18: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/18.jpg)
![Page 19: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/19.jpg)
<?php // Solution to chart portion of PHP exercise 2. // John Paolillo, October 2003. $ncol = sizeof($_GET) ; // $_GET holds the histogram $mx = max($_GET) ; // maximum value $wd = 400 ; // width $ht = 200 ; // height $cw = $wd / ($ncol + 2) ; // column width $hh = $ht - 2 * $cw ; // maximum height (pixels) $ccc = $cw/2 ; // half-width (for labels) $b = $ht - $cw ; // bottom line
$image = imagecreate($wd,$ht) ; // First color defined (red) is automatically the picture background. $red = imagecolorallocate($image, 255, 0, 0) ; $wht = imagecolorallocate($image, 255, 255, 255) ; ksort($_GET) ; // Sort the bars by key value while (list($key,$val) = each($_GET)) { $t = $b - ($hh * $val / $mx) ; // Bar height
$l = $l + $cw ; // Bar left $r = $l + $cw ; // Bar right
imagefilledrectangle($image,$l,$t,$r,$b,$wht) ; imagestring($image,1,$l+$ccc,$ht-$ccc,"$key",$wht) ; } // Chart title imagestring($image,1,$cw,$ccc,
"Distribution of Amino Acids in Peptide",$wht) ; // Output as PNG & clean up. header("Content-type: image/png") ; imagepng($image) ; imagedestroy($image) ; ?>
![Page 20: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/20.jpg)
Programming ParadigmsProgramming Paradigms
• ProceduralProcedural– Step-wise proceduresStep-wise procedures
• FORTRAN, BASIC, C, PascalFORTRAN, BASIC, C, Pascal
• FunctionalFunctional– Mathematical functionsMathematical functions– Function composition, no assignmentsFunction composition, no assignments
• Scheme, XSLTScheme, XSLT
• Object-OrientedObject-Oriented– Algorithms and data “encapsulated” togetherAlgorithms and data “encapsulated” together– Objects arranged in a hierarchy of inheritanceObjects arranged in a hierarchy of inheritance
• SmallTalk, C++, SmallTalk, C++,
• Logic ProgrammingLogic Programming– Logical relationsLogical relations
• PrologProlog
![Page 21: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/21.jpg)
Procedural: PHPProcedural: PHP
function factorial($n) {function factorial($n) {
if ($n == 1) {if ($n == 1) {
return 1 ;return 1 ;
} else {} else {
return n * factorial(n-1) ;return n * factorial(n-1) ;
}}
}}
![Page 22: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/22.jpg)
Procedural: PostscriptProcedural: Postscript
/factorial/factorial
{ dup 1 gt { dup 1 gt
{ dup 1 sub factorial mul } if{ dup 1 sub factorial mul } if
} def} def
![Page 23: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/23.jpg)
Functional: LISPFunctional: LISP
(defun fact (x)(defun fact (x) (if (<= x 0) 1 (* x (fact (- x 1))))) (if (<= x 0) 1 (* x (fact (- x 1)))))
![Page 24: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/24.jpg)
Functional: APLFunctional: APL
XX
![Page 25: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/25.jpg)
Functional: JFunctional: J
factorial=. 1:`(]*factorial@<:) @. * factorial=. 1:`(]*factorial@<:) @. *
![Page 26: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/26.jpg)
Functional: XSLTFunctional: XSLT
<xsl:template name=“factorial”><xsl:template name=“factorial”> <xsl:param name=“val”/><xsl:param name=“val”/> <xsl:choose><xsl:choose> <xsl:when test=“$val=‘1’”><xsl:when test=“$val=‘1’”> <xsl:value-of select=“1”/><xsl:value-of select=“1”/> </xsl:when> </xsl:when> <!-- end base case --><!-- end base case --> <xsl:otherwise> <xsl:otherwise> <xsl:variable name=“factless”><xsl:variable name=“factless”> <xsl:call-template name=“factorial”><xsl:call-template name=“factorial”> <xsl:with-param name=“val” select=“$val - 1”/><xsl:with-param name=“val” select=“$val - 1”/> </xsl:call-template></xsl:call-template> </xsl:variable></xsl:variable> <xsl:value-of select=“$val * $factless”/><xsl:value-of select=“$val * $factless”/> </xsl:otherwise> </xsl:otherwise> <!-- end recursive case --><!-- end recursive case --> </xsl:choose></xsl:choose></xsl:template></xsl:template>
![Page 27: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/27.jpg)
Object-Oriented: PrographObject-Oriented: Prograph
![Page 28: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/28.jpg)
Logic Programming: PrologLogic Programming: Prolog
factorial(1,1) :- !.factorial(1,1) :- !.
factorial(N,FactN) :- factorial(N,FactN) :-
M is N - 1,M is N - 1,
factorial(M,FactM),factorial(M,FactM),
FactN is M * FactM.FactN is M * FactM.
![Page 29: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/29.jpg)
![Page 30: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/30.jpg)
http://www.digibarn.com/collections/posters/tongues/ComputerLanguagesChart-med.png
![Page 31: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/31.jpg)
Collection of Programming languages:[99 Bottles of Beer] - Section A
An unusual language: Brainf***
ECMA-262.pdf
The ECMAScript Language Specification
Sun’s Java Technology
C++: http://gcc.gnu.org/
Programming Language Naming Patterns
![Page 32: Programming Languages Informatics I101 March 22, 2004 John C. Paolillo.](https://reader035.fdocuments.in/reader035/viewer/2022062517/56649e9d5503460f94b9dfe4/html5/thumbnails/32.jpg)