Naming Roslyn concepts

Naming Roslyn concepts

Rate This
  • Comments 28

We have a rather central component in Roslyn and we’re looking how to name it best. I’d like to gather some advice and opinions that could potentially help us find a good name.

I am intentionally not mentioning what is it called right now. Instead, I’m going to describe it. If you recognize this component from the Roslyn CTPs, please don’t name it in the comments so as not to accidentally drive others towards its current name, which we believe is overused in our domain already.

Roslyn analyzes code. Code is most often organized into solutions, projects and documents. Primarily we use three types to model source code: Solution, Project and Document. A Solution has a set of Projects, a Project has a set of Documents. These form an immutable tree that captures a snapshot of a source code tree at a moment in time. This data structure only captures the information interesting to the compiler, it’s not an MSBuild or a project system concept. When the user edits the text of a document in the editor, adds a new project in Visual Studio or otherwise modifies code, a new immutable snapshot of the entire Solution is created. This is implemented using efficient immutable data structures that reuse most of the data between the snapshots. This way if an analysis was in progress while the user changed code, the analysis can continue on it’s own snapshot safely knowing that the snapshot will never change. Also we can utilize multiple cores for fast, safe, lock-free analysis.

Now, the concept we’re looking to name is something that has a CurrentSolution property that points to the latest snapshot of the solution data structure. It can listen to changes in user’s source code, build a new Solution snapshot to reflect those changes, and finally update the CurrentSolution property to point to the latest snapshot. This concept also has an event that our features can listen to to update themselves when the current solution has changed.

An environment that is hosting Roslyn (say the Visual Studio project system) is responsible for forwarding changes into this component such that it can recalculate the most up-to-date Solution and notify all observers.

If a Roslyn feature, such as a refactoring, wants to modify the users code (e.g. generate a method), it doesn’t talk directly to the environment. Instead, it describes the changes it wants to apply to the current solution and forms a new, delta (diff) Solution, and hands it off to our component. Our component then takes this delta (changes) and sends it back to the host, asking the host to do whatever is necessary to actually apply these changes (edit a file, checkout a file from TFS, add a reference, etc.) The host then, after applying these changes will pipe the notifications back into our component to complete the circle.

How do we name this component that is responsible for keeping the CurrentSolution up-to-date and ensures bidirectional communication of changes with the host environment?

Thanks!

  • How about SolutionContext ?

  • SourceService? (or something mythical such as Druid or Ent, you're explaining something that can communicate with trees here ;)).

  • +1 for SolutionContext, or perhaps SolutionTracker.

  • SolutionProxy? SourceSnapshotService? SourceSnapshot? SolutionSnapshot? SolutionModel? SolutionSourceModel?

  • 1. SolutionHost

    2. SolutionHostMediator

    3. SolutionHostContext

    4. SolutionManager

    5. SolutionContextService

  • Sounds a bit like the FileSystemWatcher to me, so SolutionWatcher maybe, although I also like the SolutionTracker.

  • What about the use-case code samples? It's hard to guess the proper variant without them.

    If you're searching for common-use api name, I'd prefer to use most obvious one, e.g. SolutionState.Current (or, if you wish to name the thing as controller, not as a state object, SolutionCoordinator).

    As alternative (if the name is just for internal use), SolutionBackstage / SolutionBaker will suit well.

  • SSS

    SolutionSnapshotSynchronizer

  • How about CompilR in line with SignalR :-).

  • SolutionController

  • I think it would be beneficial if you defined/listed the "interface" members of this class e.g.

    class [NEWNAME]

    {

      public Solution CurrentSolution { get; }

      // Etc.

    }

  • Given that this class will be a eventual consistency (i.e. it will lag behind the current actual state of the solution) snapshot of the solution, "tracker" makes a lot of sense. It is basically tracking or logging code change events to give a snapshot of the current state. In CQRS this could also be called an event projector to make a read model (solution snapshot).

  • SolutionSecretary

  • SolutionChangeTracker

    Although if you're scrambling for the right word, it might be a sign that this thing has too many responsibilities.

  • SolutionSnapshotObserver

Page 1 of 2 (28 items) 12
Leave a Comment
  • Please add 5 and 1 and type the answer here:
  • Post