-
Before start: turn off intellicode to reduce noise
-
Go to https://visualstudio.microsoft.com/downloads/ and download VS 2019 "Community" version
- Select ASP.NET and web developement, and .Net desktop developement workloads
-
https://dotnet.microsoft.com/download/visual-studio-sdks dotnet 6.0 SDK
-
With a small codebase, I've setup the demo to closely resemble the way many people approach their daily coding tasks, instead of grouping related features together and going through a checklist.
-
Open MemoryGame solution (C#) in VS
- quick intro on terms like solution/projects/references, and quickly go through the projcts
- Show syntax/semantic coloring, hover tips, completions, etc. those are some of the basic features everyone expect from a modern IDE.
- navigate through the code via go-to-def, find-all and find ref
-
Start the game
- Curerntly the implementation is very limited, only one kind of card and something seems wrong, we first need to figure out what's the problem.
-
Close app and open unit test project
- brief intro to testing
- Show two existing test in test explorer
- Test discovery also utilize Roslyn APIs
-
Add a test to make sure we have matching pairs
- uncomment HaveMatchingPairs but not [Fact] attribute
- why the test doesn't show? Notice the warning
- Run and it fails. Shouldn't use refrence equality for comparison
-
Start LUT
- Make sure to include only test project (workaround a LUT bug handling blazor project)
- how it works
-
Make CatCard implement IEquatable
- Implement interface
- Override Equals
- Overrride GetHashCode
- Now passing!
-
Run again to check
- Works great!
-
Now add a few tests to cover more paths.
- Coverage looks better now
- Un-oh, one test failed, since we only have one kind of card. Now it's time to expand our game
-
We need more cards
- We can simply copy/paste and create a DogCard, but what if we want to add more. Need to avoid duplicated code
- manually change CatCard to a abstract CardBase, fix all references, and then create CatCard and DogCard to implement it. Too many steps...
- Extarct base class!
- Select all members for base and flag Anaimal as abstract
- Fix interface
- Now add Dog and Monkey. Test all passed now.
-
Before sending out a pull request for review, I need to tidy things up
- Refactorings:
- extract method, wrap call chain, etc (see comments in model.cs)
- Open error list and editconfig
- CA2200
- Fix naming issues
- Change editorconfig to use K&R style
- prefer var as error
- Use switch expression (CardHelps.cs)
- Refactorings:
-
Some potential customer suggested increasing variaty and number of card
- Sure, just repeast last step and add a new type. (make sure not to add emoji to AllAnaimals helper!)
- now the name
Animaldoesn't make sense anymore. We need to change it toEmoji. - Manual rename? Find/Replace? Let's use inline rename.
- Don't forget the parameter name
-
One last check, run the app again.
- Hmm, where's the taco card...?
- We forgot to update the emoji list
-
Source generator
- how does CG works?
- exclude all existintg card related files, and add reference to CG project.
- no errors. GoToDef and show emoji.txt
- Run app
- Add new emoji in txt file
- run again
End of App demo
Optional: Show Roslyn
- Open in VS:
- ~200 projects
- Count lines in roslyn: 5 million lines of source code
- Find reference CompletionItem: 400+ references
- show analyzers we use
- show source generator we use for syntax
- show number of tests