The Student Room Group

Scroll to see replies

Original post by mahmzo
isnt it vice versa as well, when all rabbit objects are destroyed the warren is also destroyed?


Yes. I didn't know that happened, just tested now. If rabbit size decreases to zero, warren is removed from the board.
Reply 81
wait yeah that is right, the warren disappearing when rabbits disappear does make it not have a one directional relationship, so in theory it should be neither, but the warren & fox relationship is composition aggregation according to zigzag

in which case, what would be an example of aggregation or composition?
location & warren?
(edited 6 years ago)
Reply 82
Original post by peterxz
wait yeah that is right, the warren disappearing when rabbits disappear does make it not have a one directional relationship, so in theory it should be neither, but the warren & fox relationship is composition aggregation according to zigzag

in which case, what would be an example of aggregation or composition?
location & warren?


Alot of the ZigZag stuff is wrong.

Location and warren does have a association aggregation relationship i believe, thats because even if a warren is destroyed the location object is still available (But its set to a NoneType Object). Same with Fox and Location.
(edited 6 years ago)
Reply 83
thats what I thought, so association aggregation between location and warren, and composition between warren and rabbits, right?
Original post by mahmzo
isnt it vice versa as well, when all rabbit objects are destroyed the warren is also destroyed?
Yes, but this is only because of the WarrenHasDiedOut() function in the Warren class. It is not an inherent property of using Rabbits within the Warren class, just something the AQA programmer has implemented, so I don't believe it affects the object relationships.

One warren has many rabbits, so it is aggregation. If the warren class is destroyed, the rabbits within the class would be destroyed automatically (without the programmer having to write a method to achieve this; the only place the rabbits are stored in is in the Warren instance variable Rabbits), so it is composition aggregation. At least, that's my understanding.
Reply 85
Original post by ShatnersBassoon
Yes, but this is only because of the WarrenHasDiedOut() function in the Warren class. It is not an inherent property of using Rabbits within the Warren class, just something the AQA programmer has implemented, so I don't believe it affects the object relationships.

One warren has many rabbits, so it is aggregation. If the warren class is destroyed, the rabbits within the class would be destroyed automatically (without the programmer having to write a method to achieve this; the only place the rabbits are stored in is in the Warren instance variable Rabbits), so it is composition aggregation. At least, that's my understanding.


We will definitely be asked something to do with this haha

Posted from TSR Mobile
Would someone mind explaining what polymorphism is? In terms of rabbits and foxes would be great.
Original post by ShatnersBassoon
Yes, but this is only because of the WarrenHasDiedOut() function in the Warren class. It is not an inherent property of using Rabbits within the Warren class, just something the AQA programmer has implemented, so I don't believe it affects the object relationships.

One warren has many rabbits, so it is aggregation. If the warren class is destroyed, the rabbits within the class would be destroyed automatically (without the programmer having to write a method to achieve this; the only place the rabbits are stored in is in the Warren instance variable Rabbits), so it is composition aggregation. At least, that's my understanding.


If we were asked for an example of a class that uses composition would we just say rabbits then? Or to state a composition would we have to state two classes e.g. rabbits with warren? I'm guessing if they wanted to be sneaky they could give us a class diagram with just a hollow diamond arrow from rabbits to warren and if it asks what's wrong we have to say the diamond should be filled in.

Saying that has anyone already made a class diagram for the code? Would be useful


Also does anyone have a copy of the blank electronic answer document?
Reply 88
Original post by cookiemunch12
Would someone mind explaining what polymorphism is? In terms of rabbits and foxes would be great.


polymorphism is when the code does something different based on the environment, so in this example if you start the default game and the custom game, that is polymorphism because in both cases the simulation plays out differently.

Original post by domaths
If we were asked for an example of a class that uses composition would we just say rabbits then? Or to state a composition would we have to state two classes e.g. rabbits with warren? I'm guessing if they wanted to be sneaky they could give us a class diagram with just a hollow diamond arrow from rabbits to warren and if it asks what's wrong we have to say the diamond should be filled in.

Saying that has anyone already made a class diagram for the code? Would be useful


Also does anyone have a copy of the blank electronic answer document?



**** yeah looking at UML might be useful to look at..
Could someone explain the purpose of enumerating the genders and are rabbits inheriting from Genders?
Original post by ComputeiT
Could someone explain the purpose of enumerating the genders and are rabbits inheriting from Genders?

An enumerated type is a user-defined data type that derives from existing data types (these tend to be elementary data types such as bools, integers and pointers)

The main purpose of such types is to improve the self-documenting aspect of the code. It's pretty clear that a Genders.Male refers to a male gender, very useful in ensuring the programmer does not make any human errors.
Original post by cookiemunch12
Would someone mind explaining what polymorphism is? In terms of rabbits and foxes would be great.

Polymorphism can just be described as a programming languages ability to process objects differently depending on their class. In other words, how able is the programming language to override methods for derived classes.

A nice example of polymorphism in the preliminary code is when the Fox and the Rabbit class "override" the inspect method which is inherited from the Animal class.
Original post by peterxz
thats what I thought, so association aggregation between location and warren, and composition between warren and rabbits, right?


One simulation has many parts of locations.
A location has one or zero parts of a warren in composition with it.
A location has one or zero parts of a fox in composition with it.
A warren has many parts of a rabbit in composition with it.
A fox is a animal.
A rabbit is a animal.
Rabbits have a gender.
Original post by luciferhf
One simulation has many parts of locations.
A location has one or zero parts of a warren in composition with it.
A location has one or zero parts of a fox in composition with it.
A warren has many parts of a rabbit in composition with it.
A fox is a animal.
A rabbit is a animal.
Rabbits have a gender.


So there is only composition aggregation and no association aggregation?
Original post by ComputeiT
So there is only composition aggregation and no association aggregation?


I think their may be some association between the Rabbits and the Enum class.

Never mind I am retard, unsure what the relationship is between a rabbit and Genders tbh

EDIT2

I AM CORRECT NEVER MIND.
(edited 6 years ago)
Reply 95
Original post by vanguardsean
Hi everyone, started this thread for anyone currently doing the new AQA A-Level. If anyone wants to contribute, I have created a google doc so please add to this:
https://docs.google.com/document/d/1BA-F1D4NtOBmd0Gaok1g1xbYvBthjtHyIEpHq0Y0_oA/edit?usp=sharing

This file is for the Foxes and Rabbits preliminary material - for the exam in June 2017.


The Google doc has been locked down (permissions-wise), does anyone have a backup or access?
Original post by dylmye0
The Google doc has been locked down (permissions-wise), does anyone have a backup or access?

Its back now, the link still works
Hey guys

I'm really confused about some things in the code, and I know that a lot of other people are as well.
So could someone please give me an example of the following so I finally understand what is what:

- Composition
- Association
- Polymorphism
- Overriding (could someone explain this too please)

I've looked around and can't find much information. I'm quite weak on this code so any help would be appreciated!
has anyone commented their code?
Original post by yungabzzz
Hey guys

I'm really confused about some things in the code, and I know that a lot of other people are as well.
So could someone please give me an example of the following so I finally understand what is what:

- Composition
- Association
- Polymorphism
- Overriding (could someone explain this too please)

I've looked around and can't find much information. I'm quite weak on this code so any help would be appreciated!


Scroll up, I just posted all of this.

Latest

Trending

Trending