Core changes - important!

Coordinator
Feb 11, 2012 at 3:23 PM
Edited Feb 11, 2012 at 3:35 PM

Hi,

I've done a huge change today (002cda7a21c3) and I'd like to describe the results - please read this post and feel free to ask questions.

  1. I've added constructors with contract checking to all ProgramElement subclasses (important thing - when i.e. a method has no arguments, String.Empty must be passed instead of null to MethodElement - I've added contract null checking for all classes, so that I can get rid of this during saving data to Lucene directory, where nulls are forbidden).
    To make the constructors really valuable, we need to make all the property setters private and delete the default constructors, which now, as a temporary solution, calls base constructor using trash values - Kosta - here's question for you probably - can you update SrcMLParser class so that it use new constructors? This is the only file that prevents me from finishing this change - I can do that by my own if you want, but I thought: your code, your decision.
    I think this is the best way to make sure that we are using valid core objects (with valid data) in all the modules.
  2. I've removed static Create method from all SandoDocument subclasses - contract checking is already made when we use them so they are just an additional step with no real value - I've also updated all the places in the application where these methods were used directly - DocumentFactory (where contract checking and all the logic to chose the appropriate subclass is implemented) should be used whenever new SandoDocument object must be created.
  3. I've created new project UnitTestHelpers - I've moved SampleProgramElementFactory there - this class can be used by all test methods where sample ProgramElement object is required - I've also updated its code so that you can provide your own data or use the defaults.

The most important change I'd like to finish is the one related to the Core classes, so that I can continue with the IndexerSearcher implementation

Coordinator
Feb 11, 2012 at 4:55 PM

Great work!  

>Kosta - here's question for you probably - can you update SrcMLParser class so that it use new constructors?

FYI, I created a task to track this and assigned it to Kosta.

Also, FYI, I actually saw Kosta in person yesterday (I was giving a talk at the university where he is a professor) and he's agreed to start parsing C++ code so that we'll be able to help search both C# and C++.  I believe this constitutes the top two languages that are used in Visual Studio, or at least two very popular ones.  

Coordinator
Feb 11, 2012 at 4:58 PM

One other note...

for anyone new to this project (and also any other older people) please check out the Indexer project if you want to get an idea of the code style that we want to strive for.  This project has great code style.

Coordinator
Feb 11, 2012 at 5:31 PM

One additional note - I've marked the default constructors as obsolete so that (hopefully we all from time to time read warnings ;) ) no one use them in the new code

Coordinator
Feb 14, 2012 at 11:32 AM

Just for the clarification - the default constructors are gone right now and the parser is updated