Software Development (CSC 321 2016S) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] [FAQ] [Teaching & Learning]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Outlines]
Reference: [Slack] [Ruby@CodeCademy]
Related Courses: [Rails Tutorial] [CSC 321 2016S @ EdX] [CSC 321 2015S (Davis)] [CSC 321 2015F (Rebelsky)] [CSC 322 2016S (Rebelsky)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker]
Overview
These are some reflections from your journals.
In answering questions, many of you seemed to conflate Ruby and Rails. Ruby is a general-purpose programming language. Rails is a Web application development infrastructure that happens to use Ruby for its programming aspects.
How do you deal with the issue that you haven't clearly specified the type of a variable or parameter?
Class
and Object
. (1)What does that really mean?
What is it and why is it useful?
Clearly, you don't need to know this well to survive in the class.
(Although you need to know some particular techniques.)
Generally, the idea that you can write programs that write code. Most frequent use in Ruby is for common object structures.
In Java
public class Course
{
int number_registered;
...
public int getNumberRegistered()
{
return number_registered;
} // getNumberRegistered
public static void setNumberRegistered(int nr)
{
number_registered = nr;
} // setNumberRegistered
} // class Course
In Ruby, there are language constructs that let you say "I want a setter/getter for my field." (Reference manuals are your friend.) Metaprogramming lets you build one of these constructs yourself.
yield
(3)Another thing that's not absolutely essential, even though you see it used in the various template files.
Procedures can take blocks as input and then call those blocks at appropriate times. It's one of the ways in which Ruby provides too many mechanisms for the same basic idea.
def foo
yield some_secret_code
end
foo { |code| screamAndShout unless validate code }
Operationally, we call foo, passing in the block `{ | code | ... }
When we hit the yield
in foo
, we evaluate the code in the block,
using some_secret_code
for code
.
Why do we bother?
class StaticPagesController < ApplicationController
def home
end
def help
end
def about
end
end
HTML 5 and the history of HTML.
Before the Web, there was SGML. We want info in digital format. We care about the content, we care about the layout, and we care about the role text plays. SGML provided ways to deal with this.
Then there was the Web. Share documents, marked up with tags that tell you a bit about roles and not so much about appearance. Some very basic tags (such as section headings, paragraphs, and lists).
Then the Web grew. How do I program it? Server side? Client side? Initial model: Shove an application in the middle of the page (Java Applets, Flash).
But how do we manipulate data on the page? A client-side page manipulation language, JavaScript. Over time, increased agreement on what should be in JavaScript, but still not perfect agreement. (Soon to be renamed ECMAScript because of the body that is arranging the agreement.)
The World Wide Web Consortium (aka W3C) designed CSS (Cascading Style Sheets) for describing appearance of Web documents. Allows us to separate role from appearance.
Now four technologies involved: HTML (for describing content and roles), Javascript (describes interactivity; real programming language); CSS (appearance); DOM (document object model; a better way to reprsent HTML for the Javascript). Together, these are HTML 5.
Chapter 5!
Why isn't full_title
working?
Because you didn't copy the appropriate code from chapter 4.