VB.NET vs Java Comparison
Home Motivation: Updating the Comparison between Java and VB.NET

In the past six years two languages have emerged on the computer scene and have quickly risen to dominating positions in software development - those languages are Sun's Java and Microsoft's Visual Basic. Sure C and increasingly C++ are the languages of choice for major ISV-Independent Software Developers like Corel, IBM, Microsoft, Oracle, SAS, Semantic and others when building their bread and butter applications like Corel Draw or DB2 or Microsoft Office. Oldies but goody programming languages like Ada, Cobol, Fortran, Pascal, even RPG get refurbished with new GUI interfaces and visual programming IDEs just like Java and VB-Visual Basic. But what makes Java and Visual Basic compelling?

Visual programming and components are the advantages of both systems. Visual Basic was one of the first languages along with Paradox and Dbase designed to take advantage of GUI interfaces with visual programming in mind. You build the menus, forms and reports of a program by visual drag and drop operations. Then complete the coding by filling in the skeleton programs developed during prototyping of the programs interface. Coding VB pioneered the use of standard 3rd party components such as VBX and now ActiveX.. The developers of Java IDE-Interactive Development Environments (see Figure1) have carried this a step further with interaction wizards automatically generating the large portions of the Java code required for a system. And Visual Basic in slightly simplified form of VBA-Visual Basic for Applications has become the macro language for Windows applications. The result are two of the best RAD-Rapid Application Development programming languages available today.


But some major trends in program usage may obsolete all this. One critical trend is the exploding use of the Net where the browser becomes the interface of choice. A second trend is continuing migration to packaged software starting with the Office Suites but extending into every corner of work. Examples are document management systems; Web, mail and comprehensive messaging systems like Lotus Domino/Notes, Microsoft Exchange and Novell's GroupWise; hundreds of financial and accounting packages and most tellingly, ERP and other packaged suites which form the backbone for complete organizational systems. The question is - so what if Java and VB are emerging as the top of the programming heap.Who needs to program when packaged programs deliver the goods with increasing ease of use and comprehensive coverage ? Is programming as we have known it for the past 30-40 years going to become reserved to a small group of geek-like idiot savantes?

Yes and know. The crucial fact to know is that programming is changing quite dramatically. There are three major trends which are changing why and how programming is done.

First Two Trends in Programming

First, the last remaining heights of programming complexity are being successfully scaled right now. The Internet and web development have meant that toughest programming problem - distributed processing over WAN-Wide Area Networks is finally falling out of the realm of high-risk, specialist-only development into a demanding but doable task. Microsoft's VP of Development, David Vaskevitch calls distributed development, the last hurdle. Sure such challenges such as AI-artificial intelligence, multithreaded parallel programming, and adaptive programming - automated code that detects and then fixes problems and bugs will remain as major challenges. But n-tier(multiple active servers and programs), heterogeneous(acting simultaneously on many different hardware, operating systems and database platforms) and distributed (acting in concert by communicating over one or more networks) is not just hard to describe but also has been, until open Internet-inspired programming tools and routines including Java became available - darn hard to do.

The second major trend is OO-Object Oriented programming. OO programming does three things for programming. It brings a new emphasis on reliable coding by deliberately hiding data and code except through controlled access points. OO also has built in strong typing and reference checking. In effect some of the flexibility to dynamically change code or data usage is sacrificed to make it work more reliably in OO languages like Java, C++, Smalltalk, etc. Second, program development is speeded up and made more reliable by OO's inheritance. Unlike subroutine re-use, inheritance goes further by specifing exactly what data and routines will be changed or added to when borrowing and re-using classes (think of classes as code modules with data attached). Reuse of classes through inheritance is remarkably clever and has been used for quite some time by programmers in an ad-hoc fashion. OO just standardizes and automates the process. The net result is that coding in Java is found to be 30-70% faster than in its near cousin, C.

The third innovation that OO languages bring to programming is polymorphism and dynamic linking. This is the ability of an OO language to allow for the same method or subroutine to carry very different parameters and the runtime system will invoke the right subroutine including a possible error recovery routine. For example, ScreenDraw(Circle, xx, yy) and ScreenDraw(Hexagon, xx, yy) dynamically invokes automatically two different ScreenDraw routines depending on the parameter passed. This may seem trivial but a great programming house of cards may come crashing down trying to use ad-hoc methods to solve this problem.

It is important to note that Java and Visual Basic have taken two profoundly different approaches to OO programming. From the start, Java was designed as an OO language. You cannot write a Java program without using OO techniques. Visual Basic has taken the slowly but surely approach. So OO techniques and methods have been slowly incorporated into the language. Polymorphism and dynamic linking followed by encapsulation and hiding were added in VB3 through VB5. Inheritance may be added with VB7 or VB8 (or may be a part of a new Microsoft language code-named Cool). The bottom line is that Visual Basic is a hybrid OO language-for better, for worse. Many timberlines worth of paper have been sacrificed in arguments on whether a pure OO language like Java or Smalltalk is superior to a hybrid like C++ or VB. We invite you to decide for yourself in our upcoming tutorials on VB and Java.

 
Figure 1 -Java IDE

Third Major Trend:Visual Programming and Components

As noted previously, visual programming and the use of components is one of the pioneering strengths of Java and Visual Basic. OO methods make GUI and general program development using components even easier to do. But these techniques have been spawned by a two very real needs. N-tier distributed processing has brought two real benefits - isolated islands of information and inefficient use of data and program resources are being eliminated. With intranets and online processing, users can reach into every nook and cranny of an organization to get at the data and information they need to solve a problem. But the cost as noted is the much greater complexity of distributed programs - even ones that use web browser front ends. Hence the move to outsourcing and/or packaged programs.

However a second pressing need is to develop software so much faster. For over 30 years two of the major complaints against IT departments has been that systems cannot be developed fast enough (the 2-3 year backlog of IT projects) and then when delivered changes and updates to programs cannot be done on a timely basis. But with the huge repository of computer systems built up over the last 30 years and with the availability of complete backbone office systems from major ERP vendors, programming has been turned upside down. Now IT staffs are being told "No" about re-inventing the IT wheel - it takes too long and is fraught with high risk of complete failure (50% failure rate for large client/server projects according to the Standish Reports). Reuse and interfacing to new ERP backbones as well as legacy systems are the new marching orders for IT development teams at small as well as large businesses. In effect, all programming has become maintenance programming. Very few programs are built from scratch. Programs have to interface with legacy databases or web systems. Many have to link to or just become a customized user called procedure of some ERP or other packaged program. What better way to create these component systems ? Bingo - visual programming and component development with Java and Visual Basic.

The Essential Advantages of Java and Visual Basic

Without a doubt one of the essential advantages of both Java and Visual Basic is that programmers can develop a wide range of programs so much faster than other language. So called 4GLs( fourth generation languages) like Focus, PowerBuilder and Uniface once held an advantage in ease and speed of development (but at the cost of poor runtime performance). But 3GL-3rd Generation Languages and especially Java and Visual Basic with their visual programming, components and use of clever wizards or third party design tools have matched if not surpassed 4GL for speed of development and have superior runtime performance. Relative to other 3GLs such as Ada, C/C++, Cobol, Fortran, Pascal and others; Java and Visual Basic have three compelling advantages:

-new, uniform and comprehensive APIs for every aspective of web, client/server, and n-tier programming;
-several modes of deployement including .EXEs, components, servlets and applets;
-superior visual programming development environs with many 3rd party suppliers of tools and components.

And the runtime performance of both Java and Visual Basic have steadily improved to the point that they can approach within 10-30% of the fastest programs developed in C/C++, Cobol, Fortran or Pascal. Finally, Java in particular but also Visual Basic can be used to deliver web programs.

On the Web, Java and Visual Basic can be used as servlets - web applications sitting on a server and sending down dynamically created HTML and scripts to your browser. Java with its great cross platform portability can also be used to develop applets that run directly on any PC or client browser. With new ADSL and cable modems running 20 times faster than current 56K modems, look for even more exciting (and secure) Java applets coming to your web browser. In sum, both Java and Visual Basic have come to the fore as programming languages because they were built to fit the mold for new system development - rapid development through visual IDEs and comprehensive SDK/APIs to meet all the latest programming requirements, especially the Web. Perhaps even more important are OO methods and componentized code which can be stand alone or linked to existing programs and data sources in a variety of ways - servlet, downstream application, application server or web applet. It is this versatility in deployment that makes both languages so attractive.

Over the next 4-5 years the proliferation in programming languages should subside. This situation has persisted so long as client/server and n-tier processing needs were not being well served. But the current balance of comprehensive APIs, rapid development for a variety of deployment modes and competitive runtime performance make Java and Visual Basic compelling choices for many business applications. So expect programming languages to gravitate towards the specialties that they serve well: Prolog and some LISP variants for AI-Artificial Intelligence, Fortran for intensive engineering/numeric analysis systems; C/C++ for commercial software development, Cobol for transaction processing and most notably Java and Visual Basic leading the way on the new web and component based systems that acts as links and linchpins among backoffice applications.

Java and Visual Basic Comparison

On the surface Java and Visual Basic share some compelling common characteristics(see Table 1). Both are comparatively easy to learn and fast to develop with due to appoachibility - that means it is comparatively easy to get started and develop useful small programs in each language. In addition both have very comprehensive APIs with the latest in web and n-tier developments. Indeed if you cant find it directly in the language, both have a wealth of 3rd party tools, utlities and components available to complete their effectiveness. Finally, both languages have the critical advanatge of many modes of deployment. Java or Visual Basic code can be standalone, bolted on as components of a larger system, or act as server-side linchpins between legacy systems, data sources, and PC and/or web browser clients. This is why Java and Visual Basic should emerge as the dominant programming languages over the next 5-10 years.

However there are three major differences between the two languages. First, as noted previously, Java has been built from the ground up as an object oriented language while Visual Basic is gradually acquiring complete OO capabilities. Second, Java has a number of security and reliability features (sandlot security model, strong typing, simplified memory model, integrity checking, etc) built right into its core design. But perhaps the critical difference is that Java is cross platform - running on just about any combination of hardware and operating system while Visual Basic is master of Windows. VB runs on Win 9x, Win/NT, Windows 2000, Win/CE (partly) and Alpha versions of Win/NT (partly). However, Visual Basic no longer supports the Windows 3.x platform while Java does. On the other hand, Visual Basic has become, through VBA-Visual Basic for Applications, the scripting language for Windows applications. This is important because more systems will be built directly into key applications such as AutoCAD, Excel, Notes, Project, SAS, SAP, Word and hundreds of other major Windows programs.

If we compare Java and Visual Basic in detail, there are 4 major criteria by which we can evaluate the two languages. The first is ease of development. It is here Visual Basic would appear to have an advantage - after all it is Basic. However, like Java, VB has grown and has huge APIs. More telling, in order to accomodate new OO and other functionality, VB has had to expand its basic syntax by dozens of commands. Even worse the documentation for VB has deteriorated with recent releases. Explanations of commands are spread over 3 major manuals whose printed versions cost over $100 extra. Quick examples of how to use VB's numerous commands and functions are declining even in the electronic documentation. Java is only slightly better. Fortunately, Java's huge API is organized into comprehensive references. But like VB users have to look to 3rd parties for documentation with quick examples of Java code. The fundamental problem is this - although both languages have worked hard to make themselves easy to approach and learn, the sheer size and scope of their functionality make both languages difficult to thoroughly master.

Stability and Reliability

Traditionally, programming languages have had very good records for stability and reliability for both the development systems and the program code they produce. However, in the rush to get newest versions and features out the door, both Java and Visual Basic let down developers. Part of this may be inevitable - rapid changes in web and programming standards mean that some code and APIs gets obsoleted - as for example when many AWT classes were quickly superseded by the new event-listener classes and Swing GUI components and interfaces. In VB a similar pattern has seen two or three data access methods proliferate into over a dozen. Unfortunately, performance, reliability, and functionality trade-offs among the competing access methods make choosing an approach in VB, even with the new OLE-DB standard, a daunting task. But perhaps the worst problem is the lacunae of bugs in both languages.

To an extent bugs come with rapid change and huge APIs. But for the last 3 versions of VB, users have had to wait for two or even three service packs to be able to get reliable code for some new features either in the development system or in the language. See the editorial in Aprill 1999 Visual Basic Programmer's Journal "FiveThings You Hate about VB6" for the latest episode on VB bugs. Yes, most of the old code works. Yes, most of the bugs are clustered around new features. No, most users do not want to develop with what is in effect beta code and features. Want to kill a function or feature in a language - make it buggy so developers have to spend extra hours and days proving that the bug is in the language not their code.

Java is somewhat better. But in the rush to get various releases of JDK 1.x out the door serious bugs have crept into some of the new APIs. Also compatibility of the GUI routines on various OS platforms has lead to pungent humor - Java is the language you get to write once and debug everywhere. Now it is important to point out that these are not catastrophic bugs by any means. Ninety five percent or more of the functionality of both languages is rock solid. However when you are developing using some of the 5 percent of features that are a bug infested swamp (the lacunae), you are not a happy camper - because your boss, to kill the bug, may transfer, demote or fire you.

In their defense, both Microsoft and Sun have rededicated themselves to producing more reliable code. Microsoft, for example, has made service packs easier to access and more quickly available. Sun has released later versions of the1.x JDK in smaller and more reliable chunks while delaying key features like some EJBs and Hotspot technology for many months. But there is a lot at stake. Other languages like C/C++ or ObjectPascal/Delphi or the new versions of Cobol and PowerBuilder have a better record for reliability. In effect, by delivering buggy code and/or development systems Java and Visual Basic may jeopardize their own critical advantage - speed of development.


Speed Of Development: The Ultimate Criteria ?

VB is famous for making tough Windows programming very approachable. And the text editor and debugger in Visual Basic's IDE are still the best in the business for client side development. But Java is no slouch either. Java vendors have produced nearly comparable IDEs and have gone ahead of VB in the sophistication of their wizards and auto-gen capabilities. Borland's JBuilder, IBM's Visual Age and Symantec's Visual Cafe make using the huge Java API much more manageable with their Interaction Wizards.

Table 1
Java vs Visual Basic - A Comparison

Characteristic

Java

Visual Basic

Ease of Development Very good visual development environs, lots of wizards and help
No. of syntax elements, routines 50 commands, 1000s of routines 300+ commands, 1000s of routines
Approachability +JVM/SDK free & easily available
+text editor & browser to run
-OO design takes some extra effort
-even bigger API to master
+do useful work quite quickly
+ VBA is available in many products
-Learning edition costs $100
-huge API to master
Documentation =mixed quality of written docs
+solid electronic reference HTML
-poor written docs; $extra, disorganized
-electronic docs $extra; few/poor examples
Availability of books, tutorials, courses etc =lots of books and tutorials
=big in college and universities
+can do self-training easily
=lots of books and tutorials
+MS and other training courses
=mixed adoption in colleges/universities
Reliability and stability Constant and rapid change is drawback to both languages
Major weaknesses -numerous new classes/APIs
-rapidly deprecating classes
-huge API, bigger than VB's
-numerous new routines/syntax
-just moving to OO technology
-always bugs in new features
-a mess in data access routines
Robustness +cleaner try/exception handling & event listener models
+runtime type, bounds checking
+restricted memory manipulation
+automatic syntax checker in editor
+direct use of Windows APIs
-opened up to direct memory change
Security ++Major advantage is sandlot model -ActiveX still problematic
Overall Reliability + reasonably reliable at start
-bugs creep in early 1.1 SDK
-GUI compatibility problems
+major ISVs likeOracle, IBM, Sun, Sybase, etc committed to it
+six versions to clear bugs
-still islands of instability/bugs
-hard to find good advice on what
to avoid or how to fix some bugs
+the favored tool at Microsoft
Speed of Development Very good native & 3rd party tools
Editor -depends on IDE, some are weak +constantly sets the standard
Visual development =IDEs are quite good =IDE is quite good
Debugging/Testing =client side debugging is good
=good but mixed on server debugging
=good profiling and test tools
++best debugger on client by far
=improving on server side
=some great 3rd party test tools
Project size +medium scale with DBMS
+server or large-scale n-tier/web
+small quick and dirty
+medium scale with lots of GUI
Other +Advantage is more secure and broad reaching components like JavaBeans, EJBs, servlets, etc.
=3rd party tools, libraries, etc.
+Big advantage is huge army of developers
=3rd party tools, libraries, etc.
Runtime options Both languages give away 10-30% speed deficit to C/C++
Cross platform ++Major advantage -could be negated if VB emits bytecode
Deployment options =.exes amd bytecode
=Beans and EJB components
=web servlets
+browser applets
=.exes and p-code
=ActiveX components
=web servlets
Speed +advantage to Java on server
+byte code optimizers, trusted compiled apps just getting used
+advantage to VB on client
Popularity Two most popular programming languages
Ace in the hole JINI VBA-macro language for Windows
Perhaps because there have been so many bugs and reliability problems, both Java and Visual Basic have very solid debuggers and 3rd party testing tools. Visual Basic is still the only major language that allows users to stop a program during debugging, change one or more lines of code and, in most cases, immediately resume running the program either from where it was halted or from a user chosen new start point. Despite the fact that Java has sophisticated JIT-Just In Time compilers and very fast interpreters, Java IDEs have only a pale approximation of this immediate restart debugging capability. However, on the profiling and testing side both Java and Visual Basic have the support of some excellent testing tools. But perhaps the most compelling reason for speed of development is paradoxically the huge APIs.

Given short development time and complex coding requirements, re-use of tried and tested (hence the concern about bugs)Java or Visual Basic API code can and does cut major chunks out of development time. When time to market has become the critical success factor for most businesses, speed and reliability of software developments that drive market winning innovations also come to the fore. The whole idea behind OO is structured inheritance and re-use of code. What Java and Visual Basic bring to the table is not only re-use but also the ability to deliver code in deployment packages ( excutables, components, servlets and applets) suited to a wide range of needs. Yet Java and Visual Basic give away only a hit of 0- 40% in performance speed relative to the fastest C, C++, Fortran or Pascal programs. In sum it is the combination of rapid application development and broad range of deployment options that have been instrumental in vaulting Java and Visual Basic to pre-eminence among programming languages.

When To Use

It is obvious from TABLE 1 that there are trade off between the two languages. In the coming months, The Computer Paper shall feature tutorials on both Visual Basic and Java so if you haven't already you will get to see some of the coding pros and cons in detail.. But right now you may need to decide which language to use and when. For applications on the server side, especially Web applications - Java has a distinct advantage simply because it runs on more of the enterprise class operating systems. Also major Web application server vendors such as BEA, Bluestone, IBM, Oracle, Sun and others have placed Java development ahead of even C/C++. Visual Basic has a server niche in all-Windows shops particularly when used in conjunction with Visual InterDev and/or Front Page for to develop .ASP based applications.

For PC based applications, where Windows dominates the desktop, the situation is reversed. Because VB is slowly but surely becoming the scripting language for Windows, it is easier to bolt VB through COM and other components onto existing commercial or homegrown Windows apps. If on the other hand your delivery model is to use the Net and a browser interface you may want to give Java a careful look. The new Swing classes make Java GUI operations very fast - download a free copy of Together/J from www.oi.com to see exactly how fast pure Java can be on a PC.

In fact many analysts argue that with steady improvements, Java and Visual Basic will be matching C/C++ for speed of execution. Given that many Java applications do not take advantage of 2nd generation byte code optimizers, rarely use the new breed of Java compilers (the trade-off is less portable code vs a 20-60% speed improvement) and are still waiting for the speed boost of Sun's dynamic Hotspot Technology - Java has plenty of performance tuning capacity. In contrast, Visual Basic did show steady improvements to the point of reaching within 10-20% of equivalent C/C++ code in version 5. However, version 6 saw the speed advantage slip by 5-15% in a number of categories; most notably in database access. But analysts argue that with steady compiler improvements still to come along with CPU chip performance continually improving also, both Java and Visual Basic will be taking on more enterprise programming tasks over the next five to ten years.

Conclusion

If you got all the way through to here in this article, you undoubtedly picked up its tenor - great admiration of Java and Visual Basic mixed with ample frustration. Great programming languages like Java and Visual Basic should not be dogged by poor documentation or lacunae of reliability and bug problems- especially when those small but significant percentage of bugs detract from the languages' greatest strength - speed of development. Visual Basic, in particular, after being such a pioneer in rapid application development, is disappointing its constituency yet again with another version of VB whose new features are buggy (see Confessions of a VB Beta Tester, p128 Aprill 1999 issue of Visual Basic Programmer's Journal). However, the proof is in the programming. Fortunately, both languages are readily available. Go to www.sun.com/java and download the latest JDK which includes javac for compiling and java for running Java programs - just add your favorite text editor (notepad.exe will do). And VB is available in a learning edition for less than $100. Or look for VBA in Office 97 and over 80 other programs like AutoCAD, the new Corel Draw, Peachtree Accounting, System Architect, etc. VBA uses most of the VB interface but does lack some of the more advanced component and server side development features. Try them both

Jacques Surveyer loves to chat programming at www.inforamp.net/~jbsurv

Resources:

Beginning Visual Basic, Peter Wright - WROX, $56 - beginning with no assumption of programming background
Visual Basic 6 Unleashed, Rob Thayer - Sams $58 - intermediate with comprehensive coverage of features
Visual Basic 6 Black Book, Holzner - Coriolis - gradually advanced coverage into components, web, database, etc
CoreJava 1.2, Horstmann & Cornell - Prentice Hall, $57 - intermediate with great sample programs and tutorials
The Complete Java Training Course, Dietel and Dietel, Prentice Hall $150 - Text and training CD are solid intro into Java
Algorithms in Java, Sedgewick, Addison Wesley, $60 - Top notch algorithms shown in Java code.
 the nature of programming model:

top-down,procedural model-
modular functions and procedures determine the order of processing-
GUI interface is character mode, menu-driven, simple windowing

event driven, GUI model -

asynchronous, message driven

Programming Tasks & Styles

Characteristics

Batch procedural

GUI-event

Web, Asynchronous

Common features Output to printer and/or files, database for data and state of system
User interaction

low, in batch files

Multi-windows

Browser, multi-windows

Simultaneous users

one

one to many

many up to thousands

Response time

irrelevant

3 to < 1 sec

days to 1 sec

External data sources

Few, imported

Varies, both

Often, both

Resume processing

Some, scheduled

Some,savespace

Frequent, all states

Security, privacy

Easy, closed system

Varies

Major concern

Complexity, difficulty

Easiest to program

medium to high difficulty

simple to extremely hard

Likely you will program

some-reports,overnights

high- all sorts

some- simple read only

 
Top of Page  Tutorials Home