Hi I was recently asked this in an interview to represent a 6 string guitar and a 4 string bass in class structure
. I am still new to software design and analysis so was not able to complete the answer. Moreover my lack of knowledge about the musical instrument played a big role in my failure. But I tried the same at home and below is what I could create after some online references.
I have never seen a electric guitar except on google while I was working on this problem. So I tried to create the uml diagram as per the information I could find online. In-fact I didn't even knew what a bass was before I worked on this problem.
I created the main Instrument
class which would basically refer to guitar or bass or any similar instrument. For InstrumentSpec
, I created another class that has guitar or bass common specs. Now since guitar specs would also include Pickups
, Strings
, Toggle Switch
and Control Knobs
, I moved them into separate classes.
The interviewer also asked me to design the class diagram in a way so that he could identify if note from one is equal to note from other based on fret positions and string played
. So I added Frets
class to include the information about position
, distance
, location
and pressure applied
and added a field stringName
in instrument class to determine what string is being played in the instrument.
I am still new to software class diagrams and thus seeking help in understanding improvements in my class structure.
All comments are appreciated.