Slashdot Mirror


Taking the Pain Out of Debugging With Live Programming

angry tapir writes "'Everyone knows that debugging is twice as hard as writing a program in the first place,' Brian Kernighan once wrote (adding: 'So if you're as clever as you can be when you write it, how will you ever debug it?') However, Sean McDirmid, a researcher at Microsoft, has been working to remove some of the pain from debugging. McDirmid, based at Microsoft Research Asia, has been studying ways of implementing usable live programming environments: a solution that is less intrusive than classical debuggers. The idea is to essentially provide a programming environment in which editing of code and the execution of code occur simultaneously — and in the same interface as code editing — with tools to track the state of variables in a more or less live manner."

38 of 254 comments (clear)

  1. Greenspun's Tenth Rule by White+Flame · · Score: 2, Insightful

    This will no doubt become an ad hoc, informally-specified, bug-ridden, slow implementation of half of a REPL.

    1. Re:Greenspun's Tenth Rule by charles2678 · · Score: 5, Insightful

      I suspect you haven't seen a Common LISP debugging environment. Yes, they allow breakpoints, as well as live code modification. (And if you were lucky enough to have a LISP machine, you could dive into the code behind your libraries, your operating system, etc. -- updating state on the fly, all the way back to tweaking a driver on a running machine... on the fly, in LISP).

      What we have these days (say, Clojure's nrepl) isn't as powerful as that, but it's pretty damned powerful even so. Want to tie into your production system and see what a new version of a function would do against currently live production data, without actually changing the production system's behavior? If you're writing purely functional code, you can do that trivially... and the language strongly encourages pure functional code (as opposed to many "modern" languages where trying to write things to be side-effect-free is working against the grain).

      If the best example you can think of is QBasic, you have no idea what a REPL can do.

    2. Re:Greenspun's Tenth Rule by sourcerror · · Score: 2

      That's why they have monads. But LISP isn't a purely functional language anyway.

    3. Re:Greenspun's Tenth Rule by TheRaven64 · · Score: 4, Informative

      Smalltalk-80 (or even Smalltalk-76) is more akin to what they seem to be describing than most lisp implementations. In Smalltalk-80, you can inspect every object in the system, visually, including the objects that comprise the inspector for whatever you're looking at, and you can modify any value on the stack, at any depth, unwind it and so on.

      --
      I am TheRaven on Soylent News
    4. Re:Greenspun's Tenth Rule by Ed+Avis · · Score: 2
      So you have your nicely written function of type int -> int, but now you want to add some trace statements while it executes, but you can't because it is purely functional. Then someone helpfully suggests monads. Now all you have to do is rewrite it to be of type int -> IO int, and rewrite all of the calling functions to be of monadic type too, and so on all the way up to the top level of the program...

      The fundamental problem is that you need some way to separate the program itself (which is purely functional) from whatever scaffolding and diagnostic code you put in to help test and debug it. In imperative languages you can happily mix the two together but in pure functional programming you can't, and the language environment has to provide explicit support for trace messages and the like.

      --
      -- Ed Avis ed@membled.com
  2. Re:Visual Studio by gabereiser · · Score: 4, Interesting

    seriously? Now I admit that Visual Studio is feature rich, only on windows, only with microsoft stacks, and doesn't compile things in a normal fashion (see #pragma) this above comment just oozes microsoft troll...

  3. Eclipse by roman_mir · · Score: 2

    I've been using this amazing technique for a long time now, IDEs like Eclipse make it fairly easy to do that. TFS doesn't explain what is it that he is doing differently.

    1. Re:Eclipse by rwise2112 · · Score: 2

      Yeah. This sounds just like a profiler, which has been around forever. Is there something new here, or am I totally off base here?

      --

      "For every expert, there is an equal and opposite expert"
    2. Re:Eclipse by H0p313ss · · Score: 2

      What do you mean, everybody knows that's not how you program. You have to create a GUI interface using Visual Basic that's how you track an IP address and incidentally that's how all modern applications are written.

      In the past few months I've been watching 24 on Netflix since I missed the original broadcasts. Their mis-application of technology is fantastic.

      A drinking game where you take a shot for every time someone uses "port" or "socket" incorrectly would probably get me arrested, I simply can't metabolise alcohol that fast.

      --
      XML is a known as a key material required to create SMD: Software of Mass Destruction
  4. Good, but... by ControlFreal · · Score: 3, Insightful

    ... this should be in addition to good coding/style standards, proper design, proper source revision control, proper code reviews, and continuous testing/integration. Without any of the former, using this tool does not provide that much information: You first want to know whether your code does what you think it should do, whether it is thread safe, whether it is leaking memory, etc., etc., etc.

    --
    Support a Europe-related section on Slashdot!
  5. Microsoft Foundation Classes by Latent+Heat · · Score: 2, Interesting
    Yeah, yeah, reinventing LISP.

    Forget that, will this be reinventing, dunno, "MFC .NET", where software is effortlessly implemented, tested, and documented using a mix of object classes, C++ templates, custom extensions to C++ that break portability, "wizard" (i.e. obscure template) generated code, a virtual machine, and calls between "managed code" on the virtual machine and native code that break security and prompt stern security scoldings when your code is on a virtual drive or "network share"?

  6. Re:Visual Studio by DJ+Jones · · Score: 5, Funny

    Have you tried the new VS2012? They took a shotgun to the UI and the file menu is still screaming from the trauma.

  7. 1980 called... by Anonymous Coward · · Score: 2, Funny
  8. Re:Visual Studio by Anonymous Coward · · Score: 2, Insightful

    seriously? Now I admit that Visual Studio is feature rich, only on windows, only with microsoft stacks, and doesn't compile things in a normal fashion (see #pragma) this above comment just oozes microsoft troll...

    It's a troll alright, pretending to be over-the-top-Microsoft shill and still getting some Slashdotters riled up, even though this has been going on for a long while and obvious troll is obvious.

  9. Wow by LizardKing · · Score: 5, Funny

    They've reinvented Smalltalk. Let's party like it's 1980.

    1. Re:Wow by FalcDot · · Score: 2

      Sounds more like they reinvented the Python console...

      Or, you know, bash.

      Any shell, reallly.

    2. Re:Wow by Spudley · · Score: 3, Informative

      Why is the computer industry hell bent on constantly reinventing the wheel?

      Because the computer industry (and certainly the louder and more vocal parts of it) has a heavy bias of young excitable developers who are talented enough to create these things from scratch, and not experienced enough to think that others might have done similar things in the past.

      --
      (Spudley Strikes Again!)
    3. Re:Wow by ranton · · Score: 4, Insightful

      Why is the computer industry hell bent on constantly reinventing the wheel?

      Why are people in the computer industry hell bent on complaining when people take concepts from well designed software of the past an implement it in more popular development tools? Can you imagine how annoying it would be if architects kept saying "The Romans figured out arches two thousand years ago, why do these new kids keep reinventing the wheel" ?

      IMHO, I welcome most attempts to take the good features from Smalltalk and implement in more heavily used languages.

      --
      -- All that is necessary for the triumph of evil is that good men do nothing. -- Edmund Burke
  10. Re:Visual Studio by neminem · · Score: 4, Interesting

    Apparently you're a troll? A weird one, because I kind of agree with you (except about Express: yes, it's free, but it's also so limited as to be basically crap.) VS *is* really the greatest IDE I've ever used. It's not perfect, but it is the best I've used. I obviously have not used every IDE ever, and I will also admit that it's much better at debugging .net code than unmanaged c++ code, but still. Microsoft has pushed a lot of crappy, worthless software, but VS 2008 was quality, and 2010 even better (apart from a couple minor UI mistakes, easily fixable with free extensions). Notably, at least far as the summary went, it's done everything this guy is claiming he invented, since basically forever. (Though I personally leave the "recompile on the fly" option turned off; I think it's more trouble than it's worth.)

  11. Re:Spreadsheet by SJHillman · · Score: 2

    Reminds me of batch files, personally. As long as the script runs in a loop of some sort, you can have Notepad open to edit the script while it's still running. I think shell scripts are the same way, although I haven't done much with shell scripts in years.

  12. Re:Visual Studio by ByOhTek · · Score: 2

    OK. I've yet to find a better overall environment (though Eclipse + Java beats VS in some aspects of debugging, neither seems better at every aspect). However, I don't see the point of your post. In reality "care" would have been implementing this YEARS ago. I mean, I've used Python for a long time, and all I can think is "I have this in Python. WTF is novel or research about this? Just %$#@ing do it.

    --
    Self proclaimed typo king, and inventor of the bear destroying coffee table (patent not pending).
  13. Re:Visual Studio by progician · · Score: 3, Informative

    You must be very unbiased guy in general. No MS partisanship, whatsoever.

    While I agree that the MS Visual Studio is a good IDE over all, there are better alternatives out there. The first real problem with it is that it's single-platform. You can't use it anywhere.
    The extensibility is a bitch in VS. It takes too much time and effort to figure out it's API, and it's quirks. Not to mention the support for these retarded languages that VS supports, apart from C++ and C#. That is the only two that worth even to look at.
    The debugger is great... except that the whole IDE is based around their own debugger, and you making a debugging interface in VS takes more time than any other IDE out there.
    Visual Studio also very rigid on your project structure, and if you don't subscribe to their project file model, you are basically screwed.
    Not to mention, that Visual Studio is a resource hog only running on very beefy configuration. Oh, and don't get me started with the useless packages that installs on your system for no apparent reason. Finally, if you want to do refactoring, you have to purchase an external tools, like VAX.

    So, while it has some good features for which MS deserves a candy, overall it isn't that good, no need for jumping up and down like a puppy dog.

  14. they have a word for this by waddgodd · · Score: 4, Informative

    "a programming environment in which editing of code and the execution of code occur simultaneously" is commonly called an interpreter, welcome to 1975

    --
    Just because you're paranoid doesn't mean they aren't out to get you
    1. Re:they have a word for this by DavidHumus · · Score: 2
  15. Re:Visual Studio by Chrisq · · Score: 2

    Compiling these two will lead to synergies.

    Obvious troll is obvious.

    Do you mean shill? If so I agree.

  16. Re:Visual Studio by ByOhTek · · Score: 3, Insightful

    You must have closed your eyes and plugged your ears at the shotgun. I admit it was pretty gruesome. However, after wards they brought out the chainsaw, boiling acid and a couple of fighter jets for good measure... It was horrible.

    The sad thing is... They already did that once before to get to the UI that was in 2010... The UI does seem to be getting worse and worse... Just like with their OS and Office products (and it seems, many others to a lesser degree).

    --
    Self proclaimed typo king, and inventor of the bear destroying coffee table (patent not pending).
  17. give me the ability to reverse system time by Chirs · · Score: 2

    I just want the ability to detect a fault and then run my entire system backwards to figure out where the problem came in. Wind River Simics can do this, but it's expensive and time-consuming to get a model of your hardware unless it happens to be something they already support. It's also slow to run (as you'd expect).

    1. Re:give me the ability to reverse system time by eric2hill · · Score: 2
      --
      LOAD "SIG",8,1
      LOADING...
      READY.
      RUN
  18. Welcome to smalltalk, circa 1980's... by zaroastra · · Score: 2

    This looks soooo much like the way smalltalk engines where implemented in the 80's it's boring.
    One can always count on MS to bring the latest in software innovation

    --
    I'm trying to get modded "Interesting Flamebait Informative and Insightful Redundant Troll" *-* Please Help *-*
    1. Re:Welcome to smalltalk, circa 1980's... by turkeyfeathers · · Score: 2

      They've brought smalltalk into the 21st century... by adding Clippy!

  19. Re:Live Syntax checking. by CastrTroy · · Score: 5, Interesting

    Welcome to VB.Net. It's been there for ages. Mind you you have to pause the debugger to edit the code, but that's probably a good idea anyway. VB.Net also has some of the best pre-compile (it has a background compiler) syntax checking of any language I've ever seen. The only time you actually have to compile the program is when you want to run it, you never have to compile to make changes show up for auto-complete. And once you're running in the debugger you can edit the code anytime the code is stopped. There's a few limitations. I'm not sure if you can add a whole class while it's running, but you can definitely fix all those little off-by-one errors and continue running the program.

    --

    Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
  20. Apple quote in article by CODiNE · · Score: 4, Informative

    What's funny about this article is it's focused on a very limited text based debugging system where the author is already apologizing for bugs while demo'ing it.

    It mentions a quote from an Apple guy on the same topic. Wait a minute... Apple is working on this too? So you click the link and find a much better article with a similar system that's way more advanced and live connects the graphics with the code.

    Just kind of sad, I RTFA and think "Huh, that's interesting, someday" then check out the link inside the article and find a much more informative and interesting story that I'm still reading. Read THAT article instead. Looking forward to seeing this creep into Xcode updates.

    --
    Cwm, fjord-bank glyphs vext quiz
  21. Re:Visual Studio by TechyImmigrant · · Score: 4, Interesting

    >What are the better alternatives?

    Instrumented code.
    Unit testing.
    Live testing.
    Rapid build - test turnaround.

    If you're looking for a better debugger, you're doing it wrong.
    You need to instrument your code with the features to make it testable from within the running code base.

    --
    I should use this sig to advertise my book ISBN-13 : 978-1501515132.
  22. Inventing on principle by jeroenrijckaert · · Score: 2

    The idea is good, but not new : http://vimeo.com/36579366 (Bret Victor's Inventing On Principle)

  23. Re:Visual Studio by Nemesisghost · · Score: 2

    I've personally fallen in love with Visual Studio. It's definitely the planets most feature-rich and capable IDE.

    How is not being able to load 64-bit libraries, that it compiled, feature rich? I guess I should consider the fact that I can't edit the UI using the same libraries I will deploy a feature. For those that are unaware, the UI designer is still only 32-bit, even though VS has been able to compile 64-bit for a while now. So when you are working on a 64-bit project and want to use the libraries you've written, you 1st have to compile it all to 32-bit, do your edits in 32-bit and then recompile for release as 64-bit.

    Or another issue is with manually edited Entity Framework edmx files, which is necessary considering that Entity Framework doesn't natively support all MS-SQL data types and other things that Entity Framework lacks. If you "Update from Database" a manually edited edmx file, goodbye manual changes. But hey, you didn't really mean to manually edit the file, so as a feature VS fix that for you.

  24. Re:Visual Studio by phantomfive · · Score: 3, Insightful

    Microsoft really cares about programmers and developers and helps all of them write efficient and clean code.

    If that were true, they would get a working C99 compiler, one that isn't based on a standard from over 20 years ago. I had to install Cygwin to compile some code over the last few months because it wouldn't compile in Visual Studio.

    It's not even that hard, even allowing variables to be declared at any point in the code would be a huge improvement and would be a simple little change. If Microsoft wants to pay me to come do it for them, I'll give them half off.

    --
    "First they came for the slanderers and i said nothing."
  25. Re: Visual Studio by billstclair · · Score: 2

    Lisp has been supporting this for over 3 decades.

  26. try FORTH by Giant+Electronic+Bra · · Score: 2

    Its 100x better for this than any of the languages you mention, higher performance, generally, and achieves VERY high rates of internal reusability to boot. I literaly wrote 4.5 million lines of fully debugged functioning FORTH code in 5 years. It certainly isn't a FASHIONABLE tool, but its frighteningly effective.

    --
    "Malo periculosam, libertatem quam quietam servitutem." -- Jefferson