Wednesday, 18 June 2008

NetBeans as IDE for developing MySQL itself

Since meeting yesterday with Vladimir Voskresensky, a Sun colleague from St Petersburg, I have a new favourite answer to the request "so tell me an example of technical advantages resulting from Sun's acquisition of MySQL":

Using NetBeans as an IDE (Integrated Development Environment) for coding and learning MySQL.



Now, that's a simple answer, and that's because it's a simple and beautiful thought. But let's start from the beginning.

In my days as a coder, I enjoyed the command line. I've used various coding editors, and I've disliked the hassle of learning new IDEs, who sometimes are more of a straightjacket than a productivity enabler. So call me conservative if you will, but I've written my PHP stuff directly in an editor.

Those who write the C and C++ code of MySQL are likely even more conservative than I am, and for a good reason: They've set up an environment that they're happy with and used to. They are about as likely to change their development environment away from the vim/emacs/gdb/gcc stack as football fans change their favourite football teams.

So you can imagine that Vladimir had a bit of an uphill battle when he wanted to demo the C / C++ extensions to NetBeans.

But then Vladimir started to describe how the NetBeans team had used MySQL as a test case even before MySQL became a candidate for "eat your own dog food" through Sun's acquisition of MySQL. It's a real-world complex piece of software, and if an IDE can handle MySQL, it can probably handle most applications.

And the NetBeans team was able to successfully support MySQL:

  • MySQL can be directly imported as a NetBeans project

  • NetBeans can show dependencies between MySQL routine calls

  • NetBeans can show all occurences of a C variable in MySQL's source code, in a scope-sensitive way (i.e. not a simple grep)

  • NetBeans shows all occurences, across the code base, of a particular class, function, field, macro etc.

  • NetBeans can rename any identifier in-place, such as "a" to something more meaningful (see demo)

  • NetBeans integrates debugging, even of MySQL

  • NetBeans provides easy navigation of code


Now this was enough even for a sceptic like me to become eager. During his demo, Vladimir used the Discovery Wizard to import MySQL and was then quickly able to dispel my deeply rooted skepticism against "unnecessary straightjacket GUIs that prevent real work". I got a sting in my heart, longing back to do some Real Work, i.e. coding (of which I've done much too little this century).

My conclusion is that

  • NetBeans is a great way to learn the MySQL source code

  • learning the MySQL source code is simplified both for our community and for our own engineers

  • usage is so simple and provides so many advantages that it's worthy of a try


So I didn't leave the meeting before Vladimir had promised me three things:

  • to write a MySQL Forge Wiki article with pointers to all resources necessary to open MySQL as a NetBeans project

  • to write a MySQL Dev Zone article, expanding on the Wiki article, on how to productively use NetBeans when learning and developing the MySQL code base (from downloading NetBeans over importing MySQL to debugging MySQL, including the key productivity-enhancing benefits of NetBeans)

  • to try his best to come to the MySQL Developer Meeting in Riga in September, to demo NetBeans to our engineers


In return, I promised Vladimir

  • to introduce Vladimir to key MySQL engineers that may evaluate the IDE

  • to set up a MySQL University slot on development MySQL with NetBeans

  • to encourage MySQLers (employees and community) to provide the NetBeans time with feedback that may improve upon, say, the debugging properties


In short, stay tuned for some practical tips on how to work on the MySQL code base from the NetBeans integrated development environment.

I showed a draft of my blog entry to a small group of developers from the MySQL Engineering Team and here are some points I found interesting in their feedback:

  • "I was an emacs hacker once, but since then I got my behind kicked by a VB-developer, a dreamweaver clicker, and a drag-n-drop flash code designer so I opened my eyes to a bigger world. Now I use NetBeans."

  • "There are some small shortcomings, like attaching debug process, but it works very well in most cases."

  • "I tried the NetBeans C/C++ package. I liked that I don't need to download all the Java bloat just to use C/C++. Something I used to miss with Eclipse - just packaged for the C/C++ developer. Bravo!"

  • "Please allow me the luxury of obeying to my habits and staying away from IDEs (being a 10+ years exclusive vi/gcc/gdb command line user this is a lot of inertia that I don't like to lose right now)."

  • "NetBeans has a neat little re-factoring goodie: change the name of a variable in one place and NetBeans can change it in other places for you."

  • "My colleague seems to enjoy the ease of extending NetBeans by plug-ins. He has written a plug-in which integrates PHP test runs and presents the results as HTML during a weekend. Can you mention http://blogs.sun.com/netbeansphp/ ?"

  • "The only feature which I don't like - which is a killer feature for me as I'm a typical "MSIU" (most stupid imaginable user) - is the automatic close and reload of modified files. Accidently remove a file outside of NetBeans, go back to NetBeans and *damn* NetBeans has closed the file. Anyway, this has been reported to the responsible dev already."

  • "Class browsing and debugging worked well for C/C++. And yes, performance was very much acceptable."


Links:

3 comments:

  1. Net beans is ok for locally changing code. My major problem with it is its inability to play nice with VIM style folding {{{ code to be foldable }}}. Its missing some polish and ease of use for the edge cases like editing remote files, and use of source code control integration. (some other java based OSS ide, that will go nameless works out of the box with remote repositories on windows).

    ReplyDelete
  2. Very interesting article!
    I am waiting for resources about how to import mysql as a netbeans project.

    ReplyDelete
  3. Remember that I saw instructions how to use NetBeans for the MySQL Server source but now I can't find it anymore. Anyone remembers where it is? We should probably link from this blog to there....

    ReplyDelete