Download presentation
Presentation is loading. Please wait.
Published byWillis Williams Modified over 9 years ago
1
1 CS 131 Wrap Up Fall 2008 What Good is Programming?
2
2 What have you learned? Data int float char bool string array struct arrays of struct Control sequential loop (for, while, while/do) selection (if, switch) Organization functions libraries Is there anything you can't represent now? yes, more complicated information structures in CS 132 Are functions enough to organize a program? no, we need better ways to encapsulate related functionality
3
3 Who Needs This? Programming underlies most of what you do In your world Streams are fancier input: mouse, touchpad, laser trigger, voice output: webpage, pda display, cellphone Information organization and its exploitation are less visible do you ever ask how your cellphone knows who has called? how can find a recipe for crab cakes on the web? You function at a higher level Photoshop commands versus processing an array Google instead of a programming a search But the underlying programming is what you have learned
4
4 What else is Computer Science? Database management how can Amazon find all books by a given author? how do they know what to suggest you buy? Web programming how does their website work so flawlessly? Software engineering how is a million line program developed? Graphics how can a program rotate an object in 3d? how can Flash transform one object into another? Computer engineering who is building the next generation of computers and gadgets? IT management Wells should have wifi everywhere and the net always up, right? Communications
5
5 Where is Programming on the Web? HTML for static web pages JavaScript for client-side programming the sayings at the bottom of my page Towers of Hanoi PHP/ASP/Perl for server-side programming interfaces to databases interfaces to other web services such as credit card processing
6
6 Client (you) Server (aurora.wells.edu) (2) Client SW (IE/Netscape/ Firefox) Server SW (Apache, IIS) (1) (3) Steps: (1) Client sends an HTTP* request message (clicks on a link) (2) Server processes the request (3) Server sends response (an HTML page) (4) Client browser interprets it * Hypertext Transfer Protocol, a format for Internet messages Client/Server Communication (HTML)
7
7 Example: HTML (a markup language to define how to format the content) Wells Open House Welcome to Wells Things to do Take a tour Go to a class Eat lunch The page: welcome.htmwelcome.htm
8
8 ) (2) Client (you) Server (e.g. aurora) Client SW (Netscape/IE/ Firefox) (1) (2) Steps: (1) Client sends HTTP request message (2) Server sends page back to the client (3) Client executes JavaScript commands that are in the page Client-Side Programming (JavaScript) JavaScript interpreter Server SW (IIS, Apache) (3)
9
9 Example: JavaScript Simple Alert Pick the right door and win a car: <input type="button" value="Door 1" onclick="alert('You got my goat')"> <input type="button" value="Door 2" onclick="alert('You win a car')"> The page: door.htmdoor.htm Other examples: checking form input, sudokuchecking form inputsudoku
10
10 ) (2) Client (you) Server (e.g. my computer) Client SW (Netscape/IE/ Firefox) (1) (3) Steps: (1) Client sends HTTP request message (2) Server processes request message and executes any client-side programming (e.g. a database interaction) (3) Server sends page back to the client Server-Side Programming (PHP) CGI program JavaScript interpreter CGI Interface Server SW (IIS, Apache)
11
11 Server-Side Programming Uses resources that are not on the client computer –a databaseof records –software for processing them Languages commonly used: Perl, ASP, PHP Other applications –process an online order –check the weather –find driving directions to Wells –manage your Facebook information
12
12 <?php require_once('Connections/cn330.php'); mysql_select_db($database_cn330, $cn330); $query_rsUsers = "SELECT * FROM tblUser"; $rsUsers = mysql_query($query_rsUsers, $cn330); $row_rsUsers = mysql_fetch_assoc($rsUsers); ?> Write User Names Display All User Names <?php do { echo $row_rsUsers['FullName']; ?> <?php } while ($row_rsUsers = mysql_fetch_assoc($rsUsers)); ?> (view the code sent to the browser) Example: PHP (WriteNames1.php)WriteNames1.php
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.