?

Log in

No account? Create an account
Ruined for life - Lindsey Kuper [entries|archive|friends|userinfo]
Lindsey Kuper

[ website | composition.al ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Ruined for life [May. 8th, 2007|05:20 pm]
Lindsey Kuper
[Tags|]

We keep having conversations like this:

Lindsey: Why doesn't the thingamabob work?
Jesse: Because Perl is bad. You gave it thus-and-such and it was expecting so-and-so.
Lindsey: That sounds like a pass-by-reference versus pass-by-value problem!
Jesse: You are such a CS major. There, I committed a fix.
Lindsey: Okay, but I don't understand about the other doohickey.
Jesse: Lindsey. You have to understand that Perl is very, very bad.

Why didn't they teach us bad programming languages in school? That would have been more practical.

LinkReply

Comments:
[User Picture]From: glowing_fish
2007-05-09 02:43 am (UTC)
Why don't movies feature bad romantic relationships, so people learn what they are probably going to be going through?
(Reply) (Thread)
[User Picture]From: lindseykuper
2007-05-11 04:32 am (UTC)
Oh, so the point of school was to entertain! I get it now!
(Reply) (Parent) (Thread)
[User Picture]From: glowing_fish
2007-05-11 04:45 am (UTC)
Oh, I have a witty rejoinder to THAT!

Oh wait. No I don't.
(Reply) (Parent) (Thread)
[User Picture]From: pmb
2007-05-09 03:13 am (UTC)

So this inspired a conversation between Jesse and me.

Also, hi, I'm Peter and we seem to have friends in common.

19:28
(07:28:09 PM) jes 5199: I need your reaction. http://rockstarling.livejournal.com/204306.html
(07:31:23 PM) Peter: My reaction is: Why are you working in Perl?
(07:31:31 PM) jes 5199: *sigh*
(07:31:56 PM) jes 5199: because I haven't sat down and done the line-by-line tranlation into a real language, yet
(07:32:55 PM) Peter: Perl is dynamically scoped but will sometimes close over variables and sometimes not and you can't put an array in an array and you can't pass anything but a scalar to a function unless that array or hash is the only thing you pass.
19:33
(07:33:13 PM) jes 5199: those things are true
(07:33:19 PM) Peter: Well, tell them that
(07:33:25 PM) jes 5199: there's also two incompatible syntaxes for calling any function
(07:33:38 PM) Peter: That's CS major talk for "it's all fuxored"
(07:33:49 PM) Peter: is there?
(07:33:52 PM) Peter: there are?
(07:33:55 PM) Peter: What are they?
(07:33:57 PM) jes 5199: Package::function()
(07:34:02 PM) jes 5199: Package->method()
(07:34:05 PM) jes 5199: same namespace
(07:34:12 PM) jes 5199: handles parameters differently
(07:34:12 PM) Peter: W00t
(07:34:17 PM) Peter: fuck
(07:34:24 PM) Peter: seriously?
(07:34:28 PM) jes 5199: seriously.
(07:34:40 PM) Peter: how do they differ?
(07:35:10 PM) Peter: How can they handle parameters any worse than the default "call the arrayify operator and pray" approach?
(07:35:37 PM) jes 5199: Package->method() climbs the inheritance tree. and because of that, they thought they'd like the code to know which package you thought you were calling. so "Package" is prepended to the parameters array as a string.
(07:35:53 PM) Peter: Aha!
(07:36:09 PM) Peter: Because that will allow people to hack on metasyntactic badness to make perl look object oriented!
(07:36:14 PM) jes 5199: right!
(07:36:22 PM) Peter: Fuck. that. shit.
(07:36:49 PM) jes 5199: yeah. Today might have pushed me over the edge.
(07:36:58 PM) jes 5199: I've got two files sitting here, blank
(07:37:09 PM) jes 5199: Import.rb and Import.py
(07:37:13 PM) Peter: How many lines need translating?
(07:37:20 PM) Peter: Both are fine languages
(07:37:38 PM) Peter: Ruby will be less painful a transition, I am led to understand
(07:37:46 PM) Peter: But I do dig on the python
19:38
(07:38:57 PM) jes 5199: 3,394 lines of general-purpose code
(07:39:01 PM) Peter: Dude
(07:39:15 PM) Peter: That's like 3 weeks of work for a good translator
(07:39:18 PM) Peter: at MOST
(07:39:28 PM) jes 5199: there's some project-specific code that I basically totally rewrite whenever I have to reuse it, anyway
(07:39:33 PM) Peter: Do not forget the first rule of holes here
(07:39:53 PM) jes 5199: the first hole is the hardest?
(07:40:27 PM) Peter: "There is an old military doctrine called the First Rule of Holes: If you find yourself stuck in one, stop digging." --the late Rear Admiral Eugene Carroll, US Navy (Ret.)

...many lines elided due to livejournal's max comment length...

(08:09:57 PM) Peter: I'm posting a transcript of our conversation in her livejournal
(08:10:05 PM) jes 5199: alright
(Reply) (Thread)
[User Picture]From: karzon
2007-05-09 04:24 pm (UTC)

Re: So this inspired a conversation between Jesse and me.

Perl is awesome for being able to pull something functional out quickly. For anything larger in scale, though? Screwed. And using Perl for OOP? Ha!

I use it for easily parsing files full of strings and little else at this point.
(Reply) (Parent) (Thread)
(Deleted comment)
[User Picture]From: karzon
2007-05-10 06:45 am (UTC)

Re: So this inspired a conversation between Jesse and me.

Yes, but if you scale up, and stop using the weird tricks and magic, why are you using it at all? There are better options available? Ruby and Python in particular give you similar typeless variables while providing a better OO framework. Don't get me wrong, I absolutely love Perl. I just think it's a pretty specialized tool that can easily become your hammer. Making everything you come across seem like a nail.
(Reply) (Parent) (Thread)
From: (Anonymous)
2007-05-10 09:04 am (UTC)

Re: So this inspired a conversation between Jesse and me.

Perl is dynamically typed and hence suffers from the vagaries of all dynamically typed languages...statically typed languages are utilized once you reach the age of reason and begin building complex systems. In addition its a syntactic garbage can not to mention all the compatibility issues. For these reasons and many more Perl is know as 'The Duct Tape of the Internet'
P.S. - The proper spelling is fuXXored, or for something completely fuXXored, conFuXXored
(Reply) (Parent) (Thread)
[User Picture]From: pmb
2007-05-10 05:11 pm (UTC)

Re: So this inspired a conversation between Jesse and me.

This is Josh, isn't it? Or someone else who loved their programming languages class?

Dynamic vs static typing is still being fought out, but I think that the real problem of programming language design is not a type-system problem (like a huge portion of CS academics seem to think), but a strange sort of user interface problem. Languages need to make easy things easy and hard things possible. Perl makes easy things easy and makes things you shouldn't do easy and makes hard things possible. UIs that have this property are generally considered to be bad, because users will click the wrong thing and their house of cards will come tumbling down. They have the wrong "affordances".

Ruby and Python also make easy things easy and hard things possible, but they don't make the things you shouldn't do as easy as Perl makes them. This means that they afford cleaner solutions, because the good way is also the easy way, and it's also not too hard (no harder than Perl, I contend).

In statically typed languages, the good way is also the easy way, but it's a *much harder* way, in general, then when compared to dynamic languages. Haskell programs are more likely to be correct, but they are also more likely to never be written in the first place because Haskell is so damn hard (as compared to e.g. Python or Ruby or Perl).

CS academics and static typing junkies often approach the problem of coding by saying that everyone is doing it wrong and needs to change. Somehow, I'm pretty sure that the way to enlightenment does not lie in yelling at everyone that they are doing it wrong and need to do it your way. Particularly when they way people are doing it generally works. I contend that telling everyone that software development needs to be more difficult is, itself, a confuXXored attitude. Writing software with "scripting languages" and "dynamic languages" generally requires a factor of 2-10 less code - this is a real savings, and it allows people to solve real problems faster. If you want to increase development time and effort by a factor of 2 to 10, then I'm going to need more convincing than just "once we reach the age of reason".

All of this could change if you could point me at a system where I could write code as fast and well as I write code in Ruby, but had strong typing. It would really change if you could point me at a language where I could write code as fast and well as I write Python code.
(Reply) (Parent) (Thread)
[User Picture]From: jes5199
2007-05-10 05:20 pm (UTC)

Re: So this inspired a conversation between Jesse and me.

I was trying to think about Haskell yesterday, and I came up with something like
"It makes the hard things easy, and the easy things might be possible- we've got teams of scientists trying to figure them out."
(Reply) (Parent) (Thread)
From: (Anonymous)
2007-05-10 06:36 pm (UTC)

Re: So this inspired a conversation between Jesse and me.

Can't say that I ever loved a programming languages class. In fact I try not to love things that cant love you back in general. My 'junkiness' comes not from an abstract love of NP completeness but from 30 years in the trenches building systems.
What is 'easy' and what is 'hard' are context based; it is easy in Perl to write a log parser, it is hard to write a transaction processing system. It is easy to be one guy mentally masturbating over how cool it is to compact a program to one indecipherable line and hard to be a developer on a team of 40 maintaining a million lines of code pushing 2 week release cycles.
Maintainability: a system that is not being maintained is a dead system
As far as the 'simple' way being the 'best' and 'easiest' I think H.L. Mencken said it best: "for every complex problem there is a solution that is simple, elegant, and wrong"
Static typing and object orientation have allowed me to shepard teams of eager young nOObs ready to, as the XP guys say, 'release the pig' of poor devlopment and sacrifice maintainability for that vacuous decrease in development time. These eager young swine are not yelled at or preached to but their porcine locomotion crashes headlong into a phalanx of strong typing, adaptors, facades, and bridges and a complex bombproof system gets delivered on time.
(Reply) (Parent) (Thread)
[User Picture]From: pmb
2007-05-10 08:05 pm (UTC)

Re: So this inspired a conversation between Jesse and me.

I really never saw any benefits to static typing when I was a developer, but the projects I worked on (~20kloc and two ~250kloc ones - all measurements based on the output of wc) were an order of magnitude smaller than the ones you are describing, and were in Java, Java, and C, respectively.

The things that I felt helped were:
object orientation
unit testing
javadoc and javadoc-like systems
static typing felt like it was just in the way.

But you've seen real benefits that you attribute to static typing? When people say "static typing" they can mean many things - do you mean crazy academic-programming-languages style typechecking, a la SML or OCAML or Haskell? Or do you mean typechecking like in Java? Or like in C or C++?
(Reply) (Parent) (Thread)
From: (Anonymous)
2007-05-11 06:18 am (UTC)

Re: So this inspired a conversation between Jesse and me.

I'm not sure there is much difference in the definition of static typing depending on language; manifestation yes, but definition no. Static typing, type safety, type checking all go hand in hand. Benefits? absolutely! Static typing allows you to do compile-time type checks and eliminate mountains of miscoding without wading through masses of runtime messes. It is also a nightmare for a compiler to try to optimize dynamically typed languages, and runtime JITting and hotspotting in a VM are not worth the cycles so you will not get heavy production load performance boosts from dynamically typed languages. Declared types tend to be less cryptic, somewhat self-documenting.
The clear winner for me has to be type safety though. Not being able to indiscrimminately pump any old values into an auto-converting type saves me from myself, myself from others, and others from me.
(Reply) (Parent) (Thread)
[User Picture]From: pmb
2007-05-11 07:10 am (UTC)

Re: So this inspired a conversation between Jesse and me.

I was under the impression that most coding errors were value errors and not type errors. Array bounds that were too big and negative ints and the like. Type checking doesn't cure those at all. In my experience slinging Python code, almost all of my errors are value errors and not type errors, although I hesitate to use my grad school experience as any kind of data point for coding in the rest of the world.
(Reply) (Parent) (Thread)
From: boojum
2007-05-11 03:11 pm (UTC)

Re: So this inspired a conversation between Jesse and me.

I'm beginning to think that most coding errors are authority errors -- either part A and part B both think they're in charge of doing foo, or neither part A nor part B do, and in either case, you have foo problems. Most of the bugs that I remember hating the most came down to threading and/or error-handling, and I think most of those were, at base, authority problems.
(Reply) (Parent) (Thread)
From: (Anonymous)
2007-05-11 08:37 pm (UTC)

Re: So this inspired a conversation between Jesse and me.

those are more design issues than implemetation bugs
(Reply) (Parent) (Thread)
From: (Anonymous)
2007-05-11 08:41 pm (UTC)

Re: So this inspired a conversation between Jesse and me.

again, part and parcel of the same. Getting back to Perl and all the different types of arrays you can assign/'cast' to each other, often resulting in garbage. With type checking you would theoretically never be allowed to make a cast resulting in garbage values
(Reply) (Parent) (Thread)
From: (Anonymous)
2007-05-11 08:43 pm (UTC)

Re: So this inspired a conversation between Jesse and me.

P.S. - Hi Lindsey, guess who...
(Reply) (Parent) (Thread) (Expand)
From: boojum
2007-05-09 05:15 am (UTC)
Perl obscures one of my internal programming rules: when the computer/compiler/debugger is mean and wrong and lying to me and stupid and wrong, it's time to go home, eat something, or go outside.

Sometimes with Perl, I'm actually right about the computer being a poopyhead.
(Reply) (Thread)
[User Picture]From: idealisms
2007-05-09 07:08 am (UTC)
They did teach you bad programming languages, because all languages are bad. But since it's unavoidable, there's not much you can do other than roll with the punches.

Brad had a decent comment about this.

There are some things that perl gets very right, like lexical scoping and anonymous functions.
(Reply) (Thread)
[User Picture]From: jes5199
2007-05-09 07:50 am (UTC)
I cannot help but wonder if that bit about "too verbose in python" is some kind of joke

perl:
$a = sub { ($x) = @_ ; $x }
print $a->(1);

python:
a = lambda x : x
print a(1)

ruby:
a = lambda {|x| x}
print a[1]
(Reply) (Parent) (Thread)
[User Picture]From: pixelherder
2007-05-09 08:29 am (UTC)
Since I've switch to Python (away from Perl), I haven't found it too verbose. About the only real annoyance that I've come across has actual been the scope search order, but I'll gladly suffer that to avoid the insanity of Perl references.

Oh, and for that Python bit you can also just write def a( x ): x for the first line. def is just an assignment operator in Python.

And since this game is fun...

Haskell (interactively in Hugs or GHCi):
let a x = x
print $ a 1
(Reply) (Parent) (Thread)
[User Picture]From: lindseykuper
2007-05-09 04:24 pm (UTC)
Yeah, I'm kidding with the "Why didn't they teach us bad programming languages?"

This isn't me on a soapbox here all "PERL SUX". I guess I tend to agree with Brad: better the devil you know.
(Reply) (Parent) (Thread)
(Deleted comment)
[User Picture]From: lindseykuper
2007-05-09 04:11 pm (UTC)
No, I was being facetious.

But I was thinking of Scheme.
(Reply) (Parent) (Thread)
[User Picture]From: karzon
2007-05-09 04:26 pm (UTC)
Scheme? You need more((((()))))!
(Reply) (Parent) (Thread)
[User Picture]From: lindseykuper
2007-05-16 10:47 pm (UTC)
When I'm using Scheme and I'm really in it, I don't even see them.
(Reply) (Parent) (Thread)
[User Picture]From: oranges4oranges
2007-05-09 04:57 pm (UTC)
I think that I shall never see
a poem as beautiful as Scheme.
(Reply) (Parent) (Thread)
[User Picture]From: oranges4oranges
2007-05-09 04:54 pm (UTC)
I think the liberal arts curriculum should be totally reshaped along these lines:

*The English department should start studying the far more commercially relevant Danielle Steele and Dan Brown.
*Philosophy can offer a seminar on Mitch Albom or Ayn Rand. *The Dept of Psychology can become the Dept of Self Help and Coping.
* Political Science... Don't get me started on what Political Science will become.

Also, regarding the "all programming languages are bad" idea. Just because all programming languages are bad in some respects does not imply that all programming languages are equivalently bad. I mean, all baseball teams have strengths and weaknesses. That doesn't mean the Tacoma Rainiers are going to beat the New York Yankees any time soon.
(Reply) (Thread)
From: (Anonymous)
2007-05-11 08:48 pm (UTC)

Bad little languages

I dont think all languages are bad, just that all languages are flawed. In fact I think the programming process is flawed and that the computer should do the programming for you, like this:
http://www.neocoretechs.com
(Reply) (Parent) (Thread)