Data Structures and Algorithms with Object-Oriented Design Patterns in Ruby This book was motivated by my experience in teaching the course E&CE 250: Algorithms and Data Structures in the Computer Engineering program at the University of Waterloo. I haveData Structures and Algorithms with Object-Oriented Design Patterns in Ruby This book was motivated by my experience in teaching the course E&CE 250: Algorithms and Data Structures in the Computer Engineering program at the University of Waterloo. I have
Data Structures and Algorithms with Object-Oriented Design Patterns in Ruby
This book was motivated by my experience in teaching the course E&CE 250: Algorithms and Data Structures in the Computer Engineering program at the University of Waterloo. I have observed that the advent of object-oriented methods and the emergence of object-oriented design patterns has lead to a profound change in the pedagogy of data structures and algorithms. The successful application of these techniques gives rise to a kind of cognitive unification: Ideas that are disparate and apparently unrelated seem to come together when the appropriate design patterns and abstractions are used.
Pretend that you?ve opened this book (although you probably have opened this book), just to find a huge onion right in the middle crease of the book. (The manufacturer of the book has included the onion at my request.) So you?re like, ?Wow, this book comes with an onion? (Even if you don?t particularly like onions, I?m sure you can appreciate the logistics of shipping any sort of produce discreetly inside of an alleged programming manual.) Then you ask yourself, ?Wait a minute. I thought this was a book on Ruby, the incredible new programming language from Japan. And although I can appreciate the logistics of shipping any sort of produce discreetly inside of an alleged programming manual
Ruby is "an interpreted scripting language for quick and easy object-oriented programming"; what does this mean? interpreted scripting language:-ability to make operating system calls directly. powerful string operations and regular expressions
immediate feedback during development
variable declarations are unnecessary
variables are not typed
syntax is simple and consistent
memory management is automatic
Little Ruby and a Lot object
Welcome to my little book. In it, my goal is to teach you a way to think about computation, to show you how far you can take a simple idea: that all computation consists of sending messages to objects. Object-oriented programming is no longer unusual, but taking it to the extreme - making everything an object - is still supported by only a few programming languages. Can I justify this book in practical terms? Will reading it make you a better programmer, even if you never use "call with current continuation" or indulge in "metaclass hackery"? I think it might, but perhaps only if you're the sort of person who would read this sort of book even if it had no practical value.
This book is a tutorial and reference for the Ruby programming language. Use Ruby, and you'll write better code, be more productive, and enjoy programming more. These are bold claims, but we think that after reading this book you'll agree with them. And we have the experience to back up this belief. As Pragmatic Programmers we've tried many, many languages in our search for tools to make our lives easier, for tools to help us do our jobs better. Until now, though, we'd always been frustrated by the languages we were using. Our job is to solve problems, not spoonfeed compilers, so we like dynamic languages that adapt to us, without arbitrary, rigid rules. We need clarity so we can communicate using our code. We value conciseness and the ability to express a requirement in code accurately and efficiently. The less code we write, the less that can go wrong.
Ruby is a fairly new language out of Japan that apparently is very popular there. I've heard it is more popular than python there, but I haven't seen anything (yet) to confirm that rumor. Ruby is a clean, very-OO, small, well ported scripting language with a good class library. I'm really enjoying using/learning it. To review, it has full reflection mechanisms and a fairly simple syntax. Unlike python, it combines a lot of smalltalkism and perlisms which makes it very ituitive to use. As the programmatic guys say "it works the way you expect it to". I think this thing has already beat out python as far as my preferences go. It really has its shit together.
This tutorial gives an introduction to GUI programming using the Qt toolkit with QtRuby. It doesn't cover everything: the emphasis is on teaching the programming philosophy of GUI programming, and Qt's features are introduced as needed. Some commonly used features are never used in this tutorial. This little game doesn't look much like a modern GUI application. It uses a good few of the GUI techniques, but after you've worked through it, we recommend reading Tutorial #2. The second tutorial is a little more formal and covers the features of typical application including menubars, toolbars, loading and saving, dialogs, etc.
This tutorial is aimed at people that want to use Tk as toolkit with Ruby. It does not really matter whether you are very proficient in Ruby or with toolkits. Examples may overwhelm the novice sometimes, but each line is explained. Step over it and come back in a later stage. The small differences in those lines provide a wealth of information for the more experienced programmer.
A few reasons to use Tk:
Tk is supported in many places (though others are definitely catching up),
Tk may look small or simple, but is very powerful. Of course it can do all basics, like any toolkit, but some things are done in a very simple way, Its canvas has some very nice features for selecting and manipulating objects (like lines and curves) on it. It can even dump its content in a PostScript file. Tk has a few prebuilt windows like a color chooser and dialog,
Can use many Tk extensions from Ruby.