The Heroes of Java: Marcus Lagergren

Markus Eisele
0
The first part in my recent interview series: "The Heroes of Java".

Marcus Lagergren
holds an M.Sc. in computer science from the Royal Institute of Technology in Stockholm, Sweden. He has a background in computer security but has worked with runtimes since 1999. Marcus has been team lead and architect for the JRockit code generators and has been involved in pretty much every other aspect of the JRockit JVM internals. Since 2008 Marcus works for Oracle.

General
Who are you?
"I'm a software guy who lives in Stockholm, Sweden. I've been working with runtimes for more than ten years, but try to find time to do hobby hacks so I can understand all modern trends in computer science. I enjoy all areas of programming, and I'm not afraid to get my hands dirty with low level programming - kids these day seems to be afraid of that, which may in the long term doom us all. ;) As one of the guys who designed the JRockit JVM, I co-authored a book about JVM internals in 2010, which generated some attention."

Your offical job title at your company?
"Consulting member of technical staff"

Do you care about it?
"To the extent of the name - not at all. I can hardly even tell what it means - I am, for instance, not a consultant. I care about it to the extent that it defines a couple of responsibilities and how independent I can be and so on. And benefits. Probably. I'm not sure it matters. I've never really sat at my desk one morning and not having known what to do, regardless of title. The thing to do has usually turned out the be the right thing and people have rarely complained ;-)

I'm slightly skeptical to the whole thing of having titles and "contributor levels", the way it is implemented in any large corporation. People are not exactly World of Warcraft characters and titles in general convey little meaning to an outsider.

At BEA Systems I was a "Staff Engineer" but my business cards said "Senior Wizard"."

Do you speak foreign languages? Which ones?
"I am a native Swedish speaker. I speak English fluently and decent German. My German is great grammatically, but sadly lacking in nouns, slang and modern expressions. I need to get a German dictionary for my Kindle and start working my way through it from A to Z. (A Swedish dictionary would of course go from A to Ö, but Germans treat the umlauts as modifiers and not as separate letters ;-))
I'm quite good with languages, so I can usually figure out what stuff means in most latin based languages."

How long is your daily "bootstrap" process? (Coffee, news, email)
"It used to be pretty short. Coffee, read (but don't answer) new e-mail, done. Then social networks like Twitter appeared. I convince myself that they actually give me targeted and relevant information instead of just being time wasters. ;-)

Then the kids arrived. They are definitely the worst planning obstacle of all. (Yes let's just objectify them as time sinks in the Gantt chart for the sake of this discussion, I'm really a lovely father. I promise). Now my bootstrap process is interleaved with waking the kids up and getting them to school. This means rising at 06.30 and getting to work at 09.30. My most productive hacking time is in the mornings, so this is a bit of a handicap. I usually solve this with my wife so I can pick up the kids from school some days and leave them other days. If I have a "pick them up" day, I just swallow some coffee and leave the house at 07.00 and do the rest of the bootstrap at my desk.

Working at home is not possible with children at home, but once they are out of the house it saves the commute. As I'm going to be on a distributed team now for a while I suspect I'll be doing more work from home. The main problem there is that I have such a nice espresso machine so I usually turn into Cornholio at about 10.30 any given day at home.

I've experimented a bit with my bootstrapping - for example not doing any "catching up" as the first thing in the morning. For a period of time I tried getting up at 05.00, gulping down some coffee, hacking like a maniac for 2 hours and then getting the kids to school. Interestingly enough I was quite productive, but I don't think that's something any man should go through."

Twitter
You have a twitter handle? Why?
"I started using Twitter just by adding people so I could get a customized stream of news. This mostly contained work related topics at first, but now I'm including anyone that is fun or interesting. Twitter has provided me with links to interesting stuff I wouldn't had found in a wider search domain and has also let me get to know people who proved to be really important to talk to. I've used Twitter for job purposes, to exchange information with people I've not met in "real life", with useful results. Twitter is also a great news medium, such as when people tweet from the scene of an accident or similar event.

I had my Twitter account for about a year until I actually started posting stuff myself. I post tweets mostly about programming, but not exclusively."

Whom are you following in general?
"I follow people in the IT business, people in politics and people who make me laugh. These are not disjoint sets."

Do you have a personal "policy" for twitter?
"I try to keep my tweets in line with "my public character" and to be (mostly) polite. I keep more personal stuff in closed social networks instead, but of course there are always exceptions. For example: the world needed to know about my fight with the flesh eating bacteria in my arm this summer. THEY NEEDED TO KNOW! ;-)"

Does your company restrict or encourage you with your twitter usage?
"I'm encouraged to do things like tech evangelism, where appropriate, but it's not an explicit part of my role description.

There is a social networking policy, which involves inside information and stuff. To be honest I'm not 100% up to date with it, but in general on Twitter, regardless of corporate policy, if you've got nothing good to say, it might be better to say nothing at all. The whole world and all its search engines are listening. "

Work
What's your daily development setup? (OS/IDE/VC/other Tools)
"I tend to work mostly on Ubuntu and Windows on my workstation, depending on what is required. I use Mac OS on my MacBook. The MacBook is my own and not company property. My work-at-home setup is a fully loaded 27" iMac with lots of VMWare images.

My preferred IDE for C/C++ is Microsoft Visual Studio. When we developed JRockit we used Windows as the development platform because the IDE was so much more efficient than anything available on Linux. Visual Studio is truly excellent, both for development and debugging, with a compiler that produces tight code.

On Linux I do most things (except Java) in plain old Emacs with etags, old school style. GDB is the debugger.

For Java development I used to be an Eclipse guy, but I've recently been trying out the new Netbeans and find that I quite like it.

For native Mac/iOS projects I have little choice but Xcode, which is actually useable and not so painful after the release of 4.0, but it's still nowhere near Visual Studio.

The other tools I need are usually available from the prompt on any UNIX based system."

Which is the tool providing most productivity to your work?
"Hmm... Emacs? I don't think I ever close it."

Your prefered way of interacting with co-workers?
"Definitely face to face in a room with maybe four people working on the same thing. I have nothing against distributed work but it has a tendency to slow things down if you aren't careful. I guess I'm not the most patient guy in the world.

If you have to work in a distributed setting, e-mail lists is a horrible way of communicating information. Instant messaging is a little better. Video messaging, screen sharing over Skype etc, is quite good. But nothing beats being in the same room and having whiteboard discussions about things. When I was compiler lead for JRockit, we were all in one room and things like "all in favor of rewriting this complex subsystem from scratch - raise your hands" were totally possible. Doing things like that over a mailing list in six different time zones naturally gets a lot more complex, especially since you lose subtle nuances of the communication.

When working on a tightly coupled system you can also infer a lot more from the "convection currents" of information with people doing the same thing in the same room. You pick up a stray word in a conversation about some technical topic and your brain synthesizes this into part of the big picture without you having to think too much about it. To clarify, these kinds of work setups are not endless cubicle farms, but largish offices where 4-5 people share a room. I like that a lot."

The above should in no way imply that I think distributed projects suck, they are just harder to synchronize and you get less for free."

What's your favorite way of managing your todo's?
"Make a list. Prioritize it. Do the TODOs one after another. Always minimize context switches. They kill. I don't think anyone can juggle many tasks at the same time and be at their maximum level of productivity. For me "multitasking" usually just means figuring out in which order to execute the TODOs and not jumping back and forth between them.

Have your e-mail program check for mail every half hour. Not every two minutes. Half an hour is a pretty good time unit to concentrate on one problem."

If you could make a wish for a job at your favorite company: What would that be?
"I find runtimes and operating systems fascinating. I want some architectural say in where they go next and have discussions with industry and academia about technology. At the same time, a day without looking at assembly code is a bad day. I'm lucky to have a lot of this already in my job description.

Alternatively I'd like to be on the founding team of another startup. That's how I've spent some of the happiest time in my life. Naturally, it's harder with mortgage and kids. The startup would still have to involve some assembly language ;-)"

Java
You're still programming in Java. Why?
"I'm not just programming in Java. I'm programming in everything. I use the most appropriate tools that get the job done for any given situation. Why am I still programming in C? Because it gets the job done for certain problem sets. Why am I still programming in Haskell? OK - that one has more to do with personal sexual deviancy I guess.

When it comes to Java as a language it is not going to go away. It is ingrained in a lot of critical infrastructure in the world. The runtime is also definitely not going to go away - quite the opposite. If I may inject a blatant commercial plug here, my book "Oracle JRockit the definitive guide" talks a bit about how Java and the JVM became such a ubiquitous platform, and what the intrinsics of any such platform should be."

What's least fun with Java?
"Java code is extremely voluminous - it takes up so much space compared to Scala or Ruby or Clojure. Any line of Java that I write seems to want to break the 80 character boundary. Really simple things are missing as well, for example, there are no implicit ways of initializing a map or a collection, boilerplate getter and setter code for every field needs to be in place and so on.

My main language feature frustration is lack of lambdas. Also, religiously, I've always been strictly against camel case in any setting. This goes back to Smalltalk ;)

Type erasure can also be irritating. I guess one of the design rationales behind generics was that the implementation only needed to change the compiler. Surprisingly enough it also turns out that compiling certain type relationships in Java is undecidable. As someone who majored in theoretical computer science this is sort of like an itch in my brain that won't go away."

If you could change one thing with Java, what would that be?
"For the language: lambdas and more compactness a la project Coin. We are on the way there and I think Java 8 will get rid of a significant part of the frustrations.

For the JVM specification: replace bytecode with something that works better as a generic intermediate language for a multi language JVM. I think bytecode will, even despite invokedynamic, soon turn out to be a bottleneck between the program and the runtime. I rant a bit about it in my book. "

What's your personal favorite in dynamic languages?
"I like Ruby and Clojure lot. As I'm going to start contributing to Oracle's Nashorn project now, I guess I'll have to teach myself to like Javascript as well. I will put myself through the same proven brainwashing process as when I taught myself to appreciate country music, a skill that was necessary to acquire after marrying my wife."

Which programming technique has moved you forwards most and why?
"Being the nightmare of anyone who wants to define a "process" or "technique" in software, I must ask you to define "programming technique" better.

I'll give it a shot anyway - how do I quickly write code that works and is robust?

Any code that contains sanity checks turns out to be good code: get into the habit of doing things like putting assertions absolutely everywhere without thinking about it.

Make sure new features have tests. If you consider something "untestable" you are doing it wrong. Make it testable! You might even have to write some kind of whitebox API that exposes system internals for the test framework to get a test written. In that case, so be it. Do it!

If you fix a bug by painstakingly whittling a reproducer down to a small deterministic bit of code - make sure to turn it into a unit test, tag it with a bug number and get it into the test suite so you'll never have to do this again.

When programming, avoid explicit parallelism. Things like actors, the fork/join framework or NSOperationQueue:s in Cocoa help out.

Understand memory management.

Measure and understand where your application spends its time and why.

Finally, whenever you can: be stateless or use functional programming. This saves debugging time and produces fewer bugs."

What was the biggest project you've ever worked on?
"The JRockit Java virtual machine."

Which was the worst programming mistake you did?
"I've done my share of evil over the years, so it's hard to single out any one mistake. I've caused buffer overruns that crashed production systems, non deterministic function behavior and what not. However, one particular thing that had long term consequences comes to mind. At some point we decided that memory allocation in the JRockit compiler code should have no return value checks and just automatically bail on failure. I can't even remember why - reducing code mass, maybe, or a misguided attempt to trap malloc/free bugs in a global framework that was never written. Anyway, it sucked and turned into a maintenance nightmare. Always check your return values, kids. Always. That's another good thing in languages like Java - try/catch/finally. If you don't have them there is no shortcut. If the thing can return NULL, you must handle it."

Post a Comment

0Comments

Post a Comment (0)