CSC302 2007S, Class 30: Ruby (3) Admin: * Beware! Friday the 13th falls on Friday this month. * Don't forget next week's Tuesday extra. * I'd like to hear prospective presentation groups on Monday and prospective topics on Friday. * Reading for Wednesday distributed (there is no reading for Monday). Overview: * About the Presentations. * Rails. * Convention and Introspection. * Ruby vs. Java, Revisited. /Looking forward to the last two weeks of class/ * Week 13: Presentations * Week 14: * Monday: Presentations * Wednesday: Epigrams on Programming * Friday: Review and Evaluation * Finals week: * Final - Take home; think about due date /About Presentations/ * Important curricular issue - Need the experience of presenting technical matter (that is, CS STUFF) to your peers and to other people, in a relatively formal setting * Sometimes presentations happen in Tutorial (but not always) * Usually presentations happen in Software Design (but not always) * 302 is another natural candidate * In addition, gives you the opportunity to pick a few more topics * Presentations done in groups of three * You get the whole class period * Typically five minutes gets used for adminstrative stuff * Thirty minutes for the presentation itself * Ten minutes for Q&A * Five minutes of slack * How should you present? * Norm: Powerpoint * Also: Whiteboard * NOT! Read a script with no visuals * Maybe - Lab ; Round Robin Recitation ; ... * Readings? - YES (Preferably one per class) * What? * See the web page * Yes, you can do more practical stuff, too, without penalty /Today's Readings: Rails/ * Rails is responsible for much of Ruby's popularity * Rails is a popular Web development environment * Rails is enabled by Ruby * What aspects of Web app development does Rails automate that are a pain to do by hand? * Generating some web pages for you * For each table in the database * A page to view an entry * A page to edit an entry * A page to add an entry * A page that lists all entries * Most key queries are abstracted into library routines * The interface between CGI/Post/Get and methods * EACH OF THE THINGS RAILS GENERATES IS MODIFIABLE * What aspects does Rails seem to neglect? * Doesn't really help design wicked-neat looking Web pages * What view of the world does Rails promote? * MVC * Rails depends on Ruby. How? * What about this "ten times faster" claim? * Lots of articles say this, including ones by former sceptics * But often for straightforward applications, without much complicated application logic * Long standing evidence that "lines per day" is consistent for most programmers and is independent of language * Try it? /Why Ruby? - Convention and Introspection/ * Introspection - The ability to ask about methods and stuff More generally, the ability to ask objects about themselves (and to have the answers represented as objects) * In Ruby, class, methods, etc. * Example: Unit Testing Framework * Look for all classes whose name matches a certain pattern ; assume such classes represent unit tests (e.g., UT_) * Within that class, look for all zeroary methods whose names start with a certain pattern (e.g., test_) * Call each such method Other reasons to like Ruby * Scripting model * Who cares about types?