[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XML as "passive data" (Re: The Browser Wars are

define browser wars
On Wednesday 23 October 2002 08:32, tblanchard@m... wrote:

> You know, I'd really like it if people would stop referring to those
> two evil twins as "Object Oriented" because, while they manage to fake
> a few features of OO, they aren't.
> Based on a couple of other comments like objects "hiding away data" I
> can see the reaction against compiler enforced encapsulation.  Its bad.
>   Pure and simple.  Public Protected Private is a menace to modern
> software development because


Another related issue is the way you can't add methods to existing classes. 
Say you write an algorithm to generate soundexes of strings, and to compare 
two strings for sounding alike. Since you can't modify java.lang.String, you 
have to make them, say, static methods in a class of your own.

"Ah!", I hear you shout. "I can subclass String to add my methods!"

But alas that doesn't help when you call an existing method that returns a 
String, since it'll return a standard java.lang.String, not your subclass. 
Even though your new class has no new fields, just a few extra methods, you 
can't cast from String to it (although Java could be extended to add this 
funtionality, I imagine).

One answer, which introduces some other complications, is something I 
referred to in another post - generic functions for methods. In that case, 
methods aren't declared 'in' classes, it's just done with overloading.

"object.method (foo,bar)" is just shorthand for "method (object, foo, bar)". 
If you define "boolean soundsLike (String a, String b)" then you can write 
"Alaric".soundsLike ("Anorak") to your heart's content. And you could define 
"boolean soundsLike (String a, javax.sound.sampled.Port b)" to compare a 
string to some audio, if you like, then trivially define the same function 
with the arguments swapped (for it is symmetrical) and another that compares 
two sampled sound sources for sounding similar.

This is real handy for implementing mathematical classes. Take the age old 
example of vectors, matrices, and scalars. Should the operation of 
multiplying a matrix by an integer go in the matrix class or the integer 
class, hmm?


A city is like a large, complex, rabbit
 - ARP


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.