Comp40070 Design Patterns comprises an introduction to Design Patterns, mainly from the ‘Gang of Four’ catalogue. The primary language used is Ruby. The lectures and labs take place in the week December 3-7, approx 9.00-5.30 each day.

Essential Preparation

This is a Ruby-based module. You’re expected to become familiar with the basics of object-oriented programming in Ruby (classes, methods, inheritance, polymorphism etc.). We’ll cover some of the more unusual constructs such as mixins, blocks and closures in the module itself. We’ll be using Ruby as a general purpose object-oriented programming language, so its other features, like regular expressions, are not of interest.

Recommended Reading

The recommended text is Design Patterns in Ruby by Russ Olsen. This is an excellent book and well worth purchasing, though it’s not an essential purchase. There are many useful resources online to help you learn Ruby. On the patterns side of things, these two may be of use:
Russ Olsen’s site on Design Patterns in Ruby
Two-part JavaWorld article on design patterns

Programming Preparation

To gain some Ruby practice, complete this programming exercise and submit your solution by November 28, 2018 (submission details below). This in an undergraduate programming assignment, but serves well as a warm-up exercise for the module. One goal is to transfer your object-oriented development skills to this new language.

I’m also using this exercise to see how you approach software design. Please design this program as best you can, as if you were doing it in a professional context and writing code that your colleagues would also have to work with. No need for unit testing or dependency injection, but I’d like the design of your program, i.e. what functionality goes into which class, to be your best effort.

Please note that completing this exercise is compulsory.

Submission details: Email your submission to mel.ocinneide@ucd.ie, noting the following:
- Subject heading ‘design patterns programming exercise’
- Attach all .rb files, unzipped. main.rb should run your program.
- use the email body to state what your program does very briefly (e.g., ‘all parts working correctly’). Also, write a small few lines justifying briefly any design decisions that you reflected on (If you write nothing, you thought there were no design decisions to be made. Really? :-) ).

Study Material

Here are slides from an undergraduate programming module that I use to introduce Ruby to Java programmers. Don’t get hung up on details, but scanning these should help your in getting used to Ruby.
Intro to Ruby for Java Programmers
Inheritance in Ruby
A little bit on typing (you’ll pick this up in the module anyway)

Technology Used

The primary tool used is the RubyMine IDE. You can use it in demo mode before the module and we’ll provide you with a licence for UCD use before the lectures. You may have another favourite IDE, but it will make working with a partner tricky so we ask everyone to use RubyMine.

You will also want to draw basic UML diagrams during the module. I strongly recommend the beautifully simple Violet editor (all platforms).