Skip to content

Commit

Permalink
Adding description of TInheritance "in context"
Browse files Browse the repository at this point in the history
  • Loading branch information
anquetil committed May 22, 2024
1 parent e6d1991 commit 1ba810c
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 7 deletions.
29 changes: 29 additions & 0 deletions moose-wiki/Developers/Diagrams/inheritanceInContext.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@startuml
hide empty members
skinparam class {
BackgroundColor white
ArrowColor black
BorderColor darkGray
}
class FamixJavaInheritance <<(C,white)>> #FFFFCC {
}
class TClass <<(T,white)>> #FFFFCC {
Boolean isTestCase
Number weightOfAClass
}
class TWithInheritances <<(T,white)>> #CCFFFF {
Number subclassHierarchyDepth
Number hierarchyNestingLevel
Number numberOfSubclasses
Number numberOfDirectSubclasses
}
class FamixJavaClass <<(C,white)>> #FFFFCC {
}
class TInheritance <<(T,white)>> #CCFFFF {
}
TInheritance <|.. FamixJavaInheritance
TWithInheritances <|.. TClass
TClass <|.. FamixJavaClass
TWithInheritances "subclass" -- "superInheritances*" TInheritance
TWithInheritances "superclass" -- "subInheritances*" TInheritance
@enduml
33 changes: 26 additions & 7 deletions moose-wiki/Developers/predefinedEntities.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ The following should nevertheless help users make sense of the more than one hun
## Categories of traits

First, one can divide the set of traits into four categories:
- [Categories of traits](#categories-of-traits)
- [Association Traits](#association-traits)
- [Technical Traits](#technical-traits)
- [Property Traits](#property-traits)
Expand All @@ -49,18 +48,24 @@ Using an association involves:

There are five full-fledged associations in FamixNG:

- `FamixTAccess`, from: `FamixTWithAccess`, to: `FamixTAccessible` <details>![PlantUML Image](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/moosetechnology/moose-wiki/master/Developers/Diagrams/access.puml&fmt=svg)</details>
- `FamixTInheritance`, from: `FamixTWithInheritance`, to: `FamixTWithInheritance`<details>![PlantUML Image](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/moosetechnology/moose-wiki/master/Developers/Diagrams/inheritance.puml&fmt=svg)</details>
- `FamixTInvocation`, from: `FamixTWithInvocation`, to: `FamixTInvocable`, for OO programs, there is an extra receiver: `FamixTInvocationReceiver`<details>![PlantUML Image](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/moosetechnology/moose-wiki/master/Developers/Diagrams/invocation.puml&fmt=svg)</details>
- `FamixTReference`, from: `FamixTWithReferences`, to: `FamixTReferenceable`<details>![PlantUML Image](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/moosetechnology/moose-wiki/master/Developers/Diagrams/reference.puml&fmt=svg)</details>
- `FamixTTraitUsage`, from: `FamixTWithTrait`, to: `FamixTTrait`<details>![PlantUML Image](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/moosetechnology/moose-wiki/master/Developers/Diagrams/usetrait.puml&fmt=svg)</details>
- `FamixTAccess`, from: `FamixTWithAccess`, to: `FamixTAccessible`
<details>![PlantUML Image](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/moosetechnology/moose-wiki/master/Developers/Diagrams/access.puml&fmt=svg)</details>
- `FamixTInheritance`, from: `FamixTWithInheritance`, to: `FamixTWithInheritance`
<details>![PlantUML Image](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/moosetechnology/moose-wiki/master/Developers/Diagrams/inheritance.puml&fmt=svg)</details>
- `FamixTInvocation`, from: `FamixTWithInvocation`, to: `FamixTInvocable`, for OO programs, there is an extra receiver: `FamixTInvocationReceiver`
<details>![PlantUML Image](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/moosetechnology/moose-wiki/master/Developers/Diagrams/invocation.puml&fmt=svg)</details>
- `FamixTReference`, from: `FamixTWithReferences`, to: `FamixTReferenceable`
<details>![PlantUML Image](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/moosetechnology/moose-wiki/master/Developers/Diagrams/reference.puml&fmt=svg)</details>
- `FamixTTraitUsage`, from: `FamixTWithTrait`, to: `FamixTTrait`
<details>![PlantUML Image](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/moosetechnology/moose-wiki/master/Developers/Diagrams/usetrait.puml&fmt=svg)</details>

To these five we added two more specialized "associations":
`DereferencedInvocation` (call of a pointer to a function in C) and `FileInclude` (also in C).
These do not reify the association as a separate entity, but they might do so in the future.
For now there are only two traits to put at each end of the relationship:

- `FamixTDereferencedInvocation` and `FamixTWithDereferencedInvocations`<details>![PlantUML Image](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/moosetechnology/moose-wiki/master/Developers/Diagrams/derefInvok.puml&fmt=svg)</details>
- `FamixTDereferencedInvocation` and `FamixTWithDereferencedInvocations`
<details>![PlantUML Image](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/moosetechnology/moose-wiki/master/Developers/Diagrams/derefInvok.puml&fmt=svg)</details>
- `FamixTFileInclude` and `FamixTWithFileInclude`<details>![PlantUML Image](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/moosetechnology/moose-wiki/master/Developers/Diagrams/fileInclude.puml&fmt=svg)</details>

## Technical Traits
Expand Down Expand Up @@ -88,3 +93,17 @@ For example, `FamixTClass` is composed of: `FamixTInvocationsReceiver` (class ca
The name *terminal trait* refers to the fact that they can be used directly to create a programming language concept (a class, a package), whereas *property traits* are typically composed with other traits to make a meaningful programming language concept.

There are 38 such *terminal traits* currently in FamixNG.

## Putting it all together

We now present UML diagram that show how Association and Property traits are used to create the Terminal traits.
These UML diagrams give an idea how to combine all traits to create a meta-model for a given programming language.

For the first example we show how we model inheritance in the FamixJava meta-model:
- `TClass` uses `TWithInheritances`, ie. a generic class may have inheritance relationships
- `FamixJavaClass` uses `TClass`, ie. a Java class has all properties of the generic class defined in Famix. Note that a Java class also has other properties not shown here.
- `FamixJavaInheritance` uses the trait `TInheritance` to represent an inheritance relationship.

<details>![PlantUML Image](https://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/moosetechnology/moose-wiki/master/Developers/Diagrams/inheritanceInContext.puml&fmt=svg)</details>

That way, a `FamixJavaClass` has `superInheritances` and `subInheritances` propperties containing `FamixJavaInheritance` objects.

0 comments on commit 1ba810c

Please sign in to comment.