Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

2014-05-14

New Java themed TV series parodies

Three Java themed TV series parodies trailers! I can see it how it goes further ...

http://2014.javazone.no/

It looks that I will be Writing Bad fan. But "welcome to Oracle" sounds so familiar ...

2009-07-02

Choosing scatter chart library for web application

So I definitely know that I have to make web based UI for medical diagnostic application. It's not so complicated as I initially though. It is a kind of scatter chart that has to display delivered XY data and use as reference some kind of meta data like description, database id etc. Basic functionality of that module is adding and editing points. It should be somehow interactive - like has clickable points that can fire various events. Graph zooming is also needed.

There are articles with list of interesting solutions: 13 useful graphing solutions, 10 Free Chart Scripts. I reviewed few charting libraries that can be divided into three categories:
  • HTML canvas charts
  • Java applets
  • Flash based charts
There where also other interesting ideas like SVG based interactive chart, or image chart with imagemap and added DHTML tricks, but still without enough support and needed writing more code.

Needed charting solutions should be lightweight so I thought about html canvas drawing, but unfortunately there are serious IE issues - It does not implement such feature, so excanvas ActiveX is used not always successfully (new IE changes are breaking excanvas functionality).

Another good choice from point of customization and extending functionality is Java applet based on JFreeChart, or lighter jchart2d library. Using Java applet was tempting. I made some serious applet work some time ago so I had to make some user experience tests of deploying UI as applet. The large group of users has no technical computer background, and can be confused about accepting prompts for Java installation (Java is not preinstalled with system in here), waiting for runtime download and finally for applet initializing. That may cause serious problems with acceptance tests.

So I tried Open Flash Chart 2- the nice flash based chart library. It has fixed but all basic features I need. Flash player is king of the browsers (large deployments ratio) today. That and smaller than Java's runtime should cause less problems with runtime installation. It has wrapper libraries in most popular programming languages including Java. I have choose third party jofc2 library for quite easy integration with code sample from Open Flash Chart and Wicket example.

Open Flash Chart has enough javascript interface, to dynamically change data, graph style, add tooltips and script onclick events on data points. It has no direct zooming support but can be implemented as changing chart properties by adding external scripted controls. Redrawing after data delivery is fast also.

Near future brings even more choices like Silverlight, improved Applet/JavaFX runtime or adoption of canvas like solutions.


Further reading:
Scatter chart library - moving to Flot
Looking for simple python chart library

2009-03-02

The art of exceptions catching

Exceptions in programming languages are very useful tool for propagation information about program errors and helping handling critical situations properly. But it is only tool and how it can be useful depends only on implementing programmer.

I can put it in few points what I have learned in theory and verified during practice:
  • If you don't know what to do with exceptions don't catch'em - exceptions reveal errors so fix errors - don't hide them under carpet
  • Catch exception if you can handle it, you know how to clean up used resources and how to inform developers/users about that event
  • Don't use exceptions mechanism (hacky way) in the correct flow of the program
  • In Java use unchecked exceptions (RuntimeExceptions descendants) instead of checked Exceptions - it saves "throws SomeException" litter in code forcefully reminding about catching them (it makes sense only in some kind of low level services with inevitable critical situations that can be handled by direct clients)

I think it's only basic set of rules.

Do you have another ideas for exception handling?

2008-11-17

I have used Wicket for small web application

More than week ago I have started implementing first module for Medical Diagnostic Expert System. It's quite simple application for manual data entry and editing. There is one catch - forms have to be flexible in some way and dynamically configurable. The whole project will work as web application, so data entry editor will work in that way too.

As this is the new fresh project I have possibility to use the newest Java features and frameworks. The multi tier architecture application will use Spring for easy separation of concerns between layers. That plus JPA on top of Hibernate should be sufficient for future development of modules and expansions (the final project boundary is blurry).

I thought about using Spring MVC framework, but after little research I decided to use Wicket, to set up user interface. Wicket is using view component model, with main page component containing other components and controls with event handlers. Binding controls is made by marking special wicket attributes in html template. Additional markup is not intrusive, so even raw html template viewed in web browser is looking good (sounds like Tapestry). The basic ideas are similar to that used in ASP.NET. Developing in Wicket is more Java code centric than in other popular frameworks, with clean separation of html template design.

For quick start up I have used QWicket generated application template and tailored it to work with JPA and my core module. Application should work under Postresql database, but for easy of deployment of prototype for testing purposes I stayed with preconfigured HSQLDB. Switching back to Postgres is just as easy, as changing few lines in properties file.

I'm unexperienced Wicket user but development goes quite smooth. Using documentation, tutorials and books is really helpful at that stage. As far so good. I'm finishing UI prototype and can concentrate now on implementing core module functionalities.

2008-11-12

Younger programming languages and frameworks are better

I have short talk with young student of Computer Science. He said he prefers .NET framework and C# more than Java, because Java seems outdated. I've seen those kind of preferences for some time in new generation of young programmers. I've asked what makes Java so outdated. He said about first release year (sic!), and mess in Java libraries, legacy API and so on. I've no time to ask for more details, but many of those pros and cons come probably from rumors and hypes. Good point for .NET marketing.

Younger programming languages and frameworks are potentially better. It's true for most popular (chosen by ,majority so in some way best) languages supported by community and commerce. Standing on the shoulders of existing giants - in that case language frameworks, gives better opportunity to make better API and add more practical features. New languages and frameworks are addressing most popular trends for its time (like WEB 2.0 and AJAX now). Other possible positive outcome would be cutting of all legacy code (good and bad one), and start everything from scratch, that would tend to include new ideas. All that needs many people, hours of work, and money.

So taking that assumptions and having big support - about every 10 (5?) years it would allow to produce new "cool" language that young generation of programmers will choose.

What is the important thing for developers? It's better to be open for new ideas and be ready for changes. What is good tool for work today, would be old in next 10 years.

2008-11-03

Java XML object binding libraries

I have to implement mapping between some domain model object and xml document representation. It's actually working production application. Xml schema could be suited to needs of current application. I'm thinking about two free/open source libraries.

Sun promotes Java add-in support for JAXB standard. It looks heavier, and has harder initial learning curve. Last implementation of JAXB 2.0+ gives tools (lek automatic class generation) and aids to simplify development (annotation based mapping definition). So JAXB as officially supported standard should gain more user base.

The good and tested third party solution is JXM (Java XML Mapping). It's default configuration allows fast implementation and mapping of desired object structures. You only have to keep standard node and attribute names, that is right if you are designing XML from scratch using "java code centric" approach. Other possibilities are also enabled by adding some marshaling/unmarshaling code.

As Blogger.com added polling feature, I've posted poll, so readers could give opinion about their favorite XML/object mapping Java library.


2008-10-20

I'm busy - new Java project

I'm quite busy now, while setting up new project. It will be Medical Diagnostic Expert System using machine learning algorithms. I've got legacy applications preceding that project, that could be used for their core algorithms implementation. Besides that, the whole application must be build from scratch, to meet new requirements. I'm working now on data gathering services and user interface for experts modules. It is designed as web application, implemented in Java and using Spring framework.

2008-10-06

Good method of web frameworks comparison for programmers

If you are programmer and want to choose the web frameworks suitable for your project, one of the best ways of framework evaluation (not fastest) is writing simple prototype that uses concepts similar to your project requirements. Opinions of other experienced frameworks users also counts, but sometimes framework selection is based on personal preferences. Thanks to prototype code all framework sweet spots and "need to be done" areas are easily exposed. Prototyping gives also practical measure of framework impact on overall development productivity.

Last week I have done little research about new trends in Java web frameworks, and found very good and detailed frameworks comparison based on prototyping on a Peter Thomas blog.
Here are articles comparing Wicket framework to Spring MVC, JSF and GWT.
Good job Peter Thomas!

By the way, I have found many Wicket positives in his articles, that I give that framework a try in my next project requiring component based UI.

2008-09-29

Mature programming languages and internationalization

Have you ever tried to implement application using character encoding other than Latin 1? What is deal with that? If you are using modern development platforms like Java or .Net - it just works. Let's omit other problems caused by bad implementation of internationalization issues in framework/library. Multilingual application scenario is simple - use internal UTF character encoding, allow transcoding from external systems at the API level (I/O operations with text files, databases etc.) - and your application will be able to write messages in most standardized character sets including Russian and Chinese.

What about other popular programming languages? Take for example Python 2.5 - recent version that could be used in production environment. It supports UTF strings processing, and character transcoding- but be aware - there are glitches and unimplemented UTF features, causing bad UTF processing. To get it work you have to use (sometimes ugly) workarounds. Here is nice presentation about these issues. There is hope that developers from open source community will fix that till let's say version 3.0.
Ruby is in better situation- as a younger language it has more properly adressed internationalization issues at the design stage. I suspect there is still more work to do.

What about old work horse of web applications development- PHP in newest stable version 5.5.2. It came a long road, but still have problems caused by legacy of non integrated separated libraries. It has long list of options to set encoding like internal encoding, http input output encoding, and many more affecting single libraries.

So what about using mbstring module (multibyte string representation) , setting UTF as internal encoding and sticking to it. Situation is worse than in Python- many even simple string functions can't process multibyte strings in proper way. The Solution is to write own workarounds or use third party libraries like PHP utf8. Here is good list of PHP internationalization issues. Last week I have checked xml import support for old PHP application- it caused problems with Latin2 encoding. The reason was simple: The XML SAX parser supports only ISO-8859-1, UTF-8 and US-ASCII encodings.

Such low detail problems could potentially take a lot of precious project time. So if your next application will use character set other than Latin 1, you should consider good internationalization support by chosen development and production platform.

2008-07-15

The Java performance upgrades

Suns JVM (not to mention other JVM vendors) gains more and more in performance benchmarks. According to SPECjbb2005 benchmark data presented at Java One 2008, Java 6 get more than 100% speed prior to Java 5 at x64 platform. Such big gains were possible due to fact that applications and JVM were not so optimized to work at 64 bits. Many tests show that applications on x64 undeperformed to that on 32 bit platform.

For 32 bits JVM get smaller but still significant improvements. I felt that on my skin when switched from JVM 5.0 to newest JVM 6.0. Interactive applications work snappier now.

The direction of Java performance upgrades is in concurrency. To get good multi core processor utilization, new applications have to work in multi threaded way. If programmers won't write applications in the "new way", then maybe JVM and OS could better use multi-core as "back end". There is idea of implementing transparent internal concurrency for basic algorithms and data structures like collections or maps from Java libraries.

Latest JVM can raise desktop applications performance by two digits, but there is a lot of custom work for scalable server applications. Scalability still heavily depends on utilization of resources, memory in particular. It's still open field and solutions depend on application.

2008-07-08

Tools for static java code checking

Java language with its strong typing is well suitable for static code analysis.
There is variety of tools for early bugs and flaws detection through automated code checking. I mention three open source tools that any java programmer should give a try:
- PMD
- CheckStyle
- FindBugs

All tools have set of flaw detection rules. Every one has some strengths and weaknesses - all three are complementary to each other. I suggest you to run every of it and look at the different kind of flaws they explore. with default rules. It's possible of course to define own set of rules suitable for your needs. I've tried to install eclipse plugins for those tools - only PMD runs without problems. Maybe I should refresh my Eclipse 3.1 installation. PMD has a "copy and paste" duplication detection tool- but somehow it is not working with some characters in UTF-8 encoding. I hope it would be fixed - it's really useful tool.

So install code checkers - and view reports of your code. You can be surprised. It gives the opportunity to chop off the heads of some simple but nasty bugs.

2008-05-12

JavaOne 2008 - Java+You

Last week Sun organized JavaOne 2008 conference in San Francisco. I weren't on place, but there is lot of interesting information on conferrence web site.
There were tracks for every of Java technologies, applications in web, SOA and some new ideas introduced like JavaFX - new (?) rich interface and scripting platform.

I invite you to reading, and see what are proposals for Java future.

2008-02-25

Blending scripting languages in modern enterprise environment

Is your company using "enterprisey" technologies like Java or .NET? Do you want to use flexible scripting languages like Python or Ruby?
There are interesting possibilities for popular and "mature" programming languages like those above. Many popular languages has implementations that work under Java or .NET environment, like Jython, JRuby, IronPython, IronRuby and others. It's quite old thing but it still worth mentioning it. The main problem with such solutions is their maturity and completeness, so checking and quick research is needed before doing decision.

You can also find implementations of old veterans like COBOL and REXX for new platforms. There are also single platform languages that have cool features of scripting languages like Groovy or beanshell for JVM.

Additional languages are primarily used in configuration, defining custom and complex business rules, adding Domain Specific Language features etc. Word of warn - do not create local Babel Tower by multiplying number of existing languages in single project. But it's nice to have to have one scripting language blended into main project platform.

Other case is porting applications from scripting to target platform. Constraints are narrow - all used third party libraries have to work on both platforms, so additional work is needed often. Practical example - here is interesting tutorial how to deploy web.py python application under Jython and JVM.