===== CS 328 - Week 13 Lecture 2 - 2024-04-17 ===== ===== TODAY WE WILL (AFTER CS Faculty Candidate Dr. Bo Shen's talk) ===== * announcements * START our JavaScript discussion...! * prep for next class * SEE course Canvas page (by tonight) for a LINK to a Canvas form for your anonymous comments about today's faculty candidate! ===== * should be working on Homework 10 * at-least-first-attempts due by 11:59 pm on TUESDAY, April 23 (because posted late) * should be reading/doing activities in zyBooks Chapter 6 - More PHP * deadline to complete these: 11:59 pm pm Friday, May 3 * an initial set of CS 328 JAVASCRIPT CLASS CODING STANDARDS is now posted on the course public web site, as is an initial page of additional JAVASCRIPT REFERENCES ===== * CS FACULTY CANDIDATES should be giving their TEACHING TALKS during the next THREE Wednesdays in CS 328: * Wednesday, April 17 * Wednesday, April 24 * Wednesday, May 1 * the FIRST 45 minutes will be their talks, FOLLOWED by CS 328 course material for the REST of those class sessions * RECORDINGS will be posted to supplement for the missed class time * Because of the importance of student feedback on these candidates, you will receive 2 clicker questions' credit for attending their talks * (and there WILL be at least one actual clicker question during the class material following) * Let me know if you have any questions about this!! ===== PHP Survival Tips - REPEATED, just in case! ===== * it really helps, during debugging, to have included in your PHP: ini_set('display_errors', 1); * it really helps to use at least a helper function for each state in your application's state diagram, (and maybe more!) ...and to start with stubs for these within your application's "driving" PHP * when you get a completely blank screen as your PHP response, remember you can use the php command-line interface on nrs-projects to see if there's a parse error * I also am finding it useful to output p elements at intermediate points when I can't figure out *where* a bug is. (<p> before the while loop </p>, <p> DID connect </p>, <p> called function blah with argument <?= $param ?>, etc.) * browsers CAN be a *pain* when you try to view the source for a postback PHP -- I'm finding that, lately, both Chrome and Firefox are fetching the NEXT state when I'm trying to see the PHP-generated source in my browser for debugging! * this MIGHT be a preference that can be set...? * Safari, currently, is NOT doing this to me, so I am finding myself using that a lot! ===== JAVASCRIPT whirlwind tour...! ===== * common abbreviation for JavaScript: JS and for a file with external JavaScript, its suffix is .js * focusing on *client-side* JavaScript, executing on the CLIENT tier, in a browser ...JavaScript running there has a means for interacting with an HTML document via the Document Object Model (DOM) * focusing on "vanilla" JavaScript (not any particular JS library) * the hope is that seeing this can help give a reasonable foundation on which to learn whichever of the **MANY** JavaScript libraries you might want to learn later ===== ********** JAVA != JAVASCRIPT ********** ===== ==== a FEW differences between Java and JavaScript: ==== * Java is strongly-typed, JavaScript is loosely-typed * Java is REALLY object-oriented, JavaScript supports objects * Java classes are used to create objects (uses a class-based object model) * In JavaScript, you can just create an object (!!) (uses a prototype-based object model) * and their event models are pretty different! ===== * a LITTLE history: * Brendan Eich created JavaScript in 1995 so the Netscape Navigator browser could dynamically respond to user events -- so originally client-tier only! * standardized by ECMA International in 1997, and that standard is called ECMAScript * ECMA International continues to develop the ECMAScript standard; JavaScript is an *implementation* of the ECMAScript specifications. * The ECMAScript specification does NOT describe the so-called Document Object Model (DOM); the DOM is standardized by the World Wide Web Consortium (W3C) * the DOM defines the way in which HTML document objects are exposed to your JavaScript/ECMAScript ===== WHERE will we put our client-side JavaScript? ===== * it can be embedded within an appropriate element within an HTML document * it can also be in an external JavaScript file whose name has the suffix .js * CS 328 class style: we are going to strive for the "unobtrusive" JavaScript style, trying as much as possible to keep it out of the body element and just in the head element ...to be continued!