共用方式為


Naming Roslyn concepts

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!

Comments

  • Anonymous
    January 21, 2013
    How about SolutionContext ?

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

  • Anonymous
    January 21, 2013
    +1 for SolutionContext, or perhaps SolutionTracker.

  • Anonymous
    January 21, 2013
    SolutionProxy? SourceSnapshotService? SourceSnapshot? SolutionSnapshot? SolutionModel? SolutionSourceModel?

  • Anonymous
    January 21, 2013

  1. SolutionHost
  2. SolutionHostMediator
  3. SolutionHostContext
  4. SolutionManager
  5. SolutionContextService
  • Anonymous
    January 21, 2013
    Sounds a bit like the FileSystemWatcher to me, so SolutionWatcher maybe, although I also like the SolutionTracker.

  • Anonymous
    January 21, 2013
    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.

  • Anonymous
    January 21, 2013
    SSS SolutionSnapshotSynchronizer

  • Anonymous
    January 21, 2013
    The comment has been removed

  • Anonymous
    January 21, 2013
    SolutionController

  • Anonymous
    January 21, 2013
    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. }

  • Anonymous
    January 21, 2013
    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).

  • Anonymous
    January 21, 2013
    SolutionSecretary

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

  • Anonymous
    January 21, 2013
    SolutionSnapshotObserver

  • Anonymous
    January 21, 2013
    Broker or Mediator

  • Anonymous
    January 21, 2013
    +1 for SolutionTracker/SolutionChangeTracker

  • Anonymous
    January 21, 2013
    SolutionState Then rename the property to be SolutionState.Current or SolutionState.CurrentSnapshot

  • Anonymous
    January 22, 2013
    My first thought was SolutionManager, although I like SolutionTracker and SolutionState as well.  

  • Anonymous
    January 22, 2013
    IntelliSol

  • Anonymous
    January 22, 2013
    I think terms Host and Environment match the abstraction you described.

  • Anonymous
    January 23, 2013
    The comment has been removed

  • Anonymous
    January 23, 2013
    Why not Zoidberg?

  • Anonymous
    January 24, 2013
    The comment has been removed

  • Anonymous
    January 25, 2013
    SolutionHub SolutionInstance SolutionDealer

  • Anonymous
    February 23, 2013
    SolutionSnapshotEditor or SolutionSnapshotUpdater.... the "thing" tasked with keeping the "magazine"(a snapshot of content) up to date.

  • Anonymous
    April 03, 2013
    Workspace ;)

  • Anonymous
    April 03, 2013
    Yes, we decided not to change it... Workspace it is.