-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracy marlatt branch #2
base: master
Are you sure you want to change the base?
Tracy marlatt branch #2
Conversation
Now extends abstract class Shape, and computes its own area and perimeter
Added a new triangle object to the array of shapes and compute aggregate perimeter
Shapes of class Shape (generalized) and calls the getArea() method for each shape
Extends Shape and computes its own area and perimeter
.Added Shape superclass and getArea methods to subclasses Rectangle, Circle and Triangle |
@@ -0,0 +1,9 @@ | |||
package planForExtensionExercise; | |||
|
|||
public abstract class Shape { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this abstract class only has methods, it could be an interface instead of an abstract class. Tracy, can you comment on why you made it an abstract class instead of an interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used an abstract class largely because the relationship between Shape and
its subclasses is a very strong, hierarchical one so it seemed to make
sense from an interpretability standpoint. Also it is my understanding that
abstract classes are faster than interfaces and may be preferable in cases
where there is no obvious advantage to using an interface.
On Thu, Feb 5, 2015 at 11:11 AM, Spencer Robinson [email protected]
wrote:
In plan-for-extension-exercise/src/planForExtensionExercise/Shape.java
#2 (comment):@@ -0,0 +1,9 @@
+package planForExtensionExercise;
+
+public abstract class Shape {Because this abstract class only has methods, it could be an interface
instead of an abstract class. Tracy, can you comment on why you made it an
abstract class instead of an interface?—
Reply to this email directly or view it on GitHub
https://github.com/siostechcorp/exercises/pull/2/files#r24173904.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Purely for the fun of it, will you please humor me by changing Shape to an interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
On Thu, Feb 5, 2015 at 11:33 AM, Spencer Robinson [email protected]
wrote:
In plan-for-extension-exercise/src/planForExtensionExercise/Shape.java
#2 (comment):@@ -0,0 +1,9 @@
+package planForExtensionExercise;
+
+public abstract class Shape {Purely for the fun of it, will you please humor me by changing Shape to an
interface?—
Reply to this email directly or view it on GitHub
https://github.com/siostechcorp/exercises/pull/2/files#r24175858.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just created a pull request
On Thu, Feb 5, 2015 at 11:34 AM, Tracy Marlatt [email protected]
wrote:
Sure!
On Thu, Feb 5, 2015 at 11:33 AM, Spencer Robinson <
[email protected]> wrote:In plan-for-extension-exercise/src/planForExtensionExercise/Shape.java
#2 (comment):@@ -0,0 +1,9 @@
+package planForExtensionExercise;
+
+public abstract class Shape {Purely for the fun of it, will you please humor me by changing Shape to
an interface?—
Reply to this email directly or view it on GitHub
https://github.com/siostechcorp/exercises/pull/2/files#r24175858.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I wasn't very clear. Please update this pull request to include the change, and close the other pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Spencer,
I updated my code in that branch and closed the newest pull request, but
how do I "update" my first pull request?
Thanks, Tracy
On Thu, Feb 5, 2015 at 11:48 AM, Spencer Robinson [email protected]
wrote:
In plan-for-extension-exercise/src/planForExtensionExercise/Shape.java
#2 (comment):@@ -0,0 +1,9 @@
+package planForExtensionExercise;
+
+public abstract class Shape {Sorry, I wasn't very clear. Please update this pull request to include the
change, and close the other pull request.—
Reply to this email directly or view it on GitHub
https://github.com/siostechcorp/exercises/pull/2/files#r24177110.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just make a commit in the branch and the pull request will automatically be
updated.
On Feb 5, 2015 12:07 PM, "TracyMarlatt" [email protected] wrote:
In plan-for-extension-exercise/src/planForExtensionExercise/Shape.java
#2 (comment):@@ -0,0 +1,9 @@
+package planForExtensionExercise;
+
+public abstract class Shape {Hi Spencer, I updated my code in that branch and closed the newest pull
request, but how do I "update" my first pull request? Thanks, Tracy
… <#14b5ab621cca8ea0_>
On Thu, Feb 5, 2015 at 11:48 AM, Spencer Robinson <
[email protected]> wrote: In
plan-for-extension-exercise/src/planForExtensionExercise/Shape.java <
https://github.com/siostechcorp/exercises/pull/2#discussion_r24177110>: >
@@ -0,0 +1,9 @@ > +package planForExtensionExercise; > + > +public abstract
class Shape { Sorry, I wasn't very clear. Please update this pull request
to include the change, and close the other pull request. — Reply to this
email directly or view it on GitHub <
https://github.com/siostechcorp/exercises/pull/2/files#r24177110>.—
Reply to this email directly or view it on GitHub
https://github.com/siostechcorp/exercises/pull/2/files#r24178946.
Tracy, once you complete with the set of question with Spencer I would like to slightly extend this problem (perhaps that's what we will do for others as well). How would you approach that if you could not modify AreaCalculator? Use case is very much the same, but let's say AreaCalculator is a black box and handles the functionality that you know (calculating only certain shapes). You can not change the anything about AreaCaclulator but you want to extend its functionality (in anyway). You want to make sure that you are leveraging what the AreaCalculator has to offer (let's say it is very complex process and you don't not nor care about the internals) but also able to extend it for other functions that you may write in the future or objects. Let me know if you will have any questions? |
BTW perhaps we can keep that in a conversion vs the code changes. Perhaps you can describe how you would approach solving this issue. |
Class implements Shape interface
Class implements Shape interface
Class implements Shape interface
Changed Shape to an interface
Then perhaps it is already done! The pull request shows four new commits. I Please let me know if my changes are not reflected on your end... On Thu, Feb 5, 2015 at 11:51 AM, Sergey A. Razin [email protected]
|
In your example, please let me clarify: I know that AreaCalculator computes On Thu, Feb 5, 2015 at 11:47 AM, Sergey A. Razin [email protected]
|
Assuming that I understand your question, I believe I would approach the
Does this approach properly address the situation you described, i.e., have Thanks, On Thu, Feb 5, 2015 at 11:51 AM, Sergey A. Razin [email protected]
|
Tracy, description certainly make sense however details are important. "I create two arrays" - hint I do not believe you need an array, Keep in Thank you! Regards, On Thu, Feb 5, 2015 at 12:52 PM, TracyMarlatt [email protected]
|
To clarify Sergey's request: Create a new branch of the repository and make the "new" version there, implementing the design you mentioned. Then make a pull request for that branch. (In this branch, assume that you cannot make any changes to the AreaCalculator.java file). |
Will do, thank you! On Thu, Feb 5, 2015 at 2:16 PM, Spencer Robinson [email protected]
|
Hi Spencer, I have added the new pull request, with an implementation of my proposed Tracy On Thu, Feb 5, 2015 at 2:16 PM, Spencer Robinson [email protected]
|
Hi Dr. Razin, I have just submitted an implementation of my proposed solution. Thanks! Best, On Thu, Feb 5, 2015 at 2:11 PM, Sergey A. Razin [email protected]
|
No description provided.