CS 330 Lecture 39 – Mixins and Wrap-up
Agenda what ?s multiple inheritance in Ruby? implementing Orderable wrap-up Code vec3.rb Haiku
CS 330 Lecture 38 – Monkey patching, Meta-programming, Blocks, and Mixins
Agenda what ?s monkey patching why monkey patch? a custom malloc reflection and meta-programming why meta-program? a testing framework adding blocks to TestTest mixins making things Orderable (IRL, use Comparable) ?s Are there non-English languages? http://en.wikipedia.org/wiki/Non-English-based_programming_languages http://www.codinghorror.com/blog/2009/03/the-ugly-american-programmer.html What’s the point of symbols? http://www.troubleshooters.com/codecorn/ruby/symbols.htm http://glu.ttono.us/articles/2005/08/19/understanding-ruby-symbols http://www.robertsosinski.com/2009/01/11/the-difference-between-ruby-symbols-and-strings Is there something like tryruby.org for Haskell? http://tryhaskell.org Is there something […]
CS 330 Lecture 37 – Ruby Objects
Agenda what ?s why do I preincrement? Ruby symbols classes in Ruby The Final For the final, you are expected to: write code that intelligently shares data via references (C++) be able to templatize a given class to increase its reusability (C++) generalize functions into higher-order functions that parameterize work (Haskell) use pattern matching to […]
CS 330 Lecture 36 – Hello, Ruby and Roogle II
Agenda what ?s what does this do? Ruby’s classification dynamic typing and duck typing finishing Roogle What Does This Do? Dynamic vs. Duck With dynamic typing, the interpreter goes through this thought process: Ah, I’ve got a value V here. The coder is trying to do operation O to it. Before I run this, I […]
CS 330 Lecture 35 – Roogle, a Poor Man’s Search Engine
Agenda what ?s program this a simple search engine scrappy Ruby top-level functions imperative and object-oriented with some functional globals vs. locals Hash, Array, and Set Program This TODO Make some progress on http://tryruby.org. Quarter sheet. Code Indexing Pseudocode Searching Pseudocode roogle.rb Haiku
CS 330 Lecture 34 – Issues of Inheritance
Agenda what ?s program this weak encapsulation composition multiple inheritance? directed super the dreaded diamond problem TODO Read the first three pages of http://mislav.uniqpath.com/poignant-guide/. Quarter sheet. Program This Code rect.cpp raffle.cpp Multiple.cpp random.cpp Haiku
CS 330 Lecture 33 – Marching Squares: A C++ Case Study
Agenda what ?s contourer: a case study on OOP and C++ bit manipulation TODO Get two homeworks done before the networks students ruin us all. Code msquares.cpp Haiku
CS 330 Lecture 32 – Garbage Collection
Agenda what ?s deconstructors garbage collection a C++ smart pointer TODO Read section 7.7.3 in your book. Quarter sheet. Wondering about Java’s garbage collection? Read http://www.ibm.com/developerworks/library/j-jtp10283/. Why do we need both delete and delete[]? Check out http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=287. Code FasterString.cpp SmartPointer.h Haiku
CS 330 Lecture 31 – Generics and Templates
Agenda what ?s some C++ trivia a quick Java ArrayList polymorphism: subtype vs. parametric Java’s generics the acks of type erasure C++ templates TODO Read sections 3.5.3 and 8.4 in your book. Quarter sheet. Code UnwildList.java WildList.java WildList.cpp Haiku
CS 330 Lecture 30 – Overloading Builtin Operators
Agenda what ?s what does this do? a FasterString class operator<< friend operator[] operator+ operator* operator+= on parity TODO Read http://weblogs.java.net/blog/cayhorstmann/archive/2011/12/06/operator-overloading-considered-challenging?utm_source=feedly. No quarter sheet. Code refs.cpp Vector3.cpp FasterString.cpp Haiku