Skip to content

Commit 76da32c

Browse files
committed
Minor updates, see #88
1 parent 756d047 commit 76da32c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

doc/phet-software-design-patterns.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,20 @@ of standard design patterns.
2424

2525
Author: @samreid 🚧
2626

27-
- Noted as a new topic during patterns discussion on 2/11/19.
28-
- Would be good to note PhET decisions and patterns for this here.
2927
- Relevant info/links:
3028
- https://en.wikipedia.org/wiki/Composition_over_inheritance
31-
- "Composition over inheritance (or composite reuse principle) in object-oriented programming (OOP) is the principle that classes should achieve polymorphic behavior and code reuse by their composition (by containing instances of other classes that implement the desired functionality) rather than inheritance from a base or parent class."
29+
- "Composition over inheritance (or composite reuse principle) in object-oriented programming (OOP) is the
30+
principle that classes should achieve polymorphic behavior and code reuse by their composition (by containing
31+
instances of other classes that implement the desired functionality) rather than inheritance from a base or parent
32+
class."
3233
- Chrome's optimization makes it so that sims would be faster if we used composition over inheritance.
3334
- Composition is generally more flexible.
3435
- If what you are trying to model can easily be described by composition, you should use composition.
3536
- If composition produces numerous forwarding calls, it indicates that perhaps inheritance should be used instead.
3637
- The forwarding calls produced by composition can be beneficial though, they are explicit and protect things things
3738
that need to stay private.
38-
- It was mentioned that numerous forwarding calls can increase the memory impact, especially on types that are instantiated many many times by a simulation (like Vector2).
39+
- Numerous forwarding calls can increase the memory impact, especially on types that are instantiated many many times
40+
by a simulation (like Vector2).
3941

4042
## Creator (with Drag Forwarding)
4143
(formerly known as the Model Element Creator Pattern)

0 commit comments

Comments
 (0)