Is there a way to record and playback a coding session in Visual Studio?
Asked Answered
S

1

13

I've read in Robert Martin's "Clean Code" that in the 80's Emacs was already capable of recording and playing back your coding session.
I just realised how much I'd learn from that practice, I'd love to profile myself!

However I really don't think it'd be very effective to record the screen (as in video) especially because Visual Studio is already unbearably slow and besides it'd be boring to seek the video in a player.

Instead, it would be really awesome to have some plugin that could record what I've coded (so not the debugging and visual designer, etc) and could play it back for me to see how much I suck and where.

Is this possible?

Edit: just a quote from the book to show how amusing this could be:

Bob enters the module.
He scrolls down to the function needing change.
He pauses, considering his options.
Oh, he’s scrolling up to the top of the module to check the initialization of a variable.
Now he scrolls back down and begins to type.
Ooops, he’s erasing what he typed!
He types it again.
He erases it again!
He types half of something else but then erases that!
He scrolls down to another function that calls the function he’s changing to see how it is called.
He scrolls back up and types the same code he just erased.
He pauses.
He erases that code again!
He pops up another window and looks at a subclass. Is that function overridden?

. . .

Sun answered 18/11, 2010 at 18:58 Comment(13)
weirdo...you have successfully surpassed my own geekinessNadabas
It's sort of traditional to credit authors rather than publishers. I assume you're talking about Bob Martin's "Clean Code"!Hatbox
Actually Robert Martin's, but I also tend to cite books as O'Reilly's (is that double ' valid in the english language?) - even though I like to call them O'RLYs - but editing that to avoid misunderstanding and honor the author.Sun
Oh, sorry. Could I be high from the coffee? ::looks at the cup::Sun
Clean Code. Great book. +1 to your question I would really like to know if something like this exists.Overthrust
Robert Martin is also known as "Uncle Bob". I don't have this book, but most of his writing is great!Hatbox
Don't tell anyone, but I got mine as a rapidshare'd PDF because I currently can't afford books and I was really willing to read this one ;)Sun
++ For a relevant question. Profile yourself. Next best thing is to use diff to note overall changes. My personal theory is the smaller the number of differences it takes to implement typical functional requirements (after getting the bugs out), the more maintainable the code is.Runofthemill
@Mike Dunlavey indeed, but in practice every feature needs a different amount of code, and it's even hard to predict how much that'll be. But my "mantainometer" is far from code size (I love to divide into many (small) classes so the boilerplate is bigger overall) but instead encapsulation. So if I have to call GetItDone(); it's more mantainable than ImReady(true, "I agree"); GetItDone(DateTime.Now); CleanUp(And.EmptyRecycleBinWhileYoureAtIt);. A practical example of "done wrong" would be how the .NET BCL's Bitmap class offers no encapsulation for fast SetPixel with LockBits.Sun
@Camilo: That's why I count the number of differences, not the size of differences. Careful :) this is another subject where I've made a pest of myself. Basically, I define a domain-specific-language as one which minimizes the number of differences to achieve each functional requirement. If it's an order of magnitude, it matters.Runofthemill
@Mike Dunlavey Ah, so you mean diff as in "changelog". That's a good measure, actually. :) But I didn't understand what you mean by defining a domain-specific language. Do you mean mixing languages as you code? E.g. C# and F# in the same project?Sun
@Camilo: C#, F, C, etc are just base languages - the real language you're using is what you build on top of that. What I mean by DSL is something that encodes what is wanted as directly as possible, minimizing diff-count (and typically minimizing code size). My own examples: #372398 and #926766Runofthemill
Hm, I've been thinking lately about how cool it would be to implement a small parser + syntax for a kind of data I'll be representing frequently in the future, but I didn't knew such things were actually done commonly! You made me read some Wikipedia, thanks! :)Sun
W
2

You can just run a secret keylogging campaign on yourself.

Most keyloggers allow recording and playback as a video but you can configure it to only snap frames when you hit a key.

Wakeup answered 18/11, 2010 at 19:36 Comment(3)
This is actually an interesting idea. Heck, I could even write my own I guess! (since I really never heard about a keylogger that's not a virus...)Sun
Years ago I built a record/playback pair of apps that was really handy for repeated testing. For simple record/playback of editing sessions, I seem to remember vi could do that.Runofthemill
Well, my first and easiest option for such a thing would be to do as you say and take screenshots when a key was pressed and when the current focused application is VS. Might even be an excuse to learn autohotkey or other cool automation scripting language like that. But, besides occupying more space, these coding sessions wouldn't be very fluid. It wouldn't be possible to record the keystrokes either because with Intellisense we actually type 1/10 of identifiers... so maybe the only other way would be making a VS plug-in. Hey, not so bad, a trivial excuse to learn how they're made too! :)Sun

© 2022 - 2024 — McMap. All rights reserved.