fillmaster / fillMaster

FillMaster: A drum idea generator / improvisation trainer! - Open Source, always looking for more contributors :)
https://fillmaster.app/
GNU General Public License v3.0
31 stars 7 forks source link

Make tempoPreview class #56

Closed dcallus closed 2 years ago

dcallus commented 2 years ago

Let me know @ninad-d if you can think of a better implementation before continuing. We can have a call if you like.

Here are my thoughts.

I've turned pattern.ts into an abstract class, mostly because I want to enforce the method getMetronomeString(). But we may want to use pattern directly at some point, so maybe it's not a great idea.

I think it's probably best to put a new abstract class ABOVE pattern. An abstract class called something like MetronomeStringBuilder with a single abstract method getMetronomeString(). This method is necessary on all classes related to the metronome so it must be enforced.

Currently it would need no other methods.

From this (MetronomeStringBuilder) we could make a new child class (on the same level as pattern) called tempoPreview or some such.

It would basically just need to return '1000100010001000' when the getMetronomeString() is called. That's all it would do for now. It could even be hard coded in.

This class is necessary for previewing tempos.

But the question is, does it make sense to use inheritance in this case? Or would some sort of composition be better? It's certainly not breaking any rules to do inheritance because the new parent will have less functionality, but maybe it's overkill.

What do you think?

So the inheritance would look like this:

image
dcallus commented 2 years ago

I'm going to sort this now. Composition doesn't make sense as this is essential for every single class. It won't take long. Then we can start the actual tap tempo stuff :)

dcallus commented 2 years ago

After writing it out, I realised it's definitely necessary and super easy. Done