Mark said:
It's silly.
And my alternative suggestion: Look at a copy constructor. How
complicated is that?
Dear Lord, people! It's one frigging line! I mean seriously, did
neither of you see this? It's dead simple too, anyone reading that
would instantly understand it.
Both your and Jenny's posts are classic examples of baroque,
overly-ornamented, gold-plated, poor design
Clone() is counter-intuitive, but it's not nearly bad enough
to warrant the code you posted, even ignoring the actual errors.
My God. I'd heard somewhere that comp.lang.java.programmer was one of
the rudest places outside of the alt hierarchy and decided to come see
for myself if that was true. I load the headers, view the single
most-recent post in the newsgroup, and bam!
Actually, I've seen alt groups with less derision flying about.
A lot of people active in comp.lang.java.programmer are somewhat
abrupt or blunt at times - I'm pretty sure it is not intended to
cause offence.
I'd hate to see this place if that ever changed --- it might even give
alt.flame a run for its money.
At least the first step has apparently already been taken --- that would
be admitting that there is a problem.
I wonder what an office full of you guys would look like.
Wait, why wonder? I happen to have a crystal ball handy:
Day 1: project makes inches of progress, with more time spent insulting
each other than coding.
Day 2: someone's harsh and careless criticisms make some lady programmer
burst into tears and take the rest of the day off
Day 33: boss pokes nose in, finds out that zero milestones have been
reached, small thermonuclear explosion ensues, EMP wipes
computers, back to square 1 --- all three completed lines of code
are lost along with the backup tapes. Offsite backup? You'd been
in the middle of arguing about where in the world to put it when
the boss blew his stack.
Day 41: Lady programmer quits, two other good programmers quit, boss
hires three bad programmers to replace them
Day 61: All three get fired. Net negative productivity.
Day 77: Boss tears out last hair on head, quits. New boss is worse than
the old boss.
Day 78: New boss pulls out inaugural clump of hair. This isn't like
trying to herd cats, it's like trying to herd fucking tornadoes.
Day 147: New boss beginning to resemble a version of Captain Picard with
anger-management issues. First deadline slipping.
Day 312: Project hopelessly late. Bickering has reached the point of
occasional fisticuffs, hurled coffee-cups (usually full of
cold, B-grade coffee), and general abuse. First fatality as
a carpooling group of angry programmers goes off the road into
a tree during a heated debate over which class is responsible
for deallocating foobars.
Day 908: Half of you are now being paid $40 an hour to bicker full-time.
Two of you are dead, one having finally snapped and blown the
other away with a sawed-off before eating it himself.
Day 1,719: The new boss snaps, begins building a mysterious contraption,
stops management. Treacle-like progress screeches to a halt.
Day 1,722: The boss unveils his new invention.
Day 1,723: Janitor arrives to find the place deserted and piles of dust
here and there.
Day 1,729: A coroner's inquest concludes that everyone was disintegrated
by thalaron weapon. Fourth milestone deadline comes and goes.
The project consists of three complete classes, a skeleton of
a fourth one, and a metric ton of UML diagrams scribbled over
in red ink. Corporate HR decides to hire replacements from
comp.lang.python instead of comp.lang.java.
Day 1,730: Microsoft unveils competing product, grabs the entire market.
Corporate VP product development pulls plug.
Day 1,730: Someone finds a security hole in competing product.
Day 1,742: Eighty million computers infected and counting.
Day 1,745: Most of planetary population dead of acute spam poisoning.
Civilization in ruins. Roving bands of warring tribes.
Day 545,907: Some idiot reinvents agriculture and the whole cycle begins
again.