advertisement
javaboutique
Search Tips
Articles  |   Tutorials  |   Reviews  |   Tools  |   by Category  |   by Date  |   by Name  |   Submit  |   Source  |   Forums  |  
javaboutique
Browse DevX


Partners & Affiliates











advertisement

Review: Ruby on Rails vs. Java: An Expert Roundtable:

Dynamic Typing vs. Static Typing

BB: Ruby is a dynamically-typed language. But static-type checking is a good thing. Isn't it?

Justin: A solid suite of unit tests is every bit as good, if not better than, static-type checking. Because all you want in type checking is confidence that you haven't made the basic mistakes. A good set of unit tests will provide that for you.

BB: But static-type checking is so well defined. Compared to static-type checking, unit testing is an art.

Neal: Static-type checking is very safe. But when you ride a bike, you use only two tires. You don't use training wheels even though training wheels are clearly safer. Why not use training wheels when you ride a bicycle?

BB: Training wheels slow you down.

Neal: And static-typing slows you down.

Stuart: Also, the domains in the situations we are modeling are dynamic, not static. As you build systems, they tend to grow, not shrink. Objects get new subclasses, new fields, new capabilities. But also, you gain a better understanding of your domain models. So the domain model, in an abstract sense, may have been there all along, but your understanding of what it should look like changes over time. Being able to evolve and make those changes are easier in a more dynamic language.

The other point that is really important, is that casting Java as static and these other languages as dynamic is really inappropriate. I just think they take very different paths to being dynamic. The path to being dynamic in languages like Ruby and Python is "this is an apple because I say it's an apple." If I change my mind later and say it's an orange, or say it's bigger or it has a worm in it, those things are very easy to say in the language. I add a method to an instance at run time.

In Java, you have those same things, but you do them at a level of architecture that is hidden from the average application developer. You do it with reflection, class loading, and with domain languages, like JSP—domain languages that add more dynamic capabilities. So, the question is not: "Are we going to be dynamic or not?" We're absolutely going to be dynamic. The question is: "What languages and idioms are going to allow us to be dynamic more quickly?"

With Java, we model changing domain scenarios over time by swapping classes out at run time with class loading. In many cases, that stuff is down inside the container stack and application developers don't look at it. Depending on your application and your needs, that may be a good thing or a bad thing. For the kinds of systems I've worked on in the past couple of years, it was very important for that kind of information and deployment thinking to be front and center for everyone on the team. It didn't help us to have a J2EE stack in a class loading-type scenario, because we were heavily customizing those kinds of things anyway. If a container gives you, out-of-the-box, exactly what you need, you may not need to run out and get your dynamic capabilities in some other way. But I think it's a misplaced argument to pretend that anyone models the world with static typing as it appears in languages like C++ or Java.

Justin: If you look at some systems, like Spring or Hibernate, you see the synthesis of dynamic proxies at run time based on interfaces or base classes. You tell the framework: "I am going to need extra work done on my behalf on this instance or this class of instances at runtime." This extra work isn't in the compiled version of the class. In languages like Ruby and Python, adding extra work is a language feature, not a framework.

BB: What about AspectJ?

Justin: AspectJ, AspectWerkz or any of the AOP frameworks, are bolted onto Java. Aspect-oriented programming isn't a natural part of the language but it's still a capability of the platform. Whereas in a dynamic language like Ruby or Python, the capability is baked into the language to walk up to any instance (or any suite of instances) and say "change the way you act, right now, but revert later."

BB: Is the trend toward dynamic-typing just a swing of the pendulum? Dynamically-typed languages, statically-typed languages, type safely, type unsafely...the community's prevailing opinion swings back and forth.

Neal: Smalltalk—which is a dynamic language—didn't do very well because we didn't have a sufficiently strong emphasis on unit testing. Now, we are seeing the pendulum swing back the other way. We're realizing that unit testing is the only way you can get anywhere close to proving the validity of a piece of software. You can't mathematically prove validity. So now we're swinging back, saying that dynamic languages are okay. You don't get into trouble with a dynamically-typed language if you have a good suite of unit tests. So testing has become vitally important in all software development. It just happens that it's easier to write code in dynamic languages. With a dynamic language, testing is your safety net.

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.

 Avaya DevConnect Center
 Service Component Architecture/Service Data Objects Solution Center
 Intel Go Parallel Portal
 Internet.com eBook Library
 IBM Software Construction Toolbox
 Microsoft RIA Development Center
 Destination .NET
XML error: not well-formed (invalid token) at line 53
advertisement
Receive Articles via our XML/RSS feed
Receive Articles via our XML/RSS feed

JavaBytes
Internet Cyclone
This powerful, easy-to-use, internet optimizer is for Windows 95, 98, ME, NT, 2000 and XP. It's designed to automatically optimize your Windows settings, boosting your Internet connection up to 200%.

Cisco Romancing Linux Developers
MobiUI Snares ActionEngine in iPhone/Mobile Push
Windows 7: It's Not Just a Codename Anymore
Microsoft Shines Silverlight on Eclipse
OpenOffice Hits 3.0: Can It Challenge Microsoft?
Get Ready for Microsoft's 'Oslo' Modeling Tool
Latest Linux Hits Networking Flaws
Metasploit 3.2 Offers More 'Evil Deeds'
'Thank You Apple. Seriously.'
The Buzz: BlackBerry App Store Seen Next

Intel Sees Fewer Power Cords in Your Future
F# 101
Use Explicit Conversion Functions to Avert Reckless Implicit Conversions
Polyglot Programming: Building Solutions by Composing Languages
Automated testing for .NET by Ben Hall
"Supply Chain" SOA with SKOS
Service Component Architecture in Real Life
C++Ox: The Dawning of a New Standard
Getting Started with Virtualization
Master Complex Builds with MSBuild

Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Microsoft Article: BitLocker Encryption on Windows Server 2008
Go Parallel Article: Intel Thread Checker, Meet 20 Million LOC
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
Avaya Article: Call Control XML - Powerful, Standards-Based Call Control
Tripwire Whitepaper: Seven Practical Steps to Mitigate Virtualization Security Risks
Internet.com eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Go Parallel Video: Intel(R) Threading Building Blocks: A New Method for Threading in C++
HP Video: Is Your Data Center Ready for a Real World Disaster?
Microsoft Partner Portal Video: Microsoft Gold Certified Partners Build Successful Practices
HP On Demand Webcast: Virtualization in Action
Go Parallel Video: Performance and Threading Tools for Game Developers
Rackspace Hosting Center: Customer Videos
Intel vPro Developer Virtual Bootcamp
HP Disaster-Proof Solutions eSeminar
HP On Demand Webcast: Discover the Benefits of Virtualization
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Amyuni Download: PDF & XPS Engine for Your .NET and ActiveX Applications
Microsoft Download: Silverlight 2 Software Development Kit Beta 2
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt
Iron Speed Designer Application Generator
Microsoft Download: Silverlight 2 Beta 2 Runtime
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
IBM IT Innovation Article: Green Servers Provide a Competitive Advantage
Microsoft Article: Expression Web 2 for PHP Developers--Simplify Your PHP Applications
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES