josephwilk/pronounce — pull request #13 by gwagener (2013-08-08 09:57:26+00:00)
Title: Remove metaprogramming and favour composition over inheritance for Phones

In #3 I decided to load the data in the phones file as functions that create instances of Phone with different common bits of data. I did that in https://github.com/gwagener/pronounce/compare/master...phone_functions. However, while coding that I realised that there was no need for functions when we were only dealing with static data. I first thought about having a hash with the type name to articulation association, but that isn't OO and also isn't extensible if I wanted to add something to phone types like... voicing, not saying that's coming ;)

This makes Phone smaller, but adds a lot of code in total. More of that code is also becoming delegation, Phone delegates comparability and syllabicity to PhoneType which delegates them to Articulation. That's possibly just the way things have evolved, but I tried to split things out into classes so they had appropriate responsibilities.

I do like the parallels between PhoneType and Articulation which is something I was thinking of in my comments on #3.