Skip to content

Branches - Farah#44

Open
in-formation wants to merge 3 commits into
Ada-C12:masterfrom
in-formation:master
Open

Branches - Farah#44
in-formation wants to merge 3 commits into
Ada-C12:masterfrom
in-formation:master

Conversation

@in-formation

Copy link
Copy Markdown

Solar System

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
When does the initialize method run? What does it do? Initialize method runs when a new instance of the class is created (.new). It creates the instance variables for that new class instance.
Why do you imagine we made our instance variables readable but not writable? This one is a bit difficult to still grasp but I imagine that it is because we don't want to be able to reassign our "planet" parameters when running the program but we do want to be able to read that, iterate through them, manipulate them during other methods.
How would your program be different if each planet was stored as a Hash instead of an instance of a class? A hash isn't a bad idea to contain all the information but there would be many keys and being able to access all the information would require iterating through the hash in order to access the information as opposed to just typing out the instance variable when you need it...(I think...)
How would your program be different if your SolarSystem class used a Hash instead of an Array to store the list of planets? I'm having a hard time picturing how a hash would be better than an array to store the list of planets...It would require having a key to value relationship which wasn't necessary for the program to work...
There is a software design principle called the SRP. The Single Responsibility Principle (SRP) says that each class should be responsible for exactly one thing. Do your classes follow SRP? What responsibilities do they have? This gets a bit confusing because each class usually contains many attributes. So while it is more efficient, it can get easily lost when you require more and more parameters. My Planet class doesn't feel like it follows the SRP because it requires many arguments in order to run but the Solar System class is more straight forward since it just takes in a planet. On the flip side, Planet would be useless if it didn't contain any of those attributes.
How did you organize your require statements? Which files needed requires, and which did not? What is the pattern? Main.rb file 'required' both solar_system.rb and planet.rb since both classes and their instances were used in the main.rb file. Planet.rb file did not 'require' any other files since it didn't not pull in any information from main.rb or solar_system.rb. And the solar_system.rb file only 'required' the planet.rb file since it used that information and its instance variables in order to run. Every method in the solar_system.rb file required planet.rb information.

@jmaddox19

Copy link
Copy Markdown

Solar System

What We're Looking For

Feature Feedback
Baseline
Whitespace (indentation, vertical space, etc) X
Variable names X
Git hygiene You'll probably want to start committing in smaller commits. (ie. When you finish making the planet class, when you make the planet_details method, etc.) It's a hard habit to get into but as the projects get bigger, things will get harder to keep track of and you'll break something and you'll want a recent working version to go back to.
Planet
initialize method stores parameters as instance variables with appropriate reader methods X
summary method returns a string X
SolarSystem
initialize creates an empty list of planets X
add_planet takes an instance of Planet and adds it to the list X
list_planets returns a string X
find_planet_by_name returns the correct instance of Planet X
CLI
Can list planets and quit X
Can show planet details Not for most planets
Can add a planet X
Complex functionality is broken out into separate methods
Overall Good job overall. Definitely would suggest you test more thoroughly in the future. I wouldn't have expected you to catch that bug just by reading the code. (I wasn't even able to.) But with much testing of the details method, it's clear it isn't quite working right. Moving forward, we'll be writing unit tests and that'll help a lot too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants