CSC/ECE 517 Fall 2011/ch4 4a ga

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction

This article discusses the extend concept as illustrated by Ruby's extend method. We provide a definition of extend, compare it to the include method, and go over the differences between extending a class and extending an object. We then consider two practical examples of Ruby's extend method.

From there, we go on to discuss how other languages provide functionality similar to that of Ruby's extend method. We also compare these implementations to the Ruby implementation as to whether they are more or less powerful than Ruby's. Finally, we also consider prototype-based languages such as Self, which don't even provide classes.

Extend in Ruby

What is Extend?

Definition

Extend vs. Include

Extending classes vs. Extending objects

Practical Examples

Twitter Module

Active::Concern

Singleton Pattern

Extend in other languages

Conclusion