- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Yes, well what do you expect? WebLogic is a bloated, overprice peice of crap after all...
Admin
1. No, HashMap doesn't have any. Nor is it an abstraction of anything. It is an implementation of Map, whch in turn is an abstraction of "a bunch of things with different labels without any particular order". That's why you should _never_ use HashMap in your designs.
2. If you're displaying a Mandelbrot set, nothing can be more real than imaginary numbers However, you shouldn't use imaginary numbers just because it's a convenient way to store two doubles. See?
Admin
Malkovich Malkovich, Malkovich Malkovich Malkovich. Malkovich Malkovich Malkovich, Malkovich, Malkovich Malkovich.
Malkovich?
Admin
It certainly is. IIS is far superior!!!!!
Shame as I had high hopes for weblogic, but it seemed to take forever to install and ground to a halt if more than 2 people connected. This post provides some insight into why. I think Java had a lot to answer for tho in terms of performance. And also, lets not forget, the yanks have got loads to answer for!!!
Admin
Did you mean
I Object, because life is contradictory?
Admin
Admin
How about a "breaks" keyword?
public class MyParent implements Serializable { ... }
public class MyChild extends MyParent breaks Serializable { ... }
Admin
A jpeg saved as a GIF.
[image]Now there's a WTF.
Just for good measure, I saved it as jpeg again.
Admin
Admin
1. No, HashMap doesn't have any. Nor is it an abstraction of anything. It is an implementation of Map, whch in turn is an abstraction of "a bunch of things with different labels without any particular order". That's why you should never use HashMap in your designs.
Eh? Which part of that was the reason for not using hashmaps?
a) It is an implementation of Map
java.lang.object
java.util.AbstractMap
java.util.HashMap
It is a concrete subclass of the AbstractMap class, which is the abstract superclass of several Map classes. Not exactly the best reason not to use it...
b) it is [...]an abstraction of "a bunch of things with different labels without any particular order"
Which is the exact definition of a Dictionary in most other languages. If you want some order imposed, you'd simply ask for the list of keys and iterate through them, accessing the value at each i the your Dictionary
Now there are gotchas associated with this class, e.g it is unsynchronised and it can contain nulls, but you don't mention them.
So what are your reasons for not using HashMaps?
Admin
Simple - just use .NET - java is well past its sell by date. Hashmaps are depricated these days as the .NET framework provides objects more fit for purpose.
Admin
Maybe 'transient' would have helped here?
Admin
Yeah. Kind of the same like writing a C compiler in C, hilarious, hahahah ... oh, wait ...
Admin
Looks like a great source for a Doctoral Thesis !
Admin
I forgot to mention the Object class also implements this beautifull interface:
<font color="#0000ff">public interface <font color="#000000">IObject</font>
{
string Name {get;set;}
}</font>
and for those curious of whats inside the brackets, I can´t disclose more, but this I cant resist
<font color="#0000ff">
public override bool Equals(object item)
{return Equals(this, item);}
</font>
Admin
Ok, now I actually need to know - if you can, please post :)
captcha == "wtf"
Admin
Sorry - posted before seeing your subsequent post
Admin
Not all that far off from a useful mechanism for restricting access to an object. See http://java.sun.com/j2se/1.5/docs/api/javax/crypto/SealedObject.html for an example. Of course, this code in particular is a WTF, wrappers are not a completely useless concept.
Admin
Or even better, they don't. They hide the existence of the composited class entirely.
I keep thinking the lack of a setObject() is important here. Maybe in some way this was useful as an immutable reference. But I don't think so.
captcha=captcha (!)
Admin
Belive me, there is a WTF for every 10 lines of code here.
To get and idea of what I am talking about, try to imagine all the recomended practices from microsoft, oracle, borland... even though they deviate slightly between those vendores, they all kinda head the same direction, then imagine a place where they do everything in the direct oposite direction of every pattern and practice ever created - this place exists, I work there.
Procedures are forbiden, since they are without a doubt slower than raw SQL calls concatenated using stringbuilder right in the middle of the cursed classes that inherit the infamous EnterpriseCompanyNameSpace.EnterpriseSales.EnterpriseProductLine.ProductExtensileName.Object
Mind you, the sql syntax has to be "database neutral" and work in SQL and Oracle, so things like NLV just can´t be done, you have to get the whole table and process the NVL with if (datarow["field"] == DBNull.Value) datarow["field"] = whatever. Which is usually "fine", except that if you wanted to use that as a criteria.
If I was Bill Gates and knew my tools were being used this way, I'd press that one button on my desktop that wipes out all the copies of my product from existance. Either people are gonna use it right or no one is gonna play. (If he doesn´t have that button he is just plain stupid anyways)
As for objectwrappers, the sufix Wrapper seems to make anything look OOP level 9 compliant and enterprise ready. Whenever you want to impress someone, just name your classes with cool names, in a nested namespace structure, it will automatically look well organized.
%Java Random Error Message% %Random Error Position%
-----------------------------------------------------------V
- Programming Newsgroups are hopeless. I am sorry but every question I read sounds like
"I’ve found a space shuttle on my backyard; tried to launch, but it didn’t work, can
someone tell me why?"
I’ve tried using SetWindowLongPtr but it seems to always return 0
Admin
Fixed.
Admin
Ah, like public class MyWTF extends System breaks Runtime { ... } ?
Admin
There are actually valid reasons to do this...none which are apparent here but maybe they did this so that they could add functionality later.
The big question is why do you have to instantiate an object first before creating an ObjectWrapper...the wrapper should be able to create the object itself if it wants to. Plus no setObject(). Plus poor name for a class...it should be called FreakinSweetObject.
Need more info on this one
Admin
In Cocoa/Obj-C environments, its possible to "class pose", i.e. make a class pose as another class. In that case you could pose a fake Object class as the real Object class, and the runtime would swap out the real Object for your implementation, and then all objects created subsequently would derive from it. THAT would be a cool WTF.
Admin
When Liskov (http://en.wikipedia.org/wiki/Barbara_Liskov) dies, she will need to turn over in her grave rapidly to make up for all the lost time.
Admin
Just show me where have I written "do not use HashMaps" and I'll tell you.
You seem to miss my point and it's not even a near miss. In the design phase you start from specific (the problem to be solved by your application) and through steps of generalization you try to build an abstract model that fits the problem. This phase is called design. Definitely no HashMaps here. Then you head back towards the specific, build your code and use plenty of HashMaps in the process. This phase is called implementation.
And don't mess up implementation with subclassing, dictionary (which normally should mean an ordered set of key-value pairs) with map (an unordered version of dictionary). (I know, the guys at Sun did mess the latter up but still, you would be surprised if you had to look up words in your dictionary by calculating their hash code first.)
Admin
Admin
I inherited a system that used lots of Java libraries (from other groups) that were rife with final classes. Without the ability to extend those objects, it was decided to wrap them:
Admin
Or perhaps they merely wanted to define a set of operations that all the company's objects would be guaranteed to support (with a default implementation). This isn't a matter of "Enterprisey;" I'm sure you can think of some things you can say about or operations you could perform upon your objects besides hashCode, toString and getClass(). Maybe you want to build logging (or testing) into everything. Maybe you want separate toString methods for internal and external use. Maybe you want a toVisualization() method that takes the whole concept of a toString to the next level, or you want some indicator of an object's position in a global object graph.
Or maybe you just want the flexibility to add one or more of these in the future (without having to mod your entire system to do this).
Calling it Object should really be the only problem here. It's bound to cause confusion, namespace collision and in some languages/compilers/VMs might not even be legal. But honestly? If what the class IS is a generic Object in a given namespace, calling it Object is perfectly arguable, if not reasonable.
Admin
I actually considered code like this once before.
There was a class created by another company that forced me to write code like this:
object1.com.company_name.object_I_want.method()
Where object1 contains only com
com contains only company_name
Rather than write out their company's name a thousand times throughout my code I considered using the objectWrapper.
I'd rather have a 10 line comment giving credit to the company that created the class at the top of my code than having only the company name listed 10,000 times though out my code.
Admin
Sure they can!
public class TestClass {
private String memberVariable;
public void doSomething() {
Comparator c = new Comparator() {
public int compare(Object arg0, Object arg1) {
TestClass.this.memberVariable = "b";
return 0;
};
// Do something with c
}
}
Admin
"Pointers"?. A pointer is not a pointer without pointer arithmetics ... so ... that's not a hack to get a pointer. It could be a hack to get a reference ... which already exists in java ... WTF ...
Admin
<font color="#0000ff">public class <font color="#000000">Object </font>: System.Object
{
</font> <font color="#0000ff"><font color="#006400"></font>}</font>
Admin
Admin
And where, in the real world, is a Map "a bunch of things with different labels without any particular order"?
I think that, in the real world, imaginary is the exact opposite of real, isn't it?
Admin
The best way to save space is to store something outside of reality.
Admin
Mmmm... Decorator Pattern, my favorite. http://en.wikipedia.org/wiki/Decorator_pattern
Though the most powerful and memorable implementations often go beyond the scope of mere "code" for purposes of stealing passwords. Fake Login Screen routed to Real Login Screen, Fake ATM literally on top of a real ATM, Key Sniffer, Fake Web Page with redirect to real web page.
Wonder if they were planning on subclassing the object wrapper....
Admin
Sadly, wrappers like this get written all the time. Worst, the authors call them 'implementation' as in 'I implemented a networking class' by wrapping the Socket class. Even worst, the wrappers have bugs and are restrictive since the 'implementors' cannot be bothered with wrapping all the features.
Admin
Thanks for the idea: newObjectWrapper("morons");
We have incorporated this into our corporate library:
<pre>
public class ObjectWrapper extends Object
{
private Object object;
public ObjectWrapper()
{
this(new Object());
}
public ObjectWrapper(Object object)
{
this.object = object;
}
public Object getObject()
{
return object;
}
public void setObject(Object object)
{
this.object = object;
}
}
public class ObjectUnwrapper
{
private ObjectWrapper o;
public ObjectUnwrapper(ObjectWrapper o)
{
this.o = o;
}
public Object unWrap()
{
if (o instanceof ObjectWrapper)
{
return o.getObject();
}
else
{
return new Object();
}
}
}
public class TestObjects
{
public static void main(String[] args)
{
Object o = new ObjectWrapper(new Object());
if (o instanceof ObjectWrapper)
{
ObjectWrapper ow = (ObjectWrapper) o;
ObjectUnwrapper ou = new ObjectUnwrapper(ow);
Object oops = ou.unWrap();
}
}
}
</pre>
Admin
AARRGGHH!!! That field should be FINAL!
Honestly, if the object is immutable, you can as well make it thread-safe - it isn't that difficult. Whoever wrote this didn't understand even the basics of the immutability pattern!
BTW. I resent the discrimination against robots this site shows with its CAPTCHAs. Just because they are non-sentient non-living entities doesn't mean that they have nothing to say. Well, actually it does, but that's besides the point. Just look at the immutable wookie.
Admin
Shouldn't this class use generics? Type-safety is important, you know...
Admin
not so bad as wtf imho
could be an in/out parameter.
AXIS generates things like these when generating code from wsdl with in/out's declared.
names them *Holder not a wrapper...
Admin
OMG what a stupid statement. What does the language/platform have to do with the selection of a particular data structure. Did you miss the part where it was asked to list the REASONS, not just make a mindless stupid comment about .NET?
Admin
Or if you insist on creating new wrapper instances on already-wrapped objects prefer
Admin
Google "objectwrapper" and hit "I'm Feeling Lucky":
http://www-sop.inria.fr/oasis/proactive/doc/ProActive_src_html/org/objectweb/proactive/examples/binarytree/ObjectWrapper.java.html
Someone else made one too! (but this one's serializable for some reason).
Admin
So, you'd do this if you wanted to have every object support something non-standard.
Sadly, this is the subject of much debate among avid Javascripters. http://blog.metawrap.com/blog/June6thIsJavaScriptArrayAndObjectprototypeAwarenessDay.aspx
Admin
I understand nothing
Admin
TRWTF is that this doesn't use generics.
I kid, I kid!
Admin
<Buddhist_Pedantry>Actually, that's only in the world of a Mahayana (which includes Chan/Zen, Nichiren, Pure Land, Vajrayana, etc.) Buddhist. There are no mantras in the teaching of the Buddha. Practice of the Noble Eightfold Path leads one to Nibbana.</Buddhist_Pedantry>