Ex08 - Question to "All classes and traits"

L4_
BASIC-Programmierer
BASIC-Programmierer
Beiträge: 104
Registriert: 24. Apr 2012 15:44

Ex08 - Question to "All classes and traits"

Beitrag von L4_ »

Hello,

task 1 states the following:
"Look at all of the following classes and traits and their corresponding companion objects:"

Let's say I have a file "Foo.scala"
Does this mean we need to traverse the following?

1) The class/trait/object "Foo" in "Foo.scala" (which is obvious)
2) All other classes/traits that appear in the file "Foo.scala"
3) All inner classes/traits that appear in the classes/traits/objects in the file "Foo.scala"

Example for 2):
Can't find a example right now but it is similar to 3) anyway

Example for 3):
In "BufferedIterator.scala" there is an object "BufferedIterator" with inner traits, e.g. "Advanced[+A]"

Kind regards
Zuletzt geändert von L4_ am 29. Jan 2014 00:12, insgesamt 1-mal geändert.

imaier
Mausschubser
Mausschubser
Beiträge: 61
Registriert: 21. Okt 2013 21:27

Re: Ex08 - Question to "All classes and traits"

Beitrag von imaier »

We are not talking about class *files* but classes. Please notice the difference. So your point 2 does not apply. Look at inner classes and classes in objects only if they are part of the Iterable hierarchy or otherwise play part in a pattern that involves a (immediate or transitive) subclass of Iterable or a method in a companion object of those classes.

When I say classes above, I mean both classes and traits.

The purpose of the description in task one is to reduce the number of classes you have to look at. We are interested in the Iterable hierarchy without potential subclasses that might exist in packages other than the ones we mention. We are not immediately interested in Iterators unless they take part in a pattern that involves an Iterable. We gave you a larger code base for two reasons: we wanted to give you a real world example and not just some toy project, but it is almost impossible to reduce the standard library to a reasonably sized collection hierarchy. It has too many dependencies. More importantly, though: it is a valuable skill to be able to navigate and identify patterns in larger code bases.

Hope this helps,
Ingo

L4_
BASIC-Programmierer
BASIC-Programmierer
Beiträge: 104
Registriert: 24. Apr 2012 15:44

Re: Ex08 - Question to "All classes and traits"

Beitrag von L4_ »

Thank you so far, that helps.

My description was wrong, I will update it.
I ment scala-Files, not class-files, e.g. "Foo.scala"

Antworten

Zurück zu „Archiv“