profile

Categories

Tags

Welcome!

You'll find my course content and collaborative discussion about technology.

I teach as an adjunct faculty in the Computer Information Systems department at Spokane Community College

Email

kblake DOT scc AT gmail DOT com

Presentations/Interviews

RubyLearning.com interview
Course Technology - Ruby on Rails Presentation



Modules - basic syntax

January 27th, 2008 |

In this screencast I introduce modules and syntax. I demonstrate the use of include and extend and when you would use them. In the next screencast I will use modules in a practical example.
Code

Modules

January 24th, 2008 |

What can you do if you notice the same functionality being duplicated by your classes? You know it feels yucky inside when you copy some methods from one class and paste them to another, but what do you do?!!? Use a module!!
A module or mixin are practically synonymous. A module is a collection of methods and constants that is external to a Ruby program. It is commonly used to provide features “mixed” into a class.
You may mixin as many modules as you want into a class.

Two ways to mixin instance methods:
class MyClass
include MyModule #this will be mixed into all instances
end
or
my_object = Myclass.new
my_object.extend(MyModule) #this will mixed into only this object

To mixin class methods:
class MyClass
extend MyModule
end

Code Documentation

January 23rd, 2008 |

There are two ways to communicate what your code does: the code itself and using comments.

Self Documenting Code

Source code should be understandable not because it has comments but because of its elegance and clarity – correct use of variable names, good use of whitespace, good separation of logic, and concise readability. Code will be read hundreds of times and written only a few times. So invest quality time into spelling out names such as fn into firstname. Fight the urge to use cryptic variable names.

Code Comments

Code should have comments however an abundance of comments can be just as bad as too few. Comments should explain why something is done. The code itself already shows what it is done. So commenting on what is done is redundant. Do not use commenting as a substitute for good code. Another way to say that is that if you need to comment code due to its unclarity then maybe you need to rewrite the code to be more clear and remove the comment.

Update: I found this article which is about using natural language in your code to make it more readable. Read it.

Rubyisms

January 23rd, 2008 |

I’ve mentioned most of these in past quarters but I know how easy it is to forget. Many of these will make your life easier if you follow them. Please read through.
Read Rubyisms

Ruby Naming Conventions

January 21st, 2008 |

I was lenient on naming conventions when grading the review assignment. Here is a review of the naming conventions that you will be accountable for from here on out. Online examples:

Apply to all naming conventions

spell out names (no abbreviations)

File Names

all lower case, separate words with underscore Example: my_homework.rb

Classes

camel case Examples: CompanyA, YourPet, MyOldCar

Variables

all lower case, separate words with underscore Examples: age, first_name, company_one, address

Methods

all lower case, separate words with underscore
methods that return boolean end with ?
Examples: jump, jump_high, old_enough?
puts object prints to_s by default. no need to call to_s unless necessary

CIS 283 - Class Variables and Class methods Assignment

January 21st, 2008 |

Download Assignment

Class Variables and Class Methods Example

January 16th, 2008 |

Code
Video File

Class Methods

January 14th, 2008 |

Code
Video

Class variables - First attempt at screencast

January 13th, 2008 |

Don’t expect too much here. But at least I’m trying. I cannot lecture in person but at least I can screencast. :) Hopefully I’ll get better with these.
I need feedback on video quality – dimension size, sound quality, etc. I have a lot of flexibility as far video settings.
Warning: A couple of times in the screencast I mentioned ‘class method’ when meant to say ‘class variable’.
Code
Video

Class variables, class methods, and modules

January 10th, 2008 |

Primer: Topics to study for this up and coming week

CIS 283 - OOP Example (Playing with Dice)

January 7th, 2008 |

I know some of you want to see a solution to last quarter’s final. Here is one I hacked up tonight. Enjoy!
Check it out >>

CIS 283 - Review Assignment

January 6th, 2008 |

Please read attached assignment specifications. If you have questions, please comment here on this blog first. Secondly, you may email me at kblake.scc@gmail.com.
Review Assignment

CIS 283 - Syllabus

January 3rd, 2008 |

Here you go! I’ll be getting a review assignment out early next week. Until then I’d review the plethora of code examples found on the P: drive from CIS 282.
Syllabus

CIS 283 - Welcome!

January 2nd, 2008 |

Wow! Is it the start of winter quarter already? As you know I am delivering this course online through this website. I'll provide screencasts, links, and textual information here and lots of it. I went to send an email to the class but my access to my roster is down due to an SCC server failure. As soon as I get my roster with your emails I'll send a more formal message. I'll have my syllabus posted by Friday and a tentative schedule by next week. Stay tuned. For those that use RSS, feel free to subscribe to my website. Take care.