Enterprise grade Java.
You'll read about Conferences, Java User Groups, Java, Integration, Reactive, Microservices and other technologies.

Friday, November 26, 2010

Thoughts on Java's pace - will kairons decide about the future?

08:32 Friday, November 26, 2010 Posted by Test No comments:
Kevin asks in his recent Java.net poll what do you think about the current pace of Java 7 / Java 8 development? It's not finished today and only 163 votes were given, but I'll try to explain what I think about the past, pace and what should happen in the future.

the past - of Java
Java came on the scene in 1996. It was all very exciting, very energizing. And Sun kept shipping releases on a fairly regular basis for quite a while. 1.1 came out in 1997. 1.2 in 1998, 1.3 in 2000. 1.4 shipped in 2002. 5.0 shipped in 2004 and the last feature release shipped by Sun was Java 6 in 2006.

the pace and time - in general
It is an age-old experience that we do certain things because they have to be done at specific times. Initially unwritten laws, which determined what to do and when to leave is. These laws were mostly derived from the necessities of nature or the culture. This experience of time is called "Kairos" by the ancient Greeks. Everyone knows you can be as important to the proper choice of the moment: when we mow the meadow or to invest in new project and other examples. Today we can and must increasingly decide when and what to do and when not. But beside "Kairos" we also depend on "Chronos", the time we can actually measure and that may be appropriate or not. While chronos is quantitative, kairos has a qualitative nature. Everything depends on your own speed. Or the speed of the organizations you are working. Whenever you are going on even slightly higher speeds than your personal adjustmens to Kairos and Chronos recommend, you will experience the consequences. You have to spend more power than would have been good. Doing this for quite some time even could make you sick.

But wait ... how does this map to java releases?
I know, this sounds very metaphysical and you expected to hear about development stuff. Let's look at how the pace of Java happend to be in the past. It seems as if it followed some kind of a pattern. The odd numbered ones tend to be evolutionary with very few new stuff, but mostly clean-ups and stabilization. The even numbered ones tended to have revolutionary, big things in them. Even if Mark said in his general technical session at J1, that it was not intended to have this kind of pattern in the releases, it was there. An indication of "Kairos" working? I don't know. And please, don't follow that I am heavily involved into any kind of metaphysical stuff in general :) But what I do like to point out is, that I strongly believe that there is a right pace for everything. I am not talking about the right time to do things, but about the speed and release cycles over time. And I believe, that we all have seen this in the past. Start two completely equal projects at the same time with the same setting and force one to be quicker at about 10% of the other. You will most likely see it failing while the other one was ready in time. I am shure, you can find other and better examples.

but we have had long four years silence now - not enough?
Java stood still for years now. More or less exactly four. The double of what "Kairos" had done until 6.0. This should have been a sufficient timeframe for everybody working towards the 6.0 and leaving everything behind. But if you look into the field, you can find lots of 1.4 and 1.5 Versions around. What happened? Was 1.6 too unsexy? Wow .. no ... it was! Were people and companies happy with what they had with 1.4/1.5? I guess not! But it seems as if the missing successor gave them the time to readjust to their own pace and to catch up with the powers lost on the way. Even before the first rumors about possible timelines of Java 7 and 8 came up, the first projects started to move again. It was simply time to do the right thing again.

was time lost?
Comming back to Kevin's poll, the majority of voters think, that a lot of time was lost, but that we're back on track now, having the new JSRs in place and a timeline for Java 7 and 8. But was this realy lost time? There are two sides to this. From the metaphysical points I gave you above: not a single minute. But from a technology point of view I agree with the majority. Some of the most needed advancements have been delayed and Java itself has to catch up with a lot of progress done by other programming languages.

how will Kairos influence Java's future?
What happened with Sun was special. A product without a long-term plan is something I personaly could not imagine to see with Oracle. So they are probably taking out Kairos from the equation. But I still think, that they could learn from what happend in the past. The sucessfull release plan from the past allows for some recommendations to a bright future. They are very personal and I would love to discuss them with anybody out there, so please comment and discuss:
  • New Releases every two (!) years
  • Follow the even/odd system
  • Do continous security updates (monthly or on ASAP)
  • Invest in migration (help people getting to newer versions faster and easier)
  • Decouple parts and allow version mixes (don't force people to learn all the new stuff at once)

Thursday, November 25, 2010

DOAG 2010 - It's a wrap ... in pictures ...

07:18 Thursday, November 25, 2010 Posted by Test No comments:
A week after, the images arrived. And I found some time to do the postprocessing. This is what came out after walking around with the 7D of Bjoern and the speedlight and lenses from Bernd. A big "Thank you guys!" for letting me use your equipment! It's a pleasure to have great tools at hand :) Maybe .. sometimes I get my own stuff ...
Get the details at flickr/myfear.

Sunday, November 21, 2010

Review "Oracle JRockit - The Definitive Guide"

21:09 Sunday, November 21, 2010 Posted by Test 4 comments:
, , ,
This one was on my list of things to buy for quite some time. The only reason for this is simple: Oracle JRockit is one of the industry’s highest performing Java Virtual Machines and I loved it's JIT everything approach since the beginning. I did not manage to do this, since it was published. But a few days ago, the digital edition arrived on my iPad and I finally found the time to read it. Sit back and relax. This is my personal view about the most stunning Java related book of 2010!

Book: Oracle JRockit - The Definitive Guide
Language : English
Paperback : 588 pages [ 235mm x 191mm ]
Release Date : June 2010
ISBN : 1847198066
ISBN 13 : 978-1-847198-06-8
Author(s) : Marcus Hirt (Blog, Twitter, Website), Marcus Lagergren (Twitter)

The Authors
As usual, I start with a short introduction of the authors. In this special case, I feel this is very important to understand the book. Both started out with Appeal Virtual Machines where they were founders. This was the company, which initially developed JRockit. Marcus Lagergren holds a 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 2007 Marcus works for Oracle on fast Virtualization technology.

Marcus Hirt is currently working for Oracle as Team Lead, Engineering Manager and Architect for the JRockit Mission Control team. Marcus has been an appreciated speaker on Oracle Open World, eWorld, BEAWorld, EclipseCon, Nordev and Expert Zone Developer Summit, and has contributed JRockit related articles and webinars to the JRockit community. Marcus Hirt got his M.Sc. education in computer science from the Royal Institute of Technology in Stockholm.

Both have a very stunning vita and I am really sad, that I still did not manage to meet them. Something I'll definitely try to catch up with in 2011.

The Content
Java developers are always on the lookout for better ways to analyze application behavior and gain performance. As we all know, this is not as easy as it looks. If you are trying to understand more about all this you need to know far more than simple Java. The big things in terms of performance happen elsewhere: In the JVM. If you are looking for the best Server JVM out there, you'll come across JRockit. And this book is there to reveal it's secrets. This book helps you gain in-depth knowledge of Java from the JVM’s point of view. It explains how to write code that works well with the JVM to gain performance and scalability.

The first chapter get's you started. You learn about the real basics. Cmd-line options and JRockit versioning. The real content starts with chapter 2. It brings you down to the inner workings of the JVM and the adaptive code generation ürinciples. If you are not used to assembly code examples, you will learn it. Examples are explained with bytecode and assemly code. If necessary instruction by instruction. Further on, code generation strategies, JIT compiling and runtime optimizations are explained as concepts with additional JRockit details. Chapter 3 takes you over to adaptive memory management. Here you will learn about the basics of heap management and garbage collection algorithms. Also scaling and performance are touched here. You get a glimpse at pitfalls and things, that will not work. Chapter 4 follows with everything about threads and synchronization and topics that are hard to debug and difficult to optimize. You get a more detailed look at special JRockit flags which help optimizing the topic. Chapter 5 gives your everything about benchmarking and tuning. You get basic hints about what to think about while creating a benchmark and about which measures to take. It also contains a brief overview about industry-standard benchmarks. After that you get to know about common bottlenecks and how to avoid them. Chapter 6 presents an overview about the JRockit Mission Control. Followed by chapter 7 which dives into the management console, touching MBeans, the runtime and further topics. The runtime analyzer is detailed in chapter 8. Learn about the recordings and how to analyze them in terms of memory, code, threads/locks and latency findings. As expected the flight recorder follows in chapter 9. Another JRockit tool, the memory leak detector is the major player in chapter 10. Chapter 11 dives into the JRCMD cmd-line utility and shows how it can be used for listing and sending diagnostic cmds to one or more locally running instance of the JVM. It's an alphabetical reference guide to the JRCMD commands. Chapter 12 contains everything you need to know about using the JRockit management APIs by showcasing examples. The last chapter 13 summarizes the basics about the JRockit Virtual Edition and gives some basics about the challenges by virtualizing Java. If needed you can dive deeper with the bibliography or even look through the glossary or index. 477 pages of content without the preface and the appendix is a big hit for your weekend. You better have some very silent times to follow this stuff!

Writing and style
As you might have guessed already: I am impressed by the book. Being used to read complex and detailed stuff which takes time, I really flew through this book. You get used to the direct and technical style very easy and it's still personal enough to be interesting so you keep on reading page after page. Even non native speakers should be able to follow, if they know the technical terms. I needed to lookup some very uncommon and hardware near things but this did not disturb the overall reading experience.
This was my fist eBook as PDF from Packt Publishing and I am not sure, if I am still willing to have the printed version, too. The many assembly and other code examples always makes you want to scroll back. If you are using a book you just need your thumb to solve this problem :) But I still like the digital reading experience in general.

My expectations
The structure is a bit different from the one I expected. The tooling around JRockit is covered a lot; something I wasn't expecting. But this is the only part, that did not fulfill my expectations. Especially because even those parts are excellent.
I expected to read some very technical content. But it was far more than that. It goes down to the metal and handles and registers and the JVM internals. If you thought, you know anything about the inner workings of a JVM ... here is what really happens. Don't ask what you can do for your JVM; ask, what your JVM can do for you :)

Conclusion and recommendation
Buy one! No .. better two! The digital edition and of course the paperback. It's worth it. If you have both, you can always carry the digital edition around and recall the basics and optimizations to yourself every time you think about writing optimized code for the JVM. Make shure, you have a silent place to read this one. And you should get a recent JRockit R28 to play around with. I wrote articles about it and I have seen it in the wild since some time. I thought I know a bit. Now, I know even more!
If you are a beginner, you probably need some more basics before reading this one.

Friday, November 19, 2010

DOAG 2010 - Day 3 - My second talk, tired people and the trip back

06:56 Friday, November 19, 2010 Posted by Test No comments:
My last conference day started not too early. Ed and me had an eigth o'clock breakfast appointment and we drove to the ccn afterwards. So we managed to see the first sessions starting at nine. I was not feeling like taking pictures that day. I simply carried my bag around and tried to focus. Which was not too easy. Anybody was looking tired and asking around how long the evening was for them you get surprising answers. Some hardly did get any sleep. A big surprise to even see them again in the early morning looking reasonably awake. My first stop was at Ed's keynote. He was brilliant on stage and I love listening to him.
After that I meet up with Christian Kirsch and Alexander Neumann. Both from heise.de. We talked about different projects to come and evaluated some oportunities for future work together. If you did not know by now: I like the way heise publishing is doing their job. Very professional and supportive editors give you a great time as an author. This happened around lunch time. My second talk was all about migration. At 14:00 I was answering the question how to migrate J2EE to the new Java EE specifications. What to keep in mind; which version or appserver to choose and which pitfalls to avoid. The talk was not that packed as the one yesterday. Maybe it was because Steven Feuerstein gave his keynote in parallel. What a pity for me.
I left the conference right after the talk. Beeing tired and wiped out it was time for me to take the ride back. Two hours by car to get to munich is not the best time you can do for this distance but it's ok. At the end I was happy to have my girls back and finaly have some time to spend with them in the late afternoon.

To make it short: I always enjoy the Doag conference. There are many reasons for that. First I like to see the people enjoying the program we created for them. Especially this year it was very hard to get that many good speakers and talks for the Java stream as both Devoxx and WJAX happened at the same time. I spoke to some of the speakers and some even made at last two conferences this week. If I could make a wish, I would love to see all three happening on different dates. Devoxx is something I like to attend, too next year.
The second reason is, that I like the location. The CCN is perfect for the size. All in one location on different levels. You start knowing about the rooms the second day and the tracks try to use the same rooms over and over again. That is easily navigable.
Third reason this year are the many high quality foreign speaker we had. So many ACE's, Oracle's and other guests have been on the program that it was nearly a three day English speaking conference for me. I enjoyed having OTN there. Todd did an awesome job and I would like to thank the OTN team for making this possible and for following our invitation!
In general it is easy to say, that the Oracle support was gorgeous. Oracle itself does not sponsor the conference with anything but speakers and their booth in general (which is a very important part for an independent German Oracle Users Group). But they were listening. Not only during the Q&A session but also in between. The feedback they received from their users is valuable and it's a pleasure to see them noticing this and taking care.

I would like to close with some very famous words from a well know Austrian-Amerikan: DOAG, "I'll be back!" next year! Looking forward to it!

Thursday, November 18, 2010

DOAG 2010 - Day 2 - My Talk, People and Party

10:42 Thursday, November 18, 2010 Posted by Test No comments:
The second day at the 2010 DOAG conference started more or less in time. After a longer evening it needs some discipline to get up early to be at a 10:00 talk. I arrived timely and had some time to get a last minute glimpse at my slides and even check network connectivity and other details.
The talk itself was awesome. About 30 people listening to my very slideful ( :-( ) introduction to the umbrella JSR 316 (Java EE 6). Even if I tried my best it's simply not possible to introduce a complete set of roughly 30 specifications in 30 minutes. I guess I did a not too bad job. I totally missed pointing the attendees to all the other detailed sessions about single specifications around. I'll promise I'll do better next time. Thanks for all that were listening. I guess I lost nobody and even used NetBeans M7 to demonstrate a simple Servlet calling an EJB. Not the world, but best I could do in this short time. After that I walked around and took some pictures. I hope to get them during the day. They are still on the card with Björns cam. As usual I am trying hard to publish as many impressions I took during the next days.
The afternoon was dedicated to the Q&A preparation with German Oracle management. It always takes some time to get this right and working. Me being one among others who prepared parts of the topics and questions I had to sit in the first row. Always in reach of the microphone to jump in helping the moderator if needed. I was not needed. Thanks for that. The SIG Java lead Andreas did a great job. Also did the moderator of the session which started at 17:00.
After that it was time to relax and get ready for the community evening. Ed Burns arrived in between and I was happy to finally meet him again after JavaOne. I did not know he speaks German very well. He promised to be there at 19:00 for the party. And he showed up in time. We did a quick walk through. Listened to some Jazz and meet some people out there. The food was awesome and there was plenty to drink out there. Beside him some other fellow guys joined us from time to time. Here are some impressions:

Some people in the pictures: Tom Kyte, Steven Feuerstein, Ed Burns, Simon Haslam, Todd Trichler .... it was an awesome evening.
Today is my last day at the conference. I am giving my last talk at 14:00. If you make it, I would be glad.

Wednesday, November 17, 2010

DOAG 2010 - Day 1 - People, Sightseeing, Java SE 7 and 8

08:58 Wednesday, November 17, 2010 Posted by Test No comments:
It started yesterday. The DOAG 2010, the German Oracle Usergoup Conference. After a very quick ride by car (it is held in Nuremberg which really close to Munich) I did my check-in things and tried to make me comfortable with everything which is going on. I again had the luck to walk around with Björns cam. A big Thank you for this! Will process the images afterwards and post them to my flickr account. The first day way packed with personal meetings. Catching up with people, you haven't seen for some time is great. A special thanks to Dalibor Topic (blog) who was giving a nice overview about the things to come with JDK 7.
As you already know, there are a couple of aces with the DOAG conference this year, too. I meet Daniel, Stanley and many more German aces around.

For some of our international guests there was a sightseeing tour later on. DOAG was so kind inviting me to join and this is how it look like, if a couple of Oracle related guys walk through Nuremberg during evening times freezing their hands off at rainy 7°C. (Thanks to Ronald Bradford for this awesome picture!)
After a nice dinner and some drinks it finally was time to go to bed. A quick twitter and email check revealed a surprise. Around midnight Oracle filled four new JSRs. Java SE 7 and Java SE 8 among them. Reading this, it was totally clear to me, why Dalibor was smiling at me a few hours ago, when I asked him about the time frame for the JSR submission ;)

Today is my first talk at 10:00 (room: Riga). I am giving a brief overview about the Java EE 6 specification and try to present some Samples with NetBeans. If you are there, I would be happy to meet you in person.

Monday, November 15, 2010

DOAG Conference 2010 - last minute information and hints

07:24 Monday, November 15, 2010 Posted by Test No comments:
One day to go. The 2010 DOAG (German Oracle Users Group) Conference starts tomorrow in the CCN CongressCenter Nuremberg East. There are a couple of ACEs and ACED out there.
Additionally you can find a couple of well know Oracle people attending and giving sessions. Here are a couple of last minute information and links.

The CCN is a nice location and part of the Nuremberg traid fair. You can find a floor plan (PDF) for the conference on the DOAG webpages.The conference is open daily from 8 to 18, on 18. November 2010 from 8 to 17.You can find tracel directions on the ccn website.

The program
You can find a complete program online on the DOAG website. This year you can also use the mobile edition which is accessible from http://iconfguide.doag.org.If you like, you can also download a digital edition (PDF) from the daily conference news. The first issue contains an overview of the complete program.

The DOAG also started using twitter this year. They basically use two accounts. @DOAGeV and @doagkonferenz. Not a big surprise, that both are German speaking. If this is an option for you, you get updates on session changes, unconference topics, highlights of the day, some more background about the conference and possibly some interesting retweets from members and attendants. They missed giving out an official twitter hastag but I can imagine most people will tag with #doag2010 or #doagkonferenz.If you are following my own @myfear twitter account, you can get some more English speaking information. At last, I'll try to stick to English :)

What else
I am looking forward to this years DOAG conference. Even if I am very very unhappy about the timing. There are two other conferences (Devoxx and WJAX) going on just the same timeframe and I would loved to have visited all three. It will be hard catching up with all the news from the other two online. I hope, that the hosts mange to serialize this a little more in the future. This would be my advice :) And as always, if I am not giving a session you can probably finde me walking around with a cam. I try to post pictures on my flickr.com/myfear account frequently.
Looking forward meeting you there! Save travels!

Friday, November 12, 2010

Arquillian - Test in the Container with GlassFish 3.1-b04 Embedded

07:41 Friday, November 12, 2010 Posted by Test 1 comment:
, ,
I am playing around with JBoss Arquillian these days. Arquillian provides a easy mechanism to test your application code inside a remote or embedded container or by interacting as a client of the container. Having all those integration testing issues since years really makes me wanting all those stuff. And this week there was time to get my hands on that.

Download and first information
It's simple. Grep your copy of the Arquillian Examples from Github and start using it. You can either download or even checkout the repository. It's also a very good idea to make yourself familiar with the reference guide.
The examples are based on the latest Arquillian 1.0.0.Alpha4 and this probably is the first hint for what to expect. It's an alpha. Even if the reference guide gives very helpfull information there is still a lack of public solutions to many things you come across. So you are up to the help of the guys who created it. Thank god, they are available and very responsive. (Thanks to @aslakknutsen and @mojavelinux for the latest help and ideas!) If you are having problems, the first place to look is the user forum. It's there since September and already contains 127 threads to look for solutions.

Getting Started
Extract the arquillian-arquillian-examples-XXXXX.zip archive to a suitable location. All you need is a recent JDK (1.6.0_21) and Maven (3.0). The best place to start is the ejb31-gfembedded example. In most cases this will not work out of the box. I had  to adjust a couple of things to get this running.

1) Repositories
You need access to some JBoss maven repositories in order to build your example. Add the JBoss public repository as a repository and additional as pluginRepository in your projects pom.xml.
2) Offline/Proxy issues with GF
If you are working behind a corporate proxy, you need to add a build section with the maven-surefire-plugin to your pom.xml. Add both systemProperties relevant: http.proxyHost and http.proxyPort. Offline testing is not possible at the moment. Because Arquillian only runs with GF 3.1-b04 which has an issue trying to download schema ressources from sun.com.
3) Arquillian configuration files
If you are not adding an arquillian.xml to your project you will get into trouble with temp gf folders. It's best to exactly configure where you have your instance_root. This is done via the arquillian.xml file. Add a src\test\resources folder and put it in there. Configure the instanceRoot to be at src/test/glassfish and create the folder. Next is to add a testResource pointing to src\test\resources in your pom.xml

Executing your tests
Done. Now you are set. Get a cmd line and enter mvn test -Pglassfish-embedded-3. You see a couple of log messages streamed to your console. The most important one:

INFO: GlassFish3.1-b04 (java_re-private) startup time : Embedded(406ms) startup services(312ms) tota

followed by

INFO: Portable JNDI names for EJB HelloEJB : [java:global/test/HelloEJB, java:global/test/HelloEJB!o

which both tells you, that the embedded server started and your HelloEJB was bound to the JNDI tree. And finally you have the test-results.

Test set: org.jboss.arquillian.examples.gfembedded.HelloEJBTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 9.563 sec

You can find an output per testcase in the target/surefire-reports folder. This also contains an XML with all the testsuite properties used and the testcase itself.

Some more hints
It took quite some time to get this up and running. There are some examples in the initial distribution also (arquillian-1.0.0.Alpha4\examples\junit) but I was not able to get them to work. Still not giving up, but it's hard because missing qualified error output. You only get logfiles and they collect errors no matter from where they are. If you are looking for the actuall deployment that Arquillian tries to deploy, you can add an engine entry to your arquillian.xml


This puts the generated jar to the target directory. Helpfull, if you are tracking down things in the server.
Also don't try to use a later GlassFish build than b04. This leads to a couple of problems and exceptions, that needed to be tracked down further. Seems as if some older TLDScanner things came up again.

Where next
This was a very short howto about running a simple example with Arquillian. Now you have a working environment to make yourself compfortable with this awesome tool and you should actually start looking at the executed testcase and try to write some yourself. I have never ever seen a tool before which could run my integration tests with that ease. I am really looking forward to the next versions and I still hope, that the guys at JBoss start having a more frequent look at
a) their examples and
b) the integration with the Java EE 6 Reference Implementation.

Tuesday, November 9, 2010

Mobile Apps - Native? Flash? HTML 5? - a decision helper.

07:39 Tuesday, November 9, 2010 Posted by Test 6 comments:
, ,
Playing around with mobile app development recently one question comes up over and over again: Should I write a native app, rely on the browser capabilities or even take the flash/air approach? As you might have guessed, this is not an easy answer. But there are things, you could keep in mind and make your own decision.

What's out there?
To understand the problem behind this, we do need to have a look at the industry and standards out there.
According to different sources (Gartner, et all) there are roughly 270 million smartphone devices and 19 million tablet computers in the hands of users at the moment. With tablets being the fastest growing cosumer electronic category of all times. Especially the iPad became the most quickly adopted electronic device ever. According to different sources, the number of mobile devices shipped every year will grow at rates close to 20 percent. There are roughly six different vendors with offerings for smartphones or tablet devices which both count as mobiles in my definition. The most prominent ones are of course Apple, RIM and Nokia.

Why should I care?
Mobile computing is a trend in the enterprise. Forrester predicts, that 2/3 of the employees will require mobility support until 2012. For IDC it is clear that more than 35 percent of the workforce will be done using mobile technologies in 2013. All this are enormous numbers that do point into one direction. Mobile computing will hit your desk or even development environment sometimes in the near future. You better should be prepared for that.

Which technologies are there?
Six major vendors are a valid size in the industry. But if we look at the used technologies you quickly notice, that they are all cooking their own soup. Android and BlackBerry rely on Java (Eclipse) with additional device APIs. iOS has it's own Objective-C based programming and tooling environment. Windows Phone 7 relays on  .NET and C#, Symbian uses Qt and C++. All (except one) OS are equipped with a modern browser based on an HTML 5 capable rendering engine. Windows Phone 7 however will probably still contain an older version of Microsoft's Internet Explorer and therefore will not be able to take advantage from the next generation web standard. All but one OS actually can or will be able to run Flash / AIR applications.

HTML 5 and Flash/AIR are the solution?
If you are looking at the table above and are searching for a "write once, run everywhere solution", you probably are looking for an HTML 5 or Flash/AIR app. BUT, both have their limitations. Using one of them does not give you access to the device specific APIs. So you will not be able to access contacts, phone, camera and many many more of the device specific features. If you need them and you need to support all the major OS in the mobile space, you probably end up writing different applications for different devices. If you are comfortable with the feature set you get from HTML 5 and Flash/AIR you probably have found your programming language of choice.

Native apps are the solution?
You are going to develop native applications if you are trying to be most efficient in terms of resource usage. This is true for battery, RAM and CPU. If you are trying to get the best out of your resources there is no other way than writing native apps. I already mentioned the integration with built in device features. If you are willing to write an email, contacts or whatever integration there is no other way than to provide a native app making use of all the device/OS specific features.

What else?
But to be honest, this are not the only decisions you have to make. There are many more things to look after if your are evaluating your approach to mobile development. Everything starts with technology but you also have to look at the distribution (e.g. Do you really want your app in iTunes?) at the development skills in your company, at the needed resources (Do all developers really need a mac ?) ....

As always, there is no single answer to this simple question. But I still hope, the little basics give a brief idea about where to look to make your decision.