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?