views:

122

answers:

4

I'm part of a six-member build and release team for an embedded software company. We also support a lot of developer tools, such as Atlassian's Fisheye, Jira, etc., Perforce, Bugzilla, AnthillPro, and a couple of homebrew tools (like my Django release notes generator).

Most of the time, our team just writes little plugins for larger apps (ex: customize workflows in Anthill), long-term utility scripts (package up a release for QA), or things like Perforce triggers (don't let people check into a specific branch unless their change description includes a bug number; authenticate against Active Directory instead of Perforce's internal passwords). That's about the scale of our problems, although we sometimes tackle something slightly more sizable.

My boss, who is reasonably technical, has asked us to standardize on one or two languages so we can more easily substitute for each other. He's advocating bash scripts and Perl, due to their universality and simplicity. I can see his point--we mostly do "glue", so why not use "glue" languages rather than saddle ourselves with something designed for much larger projects? Since some of the tools we work with are Java-based, we do need to use something that speaks JVM sometimes. (The path of least resistance for these projects is BeanShell and Groovy.) I feel a tremendous itch toward language advocacy, but I'm trying to avoid saying "We should use Python 'cause I like it and Perl is gross."

Instead, I'm trying to come up with a good approach to defining our problem set: what problems do we solve with scripts? Would we benefit from a library of common functions by our team, or are most of our projects more isolated? What is it reasonable to expect my co-workers to learn? What languages give us the most ease of development and ease of modification?

Can you folks suggest some useful ways to approach this problem, both for my own thinking process and to help me facilitate some brainstorming among my coworkers?

+4  A: 

Google standardized on Python for such tasks (and many more) a bit before I joined the company; as far as I know, huge advantages such as Python's great implementations on the JVM and .NET didn't even play a role in the decision -- it was all about readability. At the time (and to some extent, even now) the theory at Google was that every engineer must be able, at need, to tweak every part of the codebase -- including of course build scripts, spiders (which were in Python at the time), and so forth. Demanding of engineers already proficient in C++ and Java to learn many more "scripting" languages (Python, Perl, Bash, Awk, Sed, and so forth) was simply unconsciounable: one had to be selected. Given that constraint, Python was the clear choice (under other constraints, Perl might also have been -- but I can't see the inevitable mix of Bash, Awk and Sed ever competing on such grounds!_) -- and that's how I ended up working there, a bit later;-).

Given that the overall potential of Python vs Ruby vs Perl vs PHP vs Bash + Awk + Sed vs ... is roughly equal, picking one is clearly a winner -- and Python has clean readability, strong implementations on JVM and .NET as big vigorishes. Seriously, I can only think of Javascript (inevitable for client-side work, now rich with strong implementations such as V8) as a possible "competitor" (unfortunately, JS inevitably carries on a lot of baggage for backwards compatibility -- unless you can use a use strict;-like constraint to help on that, it must be an important downside).

Alex Martelli
« vig·or·ish  [vig-er-ish] Show IPA–noun Slang.1.a charge paid on a bet, as to a bookie.2.interest paid to a moneylender, esp. a usurer. » ...which of these did you mean?
intuited
@intuited, neither -- being Italian, I'm a bridge player, so I use the bridge (and original Yiddish) meaning "a little extra value", cfr e.g. http://www.bridgetoday.com/news/news_benito.php ;-)
Alex Martelli
@Alex Seems like a bit of a gamble to support .NET and the JVM so probably it makes sense whichever way. 8~7
intuited
+6  A: 

Two points:

  • "Eww Perl gross" is somewhat of an urban legend. You can write great clean self-documenting code in Perl, and your can write write-only code in pretty much any language. It's a property of a developer, not a language.

    Just because you're writing glue code, doesn't mean the code has to suck like some glue hacks tend to be.

  • From many threads comparing Perl vs Python on SO, it appears to me that Perl's CPAN is more expansive than Python's repository, but I have no experience with Python and can't substantiate with real comparison.

    BUT, one thing I do know. After 5 seconds search, CPAN has a JIRA module. Whether that's a good factor for you or not, that's up to you.

DVK
Oh yeah, and a big ME-TOO to Alex's "There can be only ONE" :)
DVK
That's kinda boring. Perl developers insist that Perl's syntax is clean and readable, while the rest of world just don't believe.Readability is a property of language (although developer can preserve or screw it), check `brainfuck` (to name one).
gorsky
-1: Perl is gross is not an urban legend. It's an opinion, widely held, and backed up by substantial experience trying to read perl code. Been There Done That, didn't enjoy it. Not a legend, an actual source of actual long-term cost.
S.Lott
@S. Lott - And I have read crappy code in ANY # of languages, and I can bet you 100 rep that I can easily find crappy Python code. And you have not read my production code.
DVK
+1: Writing clean, readable Perl has always been an option and it's even easier today than it has ever been in the past. If someone is writing gross Perl code, then either a) they don't know any better, b) they don't care, or c) they're deliberately golfing/obfuscating. a) and b) are very real, but language-inspecific, problems. As for c), I don't golf myself, but all the avid Perl golfers I know are also very clear that golfing and production code are mutually exclusive.
Dave Sherohman
@DVK: No one said that Python code is always better. The issue is claiming that "perl is gross" is somehow not based on real experience. It **is** based on real experience. Perl code has syntax quirks and features that are real and make Perl code really hard to read. Yes, Perl can be done well; but when done poorly, it's really, really bad.
S.Lott
That's like saying "EWW C gross" because you can do awful crap with pointers, and compare it to, say, BASIC that never has buffer overruns (I'm not sure if BASIC does, that was a fictitious example :) )
DVK
A: 

First, it's important to note that it is very hard to convince someone they're wrong.

He's advocating bash scripts and Perl, due to their universality and simplicity

Bash scripts are not simple. The bash programming model is really complex and unfriendly. if statements and expressions, in particular are horrifying.

Perl may or may not be simple.

Bash is universal. Perl, however, is exactly as universal as Python. Python is pre-installed in almost all Linux distributions. So that argument is specious.

The "universality" of bash, Perl and python is exactly the same. The "simplicity", however, is not the same. You won't find it easy to to "prove" or "convince" anyone of this once they've already pronounced Perl as simple.

The Situation.

If the boss is advocating Perl, and Perl is not the answer, you will find it is very hard to convince someone they're wrong, making this effort nearly impossible.

If the boss was just throwing out ideas, then this is just difficult.

Quick Hack.

An easy thing you can do is to attempt head-to-head comparisons of Python and Perl for some randomly-chosen jobs. You can then have a code walkthrough to demonstrate the relative opacity of Perl compared with the relative clarity of Python.

Even this is fraught with terrible dangers.

  1. Some folks really think code golf is important. Python loses at code golf. Perl wins. There's nothing worse than "Angry Co-worker with Perl Bias" who will kill you with code-golf solutions that -- because they're smaller -- can baffle management into thinking that they're clearer or "better" on some arbitrary scale.

  2. Some folks really think explicit is "wordy" and bad. Python often loses because the assumptions are stated as actual parameter values. Some folks can (and do) complain at having to actually write things down. Read Stack Overflow for all of the Python questions where someone wants to make the try: block go away in a puff of assumptions.

If you choose random problems, you may -- accidentally -- chose something for which there's an existing piece of Perl or Python that can be downloaded and installed. A language can win just through an accident of the draw. Rather than a more in-depth comparison of language features.

Best Bet

The best you can do is the following.

  1. Identify what folks value. You can call these "non-functional" requirements. These are quality factors. What are the foundational, core principles? Open, Accessible, Transferrable Skills, Simplicity, Cleanliness, Honesty, Integrity, Thriftiness, Reverence, Patience, Hard Work, A Sense of Perspective, Reef the Main in Winds over 20 kn, etc. This is hard. No sympathy here.

  2. Identify the technical use cases. These are "functional" requirements. Which bits of glue and integration there are? This is hard, also. Requirements erupt of out of the woodwork when you do this. Also, when you have a Perl bigot on the team, numerous non-functional requirements will pile into this area. Your manager -- who proposed Perl -- may be the Perl bigot, and the use cases may be difficult to collect in the presence of a Perl bigot.

  3. Identify how (a) Perl + Bash vs. (b) Python vs. (c) Java fit this core values and the functional requirements. Note that using Python means you do not need to use Bash as much. My preference, BTW, is to pare Bash down to the rock-bottom minimum.

This is a big, difficult job. It's hard to short-cut. If you find that Perl is not the answer and the Perl bigot you need to convince is the manager who proposed Perl in the first place, you may find that convincing someone that they're wrong is very hard.

Edit. I am aware that I am forbidden from using the string "Perl Bigot" to describe the manager's potential level of bias toward Perl. I, however, insist on using "Perl Bigot" to describe the manager who proposed Perl. The question provides no information on which to change this. The worst case is that (a) the manager is the Perl Bigot and (b) Perl is not the answer.

S.Lott
-1: Complaining about "Perl bigots" while displaying strong anti-Perl bigotry. Perl and Python are both fine languages. Just because my preference between the two is different than yours does not make me a "bigot". (Incidentally, though, you seem to shoot yourself in the foot with your "Perl can win by luck of the draw" paragraph. It seems to be saying that the odds of finding an existing Perl solution are substantially higher than the odds of finding an existing Python solution, since you only give Perl this luck-of-the-draw possibility. If that's so, how is it not an advantage of Perl?)
Dave Sherohman
@Dave Sherohman: Perl's primary liability is it's opacity. The OP wants to convince folks to use Python, hence the pro-Python stance in this answer. If the OP wants to promote Python, the stumbling block is not folks who are willing to listen; the stumbling block is a bigot who refuses to listen. The Perl Bigot is the OP's problem -- not technology, and not my personal bias. Nor yours.
S.Lott
Could you please substanciate "using Python means you do not need to use Bash as much" vs the implication that you somehow need to use bash when using Perl? (considering that any competent Perl developer will NEVER EVER need to write another line of shell script, from my experience)
DVK
Thank you for the answers. I should clarify that while I have a strong bias toward using Python, and other people in my group have their own biases and levels of familiarity, I really am trying to move the conversation away from advocacy and toward slightly more objective evaluation of what's best for our needs. I'd use Perl if we all decide that it's really the best choice. So I appreciate most your "Best Bet" items. That said, I'm happy to read other people's advocacy and how it reveals strengths and weaknesses of the tools.
Allan Anderson
"objective evaluation of what's best for our needs". That will lead approximately nowhere. Everything's really good. The differences are minor. If you leave all options on the table, you'll wind up tossing a coin. Toss the coin now and build a case *for* something specific.
S.Lott
@S.Lott: My issue with your answer isn't that you prefer Python and, yes, I do see that the OP prefers Python (although the question is **not** "How do I convince them to standardize on Python?"). My issue with your answer is that you seem to be assuming that anyone who prefers Perl is, by definition, a "Perl bigot". The only things we know about the OP's team member who is advocating Perl are that a) he's the OP's boss, b) he likes the idea of a Perl/bash mix, and c) he's open to other languages. I see no evidence of bigotry in a or b - and c is the opposite of bigotry.
Dave Sherohman
@Dave Sherohman: Sorry if it looks like the set of everyone who prefers perl is also a the set of people who are bigots. I only wanted to single out people who are in the intersection -- perl bigots, not perl users. I tried to emphasize that the presence of one perl bigot makes life difficult; I tried to avoid saying all perl users are bigots. However, you found that message somewhere. I'm unclear on what to change, though. Which words should I fix?
S.Lott
Curiously, you sound like a Python bigot. It sounds like you have had some bad experiences with Perl. However, people have bad experiences with nail guns and chainsaws. It's usually the fault of the person operating the power tool, not the tool itself.
brian d foy
@S.Lott: The sentence "*I, however, insist on using "Perl Bigot" to describe the manager who proposed Perl.*" from your edit pretty well sums up the problem I see. As I explained in my last comment, the OP has said absolutely nothing which indicates that his manager is a "Perl bigot" rather than merely a "Perl user" and, further, the manager's position of "I suggest Perl/bash, what do you guys think?" rather than "I'm the boss, I like Perl, therefore we will use Perl whether you like it or not" makes a pretty strong case that he is **not** a language bigot.
Dave Sherohman
@Dave Sherohman: While that's possibly true; you have no evidence, either. It's hard to guess from the question. Since we know so little, we're left to assume the rest. "it is very hard to convince someone they're wrong". The real obstacle is when Perl is not the answer AND the boss is a Perl Bigot. Other than that situation, it's just difficult.
S.Lott
+1  A: 

I don't think anyone is going to be able to solve your problem on Stackoverflow. Your choice of tools, methods, and process are much more affected by social constraints, e.g. what your boss wants and what you want, then technical merits. That's not necessarily bad.

The short answer is "Use what is going to be most pleasing to the developers". If everyone likes Python more than Perl, for whatever reason, they are probably going to get more done in Python. If they like Ruby more than Python, it's the same thing.

Some things to evaluate as part of your selection:

  • What do the developers already know?
  • What are they most willing to learn?
  • How much weekly time can your team spend learning new things (e.g. lunch seminars, formal classes, etc)?
  • What do most people in the community use to work with the tool you need to support? For instance, Fisheye has a Java API, and some REST examples for Perl and Python. If you're writing Fisheye extensions, Java seems to be the win there. If you're merely accessing Fisheye data, any language can use the REST stuff.
  • What is most of your code base in already? What can you replace and what do you have to continue to support? I find that many companies can't answer this question because every developer seems to add two new technologies they don't tell anyone about. :)
  • Which platforms do you need to support? Some languages have platform specific issues, and I don't mean just Windows vs. Unix. Do you have legacy hardware you have to support? Does your tool work on that stuff?
  • How much of the stuff you produce can benefit other parts of the company? What are other teams using?
  • Do the people advocating one tool know it well enough to be its champion? I ask What are five things he hate about your favorite language? If people can't name five valid things that are wrong with their language or tool, they don't have enough experience with it.

The Longer Answer

People tend to try to reduce this to a technical argument because they are afraid to admit their biases or examine why they think what they think. Your boss might favor bash and Perl because that's what he did a lot of work in when he was getting started. You might like Python because you have a personal affinity for the way Python does things. I like Perl because I like its flexibility and DWIMmery. Like any social situation, different people are going to be attracted to different parts of different things. Just because you like chocolate doesn't make vanilla evil. I could give you lots of good arguments why Perl can be useful, but that doesn't mean that something else can't give you the same value.

What problems do we solve with scripts?

That one you have to answer for yourself. :)

Would we benefit from a library of common functions by our team, or are most of our projects more isolated?

This is most likely a good thing in Python, Perl, Ruby, Java, and almost any other language that you might choose. I think this part of your requirement is language agnostic. No matter which one you choose, you'll probably want to do this.

What is it reasonable to expect my co-workers to learn?

A good developer should be able to work with several different languages at least to an apprentice level. Those languages should include ones that have vastly different assumptions about how people express problems, say, for example, the set { Smalltalk Perl C Lisp Java }.

The best developers I've hired and worked with have always wanted to use the right tool for the job instead of making the job right for the tool. They might have their favorite language, but they didn't grouse (too much) about using a different tool when it made more sense.

Many "developers", however, seem to think that they are getting paid to play with their favorite tool. You need to convert them into people who think they have a toolbox to solve problems that create business value.

And remember, you never stop learning. As a developer you don't have to choose one language then defend it with your life, forsaking all others, in sickness and in health, and so on. Good developers are going to continue to track new technologies and evaluate them for usefulness for their tasks. Just because you choose one tool over another doesn't mean you stop paying attention.

No matter what you choose, someone is going to complain. Don't look for the solution that makes everyone happy. There isn't one, short of getting rid of the developers who aren't happy.

What languages give us the most ease of development and ease of modification?

A skilled practitioner in just about any language will think that his chosen language is the easiest to develop, modify, and maintain. Unskilled practitioners tend to blame the language and the tools for their problems. Some languages have steeper learning curves, and some have bigger payouts. A person's tolerance with immediate gratification is a big factor here.

That being said, different languages have developed different cultures and different toolsets. Perl people tend to like vi or emacs, Ruby people tend to like TextMate, Java people tend to like Eclipse or IntelliJ. That's not always true, but the culture that evolves around the tools are often more important than the technical details of the tool. If your developers like a particular type of tool, they are probably going to like the language that has a culture built around that sort of tool.

Some processes and tools take more time to get used to or require more education, but they can have larger advantages when used properly. Other tools get you started sooner but might not give you a path to bigger and greater things, such as cross-team development. The trick, however, is to not code to the tools so you aren't stuck in any particular toolset.

brian d foy