-
Notifications
You must be signed in to change notification settings - Fork 0
Integrating the class FreeLancer #2
Description
The idea as I suggested it (but keep asking if it's still not clear) is to create a class that represents a translator (FreeLancer) and have the values of translator and reviewer be instances of that class. Whether the employee is "Internal" could be an attribute of FreeLancer.
I will not write the class for you, but only describe the behaviour as I'm envisioning it. Note that in this case the translator and reviewer attributes of your Project class (ex Translation_agency?) would not be class attributes but instance attributes (because they are specific of each project), and instead of strings they would be instances of FreeLancer. So you would have something like this:
tr = FreeLancer("Sibylle de Woot", "sibylle.de.woot@email.me", is_internal = False) # and any other relevant arguments
rev = FreeLancer("Mariana Montes", "mariana.montes@company.be", is_internal = True) # and any other relevant arguments
project = Project(...) # whatever arguments you want to initialize with
project.set_translator(tr)
project.set_reviewer(rev)As we discussed in class, maybe the translator, reviewer, or other arguments are set at initialization (as arguments when you instantiate the class), or with methods. I illustrated here with methods but you could have translator = tr, reviewer = rev inside your Project() call.
Then when you call project.reviewer you get an instance of the FreeLancer class, which maybe has its own print statement. project.reviewer.name will print the name, project.reviewer.is_internal whether they are internal (so, "Mariana Montes" and True respectively, in this example)...
And when designing what you print in the __str__() call of the Project class, you can access the information from within with self.reviewer.name, self.reviewer.is_internal, etc...
Is that a bit more clear?