Git Product home page Git Product logo

famix's Introduction

Famix

Famix is an abstract representation of source code. It is generic and can describe applications in multiple programming languages.

Installation

To install the project on your Pharo image, execute the following script:

Metacello new
  baseline: 'Famix';
  repository: 'github://moosetechnology/Famix:development/src';
  onConflict: [ :ex | ex allow ];
  load.

To add the project to your baseline:

spec
	baseline: 'Famix'
	with: [ spec repository: 'github://moosetechnology/Famix:development/src' ]

Note you can replace the #master by another branch such as #development or a tag such as #v1.0.0, #v1.? or #v1.2.? .

Documentation

Check out the Moose wiki.

Version management

This project use semantic versioning to define the releases. This means that each stable release of the project will be assigned a version number of the form vX.Y.Z.

  • X defines the major version number
  • Y defines the minor version number
  • Z defines the patch version number

When a release contains only bug fixes, the patch number increases. When the release contains new features that are backward compatible, the minor version increases. When the release contains breaking changes, the major version increases.

Thus, it should be safe to depend on a fixed major version and moving minor version of this project.

famix's People

Contributors

akevalion avatar alesshosry avatar anneetien avatar aranega avatar badetitou avatar cafekrem avatar clotildetoullec avatar croshiw avatar enwiro avatar fuhrmanator avatar gabriel-darbord avatar georgeganea avatar guillep avatar isayarlu avatar jecisc avatar juliendelplanque avatar labsari avatar larcheveque avatar lionelakue avatar lsafina avatar mahugnon avatar nicolasanquetil avatar nourjihene avatar patriciatot avatar pavel-krivanek avatar reda-idtaleb avatar sbragagnolo avatar seandenigris avatar sergestinckwich avatar unouss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

famix's Issues

Manage OldFamixTXXXTest

Remove OldFamixTXXXTest and add tests that do not correspond to the generated tests associated to the traits

propertyNamed: should raise an error instead of returning nil

Currently, the method propertyNamed: return nil if it is not set.

IMO this is not clean. It force is to do a lot of nil checks or to produce code such as: ^ (self propertyNamed: #BrainClass) = true since the value can be nil.

I would prefer #propertyNamed: to return a NotFound exception if there is nothing set. If we want to manage the nil case, we have #propertyNamed:ifAbsent:

The problematic part now is to manage the migration if we apply this change.

Maybe we could rename the API to property: instead of propertyNamed: and like this we could use deprecation transformation to rewrite with the right method.

propertyNamed: could be transformed into self property: x ifAbsent: [ nil ].

I would like to have some opinions about this.

FamixJavaNamedEntity define wrong parent

FamixJavaNamedEntity has a method #parentPackage declaring that its parent has a package as a container.

This is wrong. A method is a named entity and is contained in a class in Java, not in a package.

Test dealing with group must be corrected

Tests have been skipped to merge CleaningFamixTraits and development branches.
These tests deal with metrics.
"Be careful not sure about the values"
"FamixGroups must be adapted to FamixNG before correcting. "
"StType does not support allRecursiveTypes whereas JavaType does"

How to deal with "optional properties"

Currently they are stored in the private state of the entities.
Should we continue with private states ?
How can we generate models specifying optional properties ?

e.g. Tags, metrics

Does Smalltalk Attribute has Modifier

By default, it looks like they have only the modifier Protected.

We should check (for example by creating a huge Pharo model and looking for other modifier).

Then, we can take the decision to remove #THasModifier or not for FamixStAttribute

Change Name of modifier to visibility

A visibility refers only to public, private, protected and so on.
Since each entity will have only one modifier, and not a collection, the way to access it should be changed (no more modifiers include:#toto).
Obviously, methods using modifier may eventually be modified consequently.

linked with moosetechnology/Moose#2098, moosetechnology/Moose#2121, moosetechnology/Moose#2202 and moosetechnology/Moose#2219.

Should Files and Folders be generated?

It seems to me that files and folders are options of metamodels at the same level than tags.

Any file-based MM can use them or not. The file and folder generator is independent on the parsers generation the models.

Thus, I am wondering if they should be created and generated in Famix-Generator.

What I would propose it to create real classes File and Folder by hand, and use the private state to make it an option for any model.

The pros of the approach are:

  • Anyone who does not wish to use them will not pollute its generator
  • Any MM who does not define files and folder can still use them without the need of regenerating a new MM duplicating the original one

For example, currently, the java generator define files and folders. But we might not care about them? They take more memory while not been used. In the other hand, if we remove them and someone want them in the model, they would need to create a new generator and regenerate a full MM.

What do you think?

Improve traits accesses in generator

Currently, the generator has multiple methods to access traits. But sometimes the names are not really good or it lacks comments.

We discussed with Pavel and we think we should have:

  • #localTraits
  • #allTraits => Local + transitive one at 1 level
  • #allTraitsInHierarchy => Local + hierarchy + transtive ones
  • #allLocalTraitsInHierarchy => Local + local in hierarchy

review #throughAll queries

These queries only serve to get entities from queries instead of associations
#opposites can do the same

On the other hand, the new 'dependencySource' mechanism (Moose issue 2092) implies that queries do not always return associations (for now we create fake associations, but it does not need to stay like that)

So we must think about what the queries should be and should return. May be it does not need to be always associations

notExistentMetricValue

notExistentMetricValue is expected to be defined by users of trait "FamixTWithSourceAnchor".
The only other implementation is MooseEntity, which defines this with -1.

This is kind of weird since is not a nice default value and it seems to not be really used.

FMRelationSlot should use setters instead of #instVarAt:put:

FMRelationSlot is updating the opposite slot if it exists. But, to do that, it uses instVarAt:put:.

This is a problem because we might have some behavior in the setter that needs to be done.

Instead, we should use #perform:with:

To reproduce the problem it is simple. Create an entity TWithTypes and an entity TType.

Then you add the second one to the first one using #addType: and ask the mooseName. It is not reset. This should be added as test.

Experiment on defining concepts by generator

So the idea is to stop using precooked traits, precooked traits are highly static, and hard to reuse.
Meanwhile in some languages Classes have inner classes in others don't.
This also leads to problems such as unconsistent traits compositions.
I think it would be interesting to experiment on what if we define this kind of concepts as composition rules (kind of parser productions). Like this, when we talk about TClass, we are going to be talking about a TClass defined by the Generator, or even more interesting, by a delegation to a second object in charge of defining this kind of concepts. Allowing us to compose visitors + concept resolvers. Basically the idea is to say:
In this meta model, this entity is kind of a class, but kind of class such as those defined for this generator / or for this generation puntually.

FamixJava should not generate packages

FamixJava currently generates Namespaces and Packages. It should only generate one.

I propose to remove the one using TPackage since it was working like this in VerveineJ. But rename FamixJavaNamepaces into FamixJavaPackage since people know it under this name in Java.

We discussed this with Nicolas.

Managing Interface correctly in FamixNG

Perhaps, we should create a class FamixInterface and FamixImplementation
And remove isInterface from FamixJavaClass and manage consequently allModelPureClasses.

It would perhaps be necessary to add methods to navigate super classes and implemented interface with the same mechanism.

Famix Trait is tooo big

IMO FamixTrait is too big. There is a lot of concepts.
I understand that all might be used to create a metamodel for programming languages.
But I think you can split a bit this generator

TModule should be an entity, not a "property"

FamixTmodule is defined with a counterpart: FamixTDefinedInModule

But if a module contains GlobalVariables, then:

  • Module uses FamixTModule and FamixTGlobalVariableScope.
  • GlobalVariable uses FamixTDefinedInModule and FamixTGlobalVariable

which means the belongsTo is implemented twice

Even worth because Module is also a TNamespace and the GlobalVariables should also be TNamespaceEntity

related to moosetechnology/Moose#1484

Putting sourceAnchor on associations should not be generic, but per MM

Currently, ALL TAssociations have a source anchor.
However, it can make no sense for some metamodel.
We should add this information lower in the hierarchy, for example, only for the FamixJava and Smalltalk metamodel
Thus, it will reduce the size of the models

(and add tests :) )

Review all "standard traits" in FamixNG

Traits de FamixNG

A partir du moment ou on dit que c’est une relation 0..* ajouter la méthode addX (e.g. addAttribute)

Autour des access 3 traits.
Autour des references 3 traits
Autour de l’heritage 4 traits ????
Autour de l’invocation 4 traits mais besoin de renommer tout ca qui correspond a l’invocation OO et créer une invocation non OO.

Attribute: parentType et parentTypeGroup qui est un group contenant l’unique parentType.
TWithAttributes getter/setter + addAttribute + nbOfAtt, nbOfPrivateAtt, nbOfPublicAtt, nbOfProtectedAtt, nbOfRevealedAtt (nbOfPublic + nbOfAccessorMethods)

Function: functionOwner et functionOwnerGroup
Function devrait utiliser TInvocable et TWithInvocations
TWithFunctions: getter/setter PAS de addFunctions

Method: parentType et parentTypeGroup qui est un group contenant l’unique parentType.
Method devrait utiliser TInvocable et TWithInvocations
pq parentTypeIsStub?
pq category alors que ca n’existe qu’en ST?
pq computeNumberOfLinesOfCode ici et pas dans quelque chose qui a un fileAnchor ?
renommer hasClassScope en isClassSide ?
timeStamp utile ici ?
kind
pq pas isAbstract ?
TWithMethods: getter/setter + addMethod
pq methodsDo?
bp metriques

Package: childEntities getter / setter mais PAS addChildEntity
packageOwner
pq packageScope ?
TPackageable : parentOackage et parentPackageGroup
pq isExtension ici le mettre uniquement dans les méthodes en ST
pq packageScope
TWithPackages seul un package peut contenir un autre package donc est-ce qu’on a besoin de ce trait ?
Utilite de TPackageWithClassesGlue (qui ne contient que weithedMethodCount)?

TNamespace discussion migrated to moosetechnology/Moose#1990

TClass : isInterface, isTestCase weightOfAClass
pq isInterface qui devrait être uniquement dans Java
pq isTestCase
pq n’utilise pas TWithAttributes, TWithMethods, TReferenceable, TInheritance…
pq il n’y a pas isAbstract?
TWithClasses : classes uniquement getter

Type
pq clientTypes qui est calcule ?
pq fanIn ?
pq ces métriques ?
pq realType ?
typeContainer comment on va faire si on dit que Type est un NamespaceEntity du coup on aura parentNamespace et typeContainer ? Une solution avoir le meme nom et lors du merge preciser lequel on garde. Si pas meme nom, possibilité de renommer .
TWithTypes : types getter /setter + addType
code bizarre allRecursiveTypes ? + allRecursiveTypesDo
clientTypes voir si on ne peut pas gérer ca au niveau de MooseQuery.
fanOut

providerTypes cf clientTypes.

How to add new properties to an existing MetaModel ?

Can we add some (presumably simple) proerties to entities in an existing MetaModel.
By example, we have a Java MetaModel already defined but it does not have metrics.
How to change it to add metrics ?

Currently we must redefine a new MetaModel, but can we do something simpler ?

Start a C/C++ generator

We currently have multiple entities in FamixGenerator that are specific to C/C++.

I think we should move them to a C generator.

  • FamixTHeader
  • FamixTDereferenceInvocation
  • FamixTCompilationUnit
    ...

Create little metamodel

When we create a model it has its metamodel that are the union of its concepts and the concepts of its submetamodels.

However, some concepts of the submetamodels are not used (it is often the case with the FamixFileBasedGenerator).
We should be able to create a model with a shorter metamodel (that will include only the used concept coming from submetamodels)

Should we remove "precooked" entities

Precooked entities are TClass, TMethod, ...

That propose a standard combination of traits for some common entities
The problem is that we use them and often add again traits that they already have.
This causes traits conflicts.

So either we clean them and describe them and make sure everything is corret
Or we simply remove them and recreate everything by hand for all models (which we are already doing actully which causes the traits conflicts)

Optimize #hasSourceText to not read full files

Currently #hasSourceText looks if the completeText of a FileAnchor is not empty.

hasSourceText
	^ self completeText isNotEmpty

But this is super inefficient. It will read the all text before returning true or false.
In such a case, I would except to check if the file has at least one character and I stop my research at this point.

Better, I think we should check if the "sourceText" is not empty instead of the completeText.
(so it can detect some altered file (although it should not happen)).
So, I would prefer to check if there is at least one character from "startPos" of the anchor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.