Software Development (CSC 321 2015F) : EBoards

CSC321.01 2015F, Class 09: Pause for Breah


Overview

Preliminaries

Admin

Questions

Code smells

What is a code smell?

Signals of potential problems

        char *strcpy(char *source, char *target)
        {
          while (*target++ = *source++)
            ;
          return --target;
        }

Yes, you should think about these as general guidelines. There's some really good code out there that fails many of the "obvious" smells.

Make it a habit to look through code you write or receive and ask whether it violates some of these smells. If it does, rewrite it.

Designing databases

We are working with relational databases in Rails, and will do so elsewhere. What is a relational database?

How do we represent each kind of relation in these tables?

Many-many is complicated. How would we deal with multiple actors per movie

Movie
        1, "Star Wars", "PG", "George Lucas", "Before you were born", "A long time ago in a galaxy far far away", -3

Actor
        1, "Mark Hammill"
        2, "Harrison Ford",
        4, "Carrie Fisher"

Role
        1, 1, "Luke"
        1, 2, "Hans Olo"
        1, 4, "Princess Leah"

But now our information is in multiple tables, what do we do?

Medium picture: Programming with Web Services

TDD and BDD, revisited