This entry is half an open-letter and half a rant-blog so if I run with it a bit too far, please bear with me.
Last year Sun introduces JavaFX as a rich multimedia platform for Java (Applet 2.0 ?) , at that time I was busy finding a way to run Flash animations on as many mobile phones as possible. Yes I know about Flashlite but the support of Flashlite are not that extensivise, especially if you include low end / old phones that only support MIDP 2.0. I was jumping up and down when they showed how rich multimedia app can actually run "unharmed" on a phone.
To my dismay, I found out later on that JavaFX only works on CDC (read high-end, almost PDA type phones) and totally ignore CLDC - Ok, that's not really true, they do plan cover CLDC (some time in the future?) but the CLDC phone's JVM must support SVG. (OK that's a whole bunch of acronymes but in short, JavaFX only supports the latest greatest phones).
To add salt to injury, I heard (ok this is only rumours - but it still hurts) that Sun is coming up with a design tool much like Abode Flash to help designers use JavaFX.
Now here's a news for Sun, designers don't use Java or JavaFX or any tool related to them. Designers are trained in schools to use Flash and AI and Photoshop. Heck, even Microsoft had a hard time dethroning Adobe as a design tool company. JavaFX only covers high-end newest-latest phones that already has Flashlite runtime: Why do I as a designer wants to create a JavaFX content when I can just run my swf (read flash) files unchanged on these latest phones?
So, here are a few things I think Sun should do instead:
1) Create a CLDC JavaFX runtime but do not insist on any extra JSR/MSA or whatever. Now how do I know that this is doable? Well because tons of rich multimedia games are already created on plain CLDC phones. Couldn't Sun just leverage the game APIs to create a JavaFX runtime? These APIs are already tried and true stuff and have been shown to be flexible enough to run the most complexe of games: let alone JavaFX content.
2) If Sun is itching to create a designer tool then please do so, but please please create an SWF to JavaFX translator. There are tons of Flash based content out there and IF this SWF to JavaFX tool comes along AND these content can run on any CLDC phone THEN JavaFX will make a killing.
Now, some might say, "hey Azrul, Sun is a server company, why the heck would they want to invest fulfilling your little wet dream". Let me answer that with a story of Sara. Sara is a designer living in Kuala Lumpur, Malaysia. She designs content for mobile phones. With the current technology, Sara could create around 4-5 contents per week (enough to pay her rent and to put food on the table). She uses Flash because that is the tool they taught her in designer school and Flash is flexible enough for her to create really cool stuff. But she has a huge problem: most phones does not support Flashlite. She saved some money and buy a software that converts Flash's swf files to 3gp files (mobile video) and send these 3gp files through MMS to her clients. Unfortunately, her MMS provider informed her that Telco's only supports MMS up to 100kb only. She knows about an alternative to MMS which is WAP push, but Sara allows her clients to include their own text in her content and MMS is the only way to do that right now. Because of this limitation on the size of the files, Sara needs to be extra careful on things like, the number of colors she uses and cool stuff like gradients are next to impossible to do.
Now, Mr. Schwartz, CEO of Sun, after reading a blog by some unknown guy, decided to make JavaFX runtime as standard compliant as possible (read independent of any optional JSR or MSA etc.) by leveraging MIDP's game API. Furthermore, Sun has also created an swf to JavaFX converter. Sara was thrilled when she found out that she can now create Flash content, convert it to JavaFx and run it on almost any phone out there. Her programmer boyfriend told her that JavaFX is based on JavaFX script (i.e. text based ) and therefore can be modified easily. He created for her a software to allow her clients to customise her content on the fly. She was very happy, now that customization can be done on the content itself, she doesn't need to use MMS anymore. Her MMS provider also supports WAP push and she can easily move from one delivery mechanism to another. As a bonus, WAP Push is inherently international. So now Sara can sell her content to Singapore, Philippines and the rest of the world.
What really makes Sara a happy girl is that she can now concentrate on being creative instead of having to count how many colors she is using in her content. Instead of creating 4-5 contents per week, she's now creating tens of them. She even hired a few interns to help her out. Together they create a few hundred contents per month.
One fine day she got a call from her server provider saying that her server just couldn't take the load anymore: too many people are downloading her content, then she remembers Mr. Schwartz's company, Sun Microsystem. They make powerful servers with gazilion of cores embedded inside. (Her programmer boyfriend, who is now her fiancee, just couldn't stop talking about how good those servers are). She call her server provider and ask them if they can use a Sun server instead. They inform her that Sun servers are a bit expensive but she has enough money now.
So Sara uses Sun server to serve her JavaFX mobile content and all thanks to Mr. Schwartz and all those nice people at Sun who made it all possible.
And Sara lives happily ever after...
So you see, making JavaFX work CLDC phones without any extra baggage and making swf to javafx transition to be as smooth as possible actually pays off... even for Sun Microsystems, the server company.
Wednesday, April 23, 2008
Thursday, April 17, 2008
Scenario Driven Testing
Cedric's recent (ok, it's not that recent) blog on ROR prompted me to write this entry. No, I'm not about to become a RORing ROR advocate, instead I'm going to talk about testing. An interesting point raised by CEdric was this: JUnit actually holds back Java testing scenario and therefore Java is stucked with unit testing as the ultimate and unquestionable master of test and anything less (or more) is frowned upon with so much prejudice it makes "think of the children" slogan sounds holy (dramatization is mine).
Ok, unit testing is in and on itself is not evil, but it's not enough. Functional testing, in my opinion is waaayy more important and yet functional test has been like that uncle everyone despises: can't live with him, can't throw him out of the boat while you pretend going fishing with him at 3:00 AM in the morning.
But how do you do functional test?
Here's my take on it:
When you start your software development you would have scenarii (of course unless you're doing Agi-hi-le development where you code as soon as the client opens his mouth -- just joking, I know agile folks have user stories :) ). The scenarios are not and can never be comprehensive but it gives you the ability to cover the usual usage of your software (which is probably 90% of the time - give or take). All you have to do now is to create scripts mimicking the scenarii and that's it.
Scenario driven testing coupled with unit test would be a great tool for developers: unit testing covers the nitty gritty part of your system and scenario driven testing covers the large picture.
Of course, most of the time you will need to do scenario driven testing through an interface so tools like httpunit would help. But what if you need (or forced) to use an interface toolkit that has no testing framework in sight? *cough* woodstock *cough* (BTW, if anyone knows a good interface based woosdtock testing tool, please show me the light) Well, apart from testing manually, I'm still working on a way to automate things a little. So stay tune...
Ok, unit testing is in and on itself is not evil, but it's not enough. Functional testing, in my opinion is waaayy more important and yet functional test has been like that uncle everyone despises: can't live with him, can't throw him out of the boat while you pretend going fishing with him at 3:00 AM in the morning.
But how do you do functional test?
Here's my take on it:
When you start your software development you would have scenarii (of course unless you're doing Agi-hi-le development where you code as soon as the client opens his mouth -- just joking, I know agile folks have user stories :) ). The scenarios are not and can never be comprehensive but it gives you the ability to cover the usual usage of your software (which is probably 90% of the time - give or take). All you have to do now is to create scripts mimicking the scenarii and that's it.
Scenario driven testing coupled with unit test would be a great tool for developers: unit testing covers the nitty gritty part of your system and scenario driven testing covers the large picture.
Of course, most of the time you will need to do scenario driven testing through an interface so tools like httpunit would help. But what if you need (or forced) to use an interface toolkit that has no testing framework in sight? *cough* woodstock *cough* (BTW, if anyone knows a good interface based woosdtock testing tool, please show me the light) Well, apart from testing manually, I'm still working on a way to automate things a little. So stay tune...
Multiple Auto-complete for Woodstock (Netbeans Visaul Web Pack (VWP))
I have been searching around for multiple autocomplete but couldn't really find one that works seamlessly with Netbeans VWP. There is of course the work of Dimitry [http://blogs.sun.com/dmitry/entry/creating_autocomplete_entry_field_with] but this is limited to a single entry auto-complete (i need a multiple one). So just like any good hacker, I decided to see if I can improve Dimitry's code and come up with my own and le voila:
Basically, the flow of things are exactly like the one used by Dimitry, except that
1) When editing the textfield, not only that I refresh the listbox, but also see if the user is typing a comma, in which case, I will reset the filter in Page1. The filter will only contain words typed after the comma.
//in Page1 setFilter
int index = value.lastIndexOf(',');
if (index >= 0){
this.filter = value.substring(index+1);
}else{
this.filter = value;
}
listbox1DefaultOptions.filter(filter);
2) Also, the user could type the down arrow key while typing in the textfield, this will bring our focus to the listbox.
//in tf's OnKeyUp
var evtobj=event? event : window.event //distinguish between IE's explicit event object (window.event) and Firefox's implicit.
var unicode=evtobj.charCode ? evtobj.charCode : evtobj.keyCode
if (unicode==40){
document.getElementById('form1:listbox1').getSelectElement().focus();
}
document.getElementById('form1:listbox1').refresh('form1:tf');
Just to complete things, the user could also type a comma while browsing the listbox, this will be detected in the OnKeyUp event of the listbox
//OnKeyUp of listbox1
var evtobj=event? event : window.event
var unicode=evtobj.charCode ? evtobj.charCode : evtobj.keyCode
var character=String.fromCharCode(unicode)
if (unicode==44){
var text = document.getElementById('form1:tf').getProps('value').value + ',';
document.getElementById('form1:tf').setProps( {value: text } );
document.getElementById('form1:tf').getInputElement().focus();
}else{
var text = document.getElementById('form1:tf').getProps('value').value + character;
document.getElementById('form1:tf').setProps( {value: text } );
}
Of course if the listbox change, we need to append the listbox selecte entry to the textfield. (Note that We will replace any entry that is after the last comma.)
//OnChange event of listbox
var text = document.getElementById('form1:tf').getProps('value').value;
var index = text.lastIndexOf(',');
if (index >=0){
var stext = text.substring(0,index+1)+document.getElementById('form1:listbox1').getSelectedValue();
document.getElementById('form1:tf').setProps({value: stext});
}else{
var stext = document.getElementById('form1:listbox1').getSelectedValue();
document.getElementById('form1:tf').setProps({value: stext});
}
Please download the complete code here [http://www.mewit.net/codes/autocomplete.zip]
Basically, the flow of things are exactly like the one used by Dimitry, except that
1) When editing the textfield, not only that I refresh the listbox, but also see if the user is typing a comma, in which case, I will reset the filter in Page1. The filter will only contain words typed after the comma.
//in Page1 setFilter
int index = value.lastIndexOf(',');
if (index >= 0){
this.filter = value.substring(index+1);
}else{
this.filter = value;
}
listbox1DefaultOptions.filter(filter);
2) Also, the user could type the down arrow key while typing in the textfield, this will bring our focus to the listbox.
//in tf's OnKeyUp
var evtobj=event? event : window.event //distinguish between IE's explicit event object (window.event) and Firefox's implicit.
var unicode=evtobj.charCode ? evtobj.charCode : evtobj.keyCode
if (unicode==40){
document.getElementById('form1:listbox1').getSelectElement().focus();
}
document.getElementById('form1:listbox1').refresh('form1:tf');
Just to complete things, the user could also type a comma while browsing the listbox, this will be detected in the OnKeyUp event of the listbox
//OnKeyUp of listbox1
var evtobj=event? event : window.event
var unicode=evtobj.charCode ? evtobj.charCode : evtobj.keyCode
var character=String.fromCharCode(unicode)
if (unicode==44){
var text = document.getElementById('form1:tf').getProps('value').value + ',';
document.getElementById('form1:tf').setProps( {value: text } );
document.getElementById('form1:tf').getInputElement().focus();
}else{
var text = document.getElementById('form1:tf').getProps('value').value + character;
document.getElementById('form1:tf').setProps( {value: text } );
}
Of course if the listbox change, we need to append the listbox selecte entry to the textfield. (Note that We will replace any entry that is after the last comma.)
//OnChange event of listbox
var text = document.getElementById('form1:tf').getProps('value').value;
var index = text.lastIndexOf(',');
if (index >=0){
var stext = text.substring(0,index+1)+document.getElementById('form1:listbox1').getSelectedValue();
document.getElementById('form1:tf').setProps({value: stext});
}else{
var stext = document.getElementById('form1:listbox1').getSelectedValue();
document.getElementById('form1:tf').setProps({value: stext});
}
Please download the complete code here [http://www.mewit.net/codes/autocomplete.zip]
Multiple Auto-complete for Woodstock (Netbeans Visaul Web Pack (VWP))
I have been searching around for multiple autocomplete but couldn't really find one that works seamlessly with Netbeans VWP. There is of course the work of Dimitry [http://blogs.sun.com/dmitry/entry/creating_autocomplete_entry_field_with] but this is limited to a single entry auto-complete (i need a multiple one). So just like any good hacker, I decided to see if I can improve Dimitry's code and come up with my own and le voila:
Basically, the flow of things are exactly like the one used by Dimitry, except that
1) When editing the textfield, not only that I refresh the listbox, but also see if the user is typing a comma, in which case, I will reset the filter in Page1. The filter will only contain words typed after the comma.
//in Page1 setFilter
int index = value.lastIndexOf(',');
if (index >= 0){
this.filter = value.substring(index+1);
}else{
this.filter = value;
}
listbox1DefaultOptions.filter(filter);
2) Also, the user could type the down arrow key while typing in the textfield, this will bring our focus to the listbox.
//in tf's OnKeyUp
var evtobj=event? event : window.event //distinguish between IE's explicit event object (window.event) and Firefox's implicit.
var unicode=evtobj.charCode ? evtobj.charCode : evtobj.keyCode
if (unicode==40){
document.getElementById('form1:listbox1').getSelectElement().focus();
}
document.getElementById('form1:listbox1').refresh('form1:tf');
Just to complete things, the user could also type a comma while browsing the listbox, this will be detected in the OnKeyUp event of the listbox
//OnKeyUp of listbox1
var evtobj=event? event : window.event
var unicode=evtobj.charCode ? evtobj.charCode : evtobj.keyCode
var character=String.fromCharCode(unicode)
if (unicode==44){
var text = document.getElementById('form1:tf').getProps('value').value + ',';
document.getElementById('form1:tf').setProps( {value: text } );
document.getElementById('form1:tf').getInputElement().focus();
}else{
var text = document.getElementById('form1:tf').getProps('value').value + character;
document.getElementById('form1:tf').setProps( {value: text } );
}
Of course if the listbox change, we need to append the listbox selecte entry to the textfield. (Note that We will replace any entry that is after the last comma.)
//OnChange event of listbox
var text = document.getElementById('form1:tf').getProps('value').value;
var index = text.lastIndexOf(',');
if (index >=0){
var stext = text.substring(0,index+1)+document.getElementById('form1:listbox1').getSelectedValue();
document.getElementById('form1:tf').setProps({value: stext});
}else{
var stext = document.getElementById('form1:listbox1').getSelectedValue();
document.getElementById('form1:tf').setProps({value: stext});
}
Basically, the flow of things are exactly like the one used by Dimitry, except that
1) When editing the textfield, not only that I refresh the listbox, but also see if the user is typing a comma, in which case, I will reset the filter in Page1. The filter will only contain words typed after the comma.
//in Page1 setFilter
int index = value.lastIndexOf(',');
if (index >= 0){
this.filter = value.substring(index+1);
}else{
this.filter = value;
}
listbox1DefaultOptions.filter(filter);
2) Also, the user could type the down arrow key while typing in the textfield, this will bring our focus to the listbox.
//in tf's OnKeyUp
var evtobj=event? event : window.event //distinguish between IE's explicit event object (window.event) and Firefox's implicit.
var unicode=evtobj.charCode ? evtobj.charCode : evtobj.keyCode
if (unicode==40){
document.getElementById('form1:listbox1').getSelectElement().focus();
}
document.getElementById('form1:listbox1').refresh('form1:tf');
Just to complete things, the user could also type a comma while browsing the listbox, this will be detected in the OnKeyUp event of the listbox
//OnKeyUp of listbox1
var evtobj=event? event : window.event
var unicode=evtobj.charCode ? evtobj.charCode : evtobj.keyCode
var character=String.fromCharCode(unicode)
if (unicode==44){
var text = document.getElementById('form1:tf').getProps('value').value + ',';
document.getElementById('form1:tf').setProps( {value: text } );
document.getElementById('form1:tf').getInputElement().focus();
}else{
var text = document.getElementById('form1:tf').getProps('value').value + character;
document.getElementById('form1:tf').setProps( {value: text } );
}
Of course if the listbox change, we need to append the listbox selecte entry to the textfield. (Note that We will replace any entry that is after the last comma.)
//OnChange event of listbox
var text = document.getElementById('form1:tf').getProps('value').value;
var index = text.lastIndexOf(',');
if (index >=0){
var stext = text.substring(0,index+1)+document.getElementById('form1:listbox1').getSelectedValue();
document.getElementById('form1:tf').setProps({value: stext});
}else{
var stext = document.getElementById('form1:listbox1').getSelectedValue();
document.getElementById('form1:tf').setProps({value: stext});
}
Monday, April 14, 2008
Should MDeC be writing software
Now if you're a Malaysian, you probably heard of the MSC initiative launched by our previous PM to boost Malaysia into the information age. Well MDeC (formally known as MDC) is the (goverment linked) company tasked as being the steward of MSC. (www.mdec.com.my)
Being a steward of MSC is a blur job description. So MDeC does everything from managing real estates, managing gov. grants, making sure that IT talents are always available etc.
Should MDeC write software? Yes they should!
Ok, I know that all the business folks who make up MDeC's higher echelon is all eyeful and ready to grab their guns and shoot this idea to kingdom come... but please, hear me out.
Whay is Malaysian IT isn't taking off, despite what we do. Every single day, we have more and more Indian nationals working in Cyberjaya instead of the locals. Our IT graduates are not performing and lack way behind in either skills or theory. Our IT enterpreneur are afraid to speak out, our venture capitalist should just be called capitalist since most of them are even worse than banks, our IT shops, diligent and hardworking as they are, have to resort to selling computers since no one is helping them to create and monetize their IPs. We are the third outsourcing destination after India and China and yet we do nothing to at least maintain that or, God forbid, improve our ranking.
I'm matured enough and knowledgable enough to understand that not all these problems are MDeC's fault. The problem is that MDeC is, intentinally or not, blissfully unaware of these problems. Ok, that is not entirely true. A lot of people in MDeC are aware of these problems but the processes put in place to solve these problems are so out of touch with the reality of things its not even funny anymore.
I'm not about to hang MDeC by the neck without offering some way to improve things. How to improve?, why, MDeC should create its own software and "suffer" like we suffer, experience the pain that we experience at every tick of the clock. Now don't just write software, market it, find investors for it, find clients to back it up etc. And MDeC will surely know where to put the dollars of their next budget to.
Now before we dismiss the possibility of this, do know that MDeC is already creating creative contents (www.saladin.tv) and I guess that is why support for creative contents are quite extensive because they did go through the pain of actually creating something. But do know that a lot of MSC companies create software too (heck, by my account, there are a lot more software shops compared to creative content shops).
To MDeC, unless you experience things that we, the Malaysian software industry, had to go through, you will never truely understand the pain. No matter how many dialogs you run, no matter how many face to face, heart to heart meetings you have with the local software shops, experience is and will always be the best teacher.
Being a steward of MSC is a blur job description. So MDeC does everything from managing real estates, managing gov. grants, making sure that IT talents are always available etc.
Should MDeC write software? Yes they should!
Ok, I know that all the business folks who make up MDeC's higher echelon is all eyeful and ready to grab their guns and shoot this idea to kingdom come... but please, hear me out.
Whay is Malaysian IT isn't taking off, despite what we do. Every single day, we have more and more Indian nationals working in Cyberjaya instead of the locals. Our IT graduates are not performing and lack way behind in either skills or theory. Our IT enterpreneur are afraid to speak out, our venture capitalist should just be called capitalist since most of them are even worse than banks, our IT shops, diligent and hardworking as they are, have to resort to selling computers since no one is helping them to create and monetize their IPs. We are the third outsourcing destination after India and China and yet we do nothing to at least maintain that or, God forbid, improve our ranking.
I'm matured enough and knowledgable enough to understand that not all these problems are MDeC's fault. The problem is that MDeC is, intentinally or not, blissfully unaware of these problems. Ok, that is not entirely true. A lot of people in MDeC are aware of these problems but the processes put in place to solve these problems are so out of touch with the reality of things its not even funny anymore.
I'm not about to hang MDeC by the neck without offering some way to improve things. How to improve?, why, MDeC should create its own software and "suffer" like we suffer, experience the pain that we experience at every tick of the clock. Now don't just write software, market it, find investors for it, find clients to back it up etc. And MDeC will surely know where to put the dollars of their next budget to.
Now before we dismiss the possibility of this, do know that MDeC is already creating creative contents (www.saladin.tv) and I guess that is why support for creative contents are quite extensive because they did go through the pain of actually creating something. But do know that a lot of MSC companies create software too (heck, by my account, there are a lot more software shops compared to creative content shops).
To MDeC, unless you experience things that we, the Malaysian software industry, had to go through, you will never truely understand the pain. No matter how many dialogs you run, no matter how many face to face, heart to heart meetings you have with the local software shops, experience is and will always be the best teacher.
Subscribe to:
Posts (Atom)