Skip to content

Conversation

@teyrana
Copy link
Member

@teyrana teyrana commented Oct 13, 2016

. . . instead of RocketComponent

Discussion:
Arguably this is a non-trivial change, but this simplifies overrides, specifically when debugging mass-calculation code, and locating components. My case is:

  1. conceptually, a rocket IS A ComponentAssembly
  2. rocket still inherits all the RocketComponent methods.
  3. This change reduces code duplication:
    * 7 redundant functions
    * lines: +8 / -47
  4. Also: changed Coordinate.NUL -> Coordinate.ZERO to better reflect our intent.

[edited for format.]

…mponent

- conceptually, a rocket *IS A* ComponentAssembly.
- reduces code duplication:  7 redundant functions
- rocket still inherits all the RocketComponent methods

- Also:  changed Coordinate.NUL -> Coordinate.ZERO to better reflect our intent.
-- Nitpick: Coordinate.NUL is *not* null. It's zero.  These are different!
-- Null is an error condition.
-- Zero is a valid coordinate.  Zero means something is located at the origin.  Like the rocket, and the nosecone.
@SpamWall
Copy link
Contributor

I not familiar with the code, but be careful of thinking "Is A" means inheretance, it doesn't.   "Is A" means "is constructed as".  Proper inheritance is a "behaves as" relationship.

Craig

Sent from TypeApp

On Oct 13, 2016, 15:41, at 15:41, Daniel Williams [email protected] wrote:

. . . instead of RocketComponent

Discussion:
Arguably this is a non-trivial change, but this simplifies overrides,
specifically when debugging mass-calculation code, and locating
components. My case is:
(1) conceptually, a rocket IS A ComponentAssembly
(2) This change reduces code duplication:

  • 7 redundant functions

    • lines: +8 / -47
      (3) rocket still inherits all the RocketComponent methods.
  • Also: changed Coordinate.NUL -> Coordinate.ZERO to better reflect
    our intent.
    -- Nitpick: Coordinate.NUL is not null. It's zero. These are
    different!
    -- Null is an error condition.
    -- Zero is a valid coordinate. Zero means something is located at the
    origin. Like the rocket, and the nosecone.
    You can view, comment on, or merge this pull request online at:

    [Refactor] Rocket now subclasses ComponentAssembly  #293

-- Commit Summary --

  • [Refactor] Rocket inherits from ComponentAssembly instead of
    RocketComponent

-- File Changes --

M core/src/net/sf/openrocket/rocketcomponent/ComponentAssembly.java
(10)
M core/src/net/sf/openrocket/rocketcomponent/Rocket.java (45)

-- Patch Links --

https://github.com/openrocket/openrocket/pull/293.patch
https://github.com/openrocket/openrocket/pull/293.diff

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#293

@BigsonLvrocha
Copy link
Contributor

that actually makes sense, cleans up a lot of stub methods

@BigsonLvrocha
Copy link
Contributor

BigsonLvrocha commented Oct 13, 2016

now just gotta figure out why that value is now half :/

@teyrana
Copy link
Member Author

teyrana commented Oct 14, 2016

... but be careful of thinking "Is A" means inheretance, (sic) it doesn't.
"Is A" means "is constructed as".

I use "is a" primarily because that's the most common way of phrasing
inheritance.

Proper inheritance is a "behaves as" relationship.

What do you mean? Obviously, I can define two different classes, with the
same code, rename one, and they "behave as" the same.... without being the
compiler thinking either is inherited. (a la python "duck typing"). Is that
what we're talking about?

On Thu, Oct 13, 2016 at 5:53 PM, SpamWall [email protected] wrote:

I not familiar with the code, but be careful of thinking "Is A" means
inheretance, it doesn't. "Is A" means "is constructed as". Proper
inheritance is a "behaves as" relationship.

Craig

Sent from TypeApp

On Oct 13, 2016, 15:41, at 15:41, Daniel Williams <
[email protected]> wrote:

. . . instead of RocketComponent

Discussion:
Arguably this is a non-trivial change, but this simplifies overrides,
specifically when debugging mass-calculation code, and locating
components. My case is:
(1) conceptually, a rocket IS A ComponentAssembly
(2) This change reduces code duplication:

  • 7 redundant functions
  • lines: +8 / -47
    (3) rocket still inherits all the RocketComponent methods.
  • Also: changed Coordinate.NUL -> Coordinate.ZERO to better reflect
    our intent.
    -- Nitpick: Coordinate.NUL is not null. It's zero. These are
    different!
    -- Null is an error condition.
    -- Zero is a valid coordinate. Zero means something is located at the
    origin. Like the rocket, and the nosecone.
    You can view, comment on, or merge this pull request online at:

#293

-- Commit Summary --

  • [Refactor] Rocket inherits from ComponentAssembly instead of
    RocketComponent

-- File Changes --

M core/src/net/sf/openrocket/rocketcomponent/ComponentAssembly.java
(10)
M core/src/net/sf/openrocket/rocketcomponent/Rocket.java (45)

-- Patch Links --

https://github.com/openrocket/openrocket/pull/293.patch
https://github.com/openrocket/openrocket/pull/293.diff

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#293


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#293 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFbGKT3qH-A2EudtRTLFoJv7VD4LESntks5qzqhrgaJpZM4KWWCo
.

@teyrana
Copy link
Member Author

teyrana commented Oct 14, 2016

@Vicilu WHAT value? If you've found a bug in that code, please be more specific!

All the core/unit tests pass, excepting IntegrationTest, which we already knew about.

@SpamWall
Copy link
Contributor

For instance, a square "Is A" rectangle, but a square does not "Behave As" a rectangle. A rectangle can change length and width independently.  A square cannot.  Having a Square class inherit from a Rectangle class means some of the method are not polymorphic, some methods just don't make any sense in the scope of the derived class, and "instance of" calls start creeping in.

Sent from TypeApp

On Oct 13, 2016, 19:14, at 19:14, Daniel Williams [email protected] wrote:

... but be careful of thinking "Is A" means inheretance, (sic) it
doesn't.
"Is A" means "is constructed as".

I use "is a" primarily because that's the most common way of phrasing
inheritance.

Proper inheritance is a "behaves as" relationship.

What do you mean? Obviously, I can define two different classes, with
the
same code, rename one, and they "behave as" the same.... without being
the
compiler thinking either is inherited. (a la python "duck typing"). Is
that
what we're talking about?

On Thu, Oct 13, 2016 at 5:53 PM, SpamWall [email protected]
wrote:

I not familiar with the code, but be careful of thinking "Is A" means
inheretance, it doesn't. "Is A" means "is constructed as". Proper
inheritance is a "behaves as" relationship.

Craig

Sent from TypeApp

On Oct 13, 2016, 15:41, at 15:41, Daniel Williams <
[email protected]> wrote:

. . . instead of RocketComponent

Discussion:
Arguably this is a non-trivial change, but this simplifies
overrides,
specifically when debugging mass-calculation code, and locating
components. My case is:
(1) conceptually, a rocket IS A ComponentAssembly
(2) This change reduces code duplication:

  • 7 redundant functions
  • lines: +8 / -47
    (3) rocket still inherits all the RocketComponent methods.
  • Also: changed Coordinate.NUL -> Coordinate.ZERO to better reflect
    our intent.
    -- Nitpick: Coordinate.NUL is not null. It's zero. These are
    different!
    -- Null is an error condition.
    -- Zero is a valid coordinate. Zero means something is located at
    the
    origin. Like the rocket, and the nosecone.
    You can view, comment on, or merge this pull request online at:

#293

-- Commit Summary --

  • [Refactor] Rocket inherits from ComponentAssembly instead of
    RocketComponent

-- File Changes --

M core/src/net/sf/openrocket/rocketcomponent/ComponentAssembly.java
(10)
M core/src/net/sf/openrocket/rocketcomponent/Rocket.java (45)

-- Patch Links --

https://github.com/openrocket/openrocket/pull/293.patch
https://github.com/openrocket/openrocket/pull/293.diff

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#293


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub

#293 (comment),
or mute the thread

https://github.com/notifications/unsubscribe-auth/AFbGKT3qH-A2EudtRTLFoJv7VD4LESntks5qzqhrgaJpZM4KWWCo
.

You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#293 (comment)

@teyrana
Copy link
Member Author

teyrana commented Oct 14, 2016 via email

@BigsonLvrocha
Copy link
Contributor

oh yes, that integration test was what I was talking about

@BigsonLvrocha
Copy link
Contributor

and I think the best choice is to apply this change, it makes more sense and has less "dead code"

@BigsonLvrocha
Copy link
Contributor

BigsonLvrocha commented Oct 17, 2016

As this package is the source of almost all problems with unstable, I've been documenting it and found a lot of mess, parent depending of child and other things, need a lot of refactoring, who knows? my guess is this is the first step to solve the problems

@kruland2607 kruland2607 merged commit 2403dcd into openrocket:unstable Feb 2, 2017
@teyrana teyrana deleted the rocket-assembly branch March 7, 2017 20:16
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.

4 participants