The Register® — Biting the hand that feeds IT

Adobe PSD pushes programmer too far

Inachu

This is awsome! 

Happy

Maybe more programmers like him will shame adobe coders to eat some humble pie and stop trying to meet deadlines when they still have faulty code.

I would fire those lousy coders at adobe and force them to wite in batch file programming for the next 20 years as punishment.

David Wilkinson

Very useful comments. 

There is sometimes a period in which you are studying something and you truly can't tell whether you are just missing the big picture or if what you are working for is in fact a poorly designed, incomprehensible and incoherent mess.

Usually there is an ah-ha moment where you realize what the original designer was thinking, so you keep trying to wrap your brain around it, approaching it from different angles, all with the assumption that the designers choices were part of a rational, well though plan.

What would even be more helpful is if the creator(s) of the format would have dotted their code with comments such as

//This is an ugly hack, but I've been working 24 hours straight surviving on energy drinks

Dominic Kua

I love the next line. 

Happy

which happens to be a sanity check...

Anonymous Coward

@ David Wilkinson 

There's enough bloat in Adobe's wares without packing the code out with comments, surely?

Mr ChriZ

@AC 

I really hope you're joking.

Camilla Smythe

Whimp 

I'd love to have his babies, from the hero aspect, but you just don't cut your salary, present and future, by doing that sort of stuff. Next thing I know he will be unemployed which rather messes with the future of my children.

Fortunately I am less impressed with God. The back I can cope with but not being able to fart, and the rest of the backup, is something else.

Steve

Mixed views 

While I can understand his frustration entirely, and his desire to rant about incomprehensible formats, I can't help but wonder whether if he had gone through the bureaucratic nightmare necessary to obtain the format specification and documents rather than presumably attempt to reverse engineer the mess, they might have actually helped understand it and made life easier? Probably not, but I can wonder...

Steve.

Brian Miller

Should see ASN.1 x.680 and x.690 

While I was writing encoding/decoding software to this spec, I was reminded of The Holy Hand Grenade of Antioch, what with all of the "shall be" and "shall not" when encoding integer types.

The Microsoft implementation simply blew past all of that strict complexity and did it wrong.

Hayden Clark

however.... 

Happy

... the featured rant is the only useful comment in the code. Otherwise, it's "self-documenting"

Colin Barfoot

hindsight always has 50/50 vision 

Gates Halo

The PSD format is very old. It has been forced to do things that were never intended for it and has to maintain backward compatibilty. I'm guessing that in the original version the development was implementation driven so that it would actually work on a machine with 256k of memory and the file format had to accomodate that. The programmer has also chosen to use a language that's more remote from the architecture than the original (probably C) would have been which can only make things more difficult.

Having said that Adobe produces some pretty abysmal formats (or one format rehashed): TIFF / PS / PDF.

Mike

Adobe: Serial code abusers 

Go

This site speaks volumes about Adobe's development team: http://adobegripes.tumblr.com/

Michael Baldry

can we really believe his words? 

Thumb Down

when he uses a goto statement on line 432 :/

Michael Baldry

spec? 

Maybe if he had the proper spec from Adobe, he'd have more idea of why things were done the way they were (not saying the format isn't shit, maybe it is...)

Juan Inamillion

@Dominic Kua 

Joke

Don't you mean the 'sanity clause'?

Everyone knows there ain't no Sanity Clause....

/with cigar and glasses

peter garner

@Inachu 

> I would fire those lousy coders at adobe and force them to wite in batch file programming for the > next 20 years as punishment.

Using edlin.. no sense in making it too easy

Mike Bell

palbuf 768 

Paris Hilton

I particularly like the line "uint8 palbuf[768];" and the liberal use of the number 768 in general. Lovely stuff.

Paris, because she likes to buff up her pals.

Ken Hagan

Re: Mixed views 

Flame

"...if he had gone through the bureaucratic nightmare necessary to obtain the format specification and documents [...], they might have actually helped ..."

Well, as you go on to say, they might but they might not. It depends partly on whether the implementation matches the spec and partly on whether the spec really is the steaming pile of shit that it appears to be. When a company goes out of its way to make it hard to find out, I tend to assume the latter. This is the same company that makes (or certainly used to make) its products available only through a "download engine" that couldn't cope with a NAT, so they definitely have "form" on the clueless tossers front.

Anonymous Coward

@David Wilkinson 

Joke

But *all* my code is an ugly hack, written whilst sustained on Energy drinks! Maybe I should tage the one or two lines that aren't as "#yes. This is good code. Enjoy!"

Big Bear

@David Wilkinson 

I have been the recipient of such comments of the "Dear Dave, I owe you a proper fix for this hack but it will last through Rel 4.1 unit test. Must fix for 4.2. Cheers, Dave"

There are times when the man to blame and swear at is yourself...

Lionel Baden

ERMM 

//This is an ugly hack, but I've been working 24 min straight surviving on energy drinks

goes at the top of everything i make !

Anonymous Coward

@ Colin Barfoot 

Stop

Hey! PostScript is not bad. It's a computationally-complete language. Although, a heavy session of PostScript programming does tend to make it hard for you to program anything else except a HP calculator for awhile.

You should try writing a Perl script which generates a PostScript document, then spits it through ps2pdf. I have -- and every single person who has ever seen it thinks it's the DBs.

boltar

@Michael Baldry 

"when he uses a goto statement on line 432"

So friggin what? If you subscribe to the out of date "never ever use a goto anywhere" paradigm more fool you. If you look carefully you'll notice he was using it to jump out of some nested loops

before the inner loop was commented out. A lot more sensible than the idiotic "if (flag) break" nonsense to do the same I see from the brainwashed Knuth acolytes.

Andrew Shirley

See also 

http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered

Ed Blackshaw

@@ Colin Barfoot 

I used to work with someone who had claimed to have acheived that self same task. You are he, AICMFP!

Anonymous Coward

Nice one... 

Thumb Up

Power to the programmer :)

Aaron

Goto statements... 

Paris Hilton

...aren't inherently evil. What do you think a JMP statement in Assembler is?

Paris, because she keeps insisting I'm misspelling "jump".

David Halko

I loved the comment... 

Joke

I love the comment, "Having worked on this code for several weeks now, my hate for PSD has grown to a raging fire that burns with the fierce passion of a million suns."

LOL!

Anonymous Coward

I always 

Thumb Up

Ixnay before I entray!

Iam Me

@ Andrew Shirley 

Thumb Up

Spent good chunks of the day laughing my ass off at what was posted there. Good stuff.

E

@Michael Baldry 

Properly used, goto is perfectly acceptable.