lundi 1 avril 2019

Conceptual oop design question from a beginner

Here comes a conceptual question.

I am a beginner in object oriented programming (not new to working with classes, objects or object oriented princibles.) I am having a hard time to conceptually design a program that I am trying to write elegantly. I am searching for advice from experienced ones.

My program simply takes a WAV file, parses it, then do some operations on the data chunk of the file according to the arguments given by the user and spits out a new WAV file with the modified data chunk.

In this case, I can think of classes for the separate parts.

I need a class for the parser, which reads the file, parses the meta-data to data structures chosen to use later, reads the data chunk to a vector and be able to write the new file contains the modified data.

I need a class for the operator which modifies the data chunk in the ways which user has chosen.

I need a class or a namespace which contains the algorithms that will run on the data chunk by the operator. I want these algorithms to be writable by other contributors to the code also so I think there should be an ease here and they shouldn't have to deal with other parts of the code when committing them to, for example GitHub.

Maybe in time some other parts can be written to the program.

Parts of the program should be able to exchange relevant data about themselves.

In the code I have written until now, operators and parser is in the same class. Algorithm functions are in a namespace and they get the data from the class as arguments and return new stuff after processing. I have a cpp and hpp file for the namespace and the main class.

Which design approach would be the right way to design such architecture? Between classes, should there be inheritance or friendship? What is the relevant way to pass data around? I need a little light I am confused, there seems so many ways to do this.

Aucun commentaire:

Enregistrer un commentaire