What I Hate About Your Programming Language
chromatic writes "Perl programmers like punctuation. Python programmers like indentation. Every programming language has its own syntax, stemming from its philosophy. What I Hate About Your Programming Language examines the issues that shape languages as they grow. It's not advocacy, I promise."
What he hates about PHP doesn't sound so bad, and doesn't seem like anything that won't be corrected in PHP5.
I knew there was a reason I liked it.
What I hate about your programming language is that it doesn't work like mine does.
The cake is a pie
That's why I use Whitespace, of course!
ASP isn't a language. You can use any number of scripting languages with it. Of course, most are done in VBScript, but many folks use JScript (javascript), because it is what they use for the client side script.
DO NOT DISTURB THE SE
I used to have a T-shirt that was designed to piss off everybody. It said "Nuke the Gay Unborn Baby Seals". That's what reading this article felt like. Tinder to start a flame war that everybody can join in on.
No boom today. Boom tomorrow. There's always a boom tomorrow. - Cmdr. Susan Ivanova
...we should all use Scheme.
What I think you meant to say was:
(define language? (lambda (x) 'scheme'))
"Probably the toughest time in anyone's life is when you have to murder a loved one because they're the devil." -Philips
I hate all your programming languages because they arn't just a .wav file of my dictating what I want it to do.
PS.
I don't program for a living
Wow, sent an e-mail as suggested when clicking on "use classic" banner, and got a fast response that addressed my msg
I looked at this article, and I was disappointed by what a limited set of languages chromatic had examined. Where was Prolog? ML? Common Lisp? SNOBOL? Smalltalk? Dylan? All the languages in the article are in the class of "imperative languages with varying amounts of object-oriented gravy." If you're talking about how languages embody a philosophy, why stick to languages that pretty much embody the same philosophy, with some minor tail-fins and chrome as their differences?
[I suppose that's some flame bait....]
Anyone else noticed how, in the middles of the "my language is better than your language" flame war this guy was starting, he managed to slip in an editor flamewar by linking to vim?
Truly brilliant!
Follow the adventures of the new wandering jews
I don't think it's always technical. A few years ago it seemed like most comments in regard to Java were positive, but when it became evident that it wasn't really "free" in the same sense as is perl or python... then lots of people started bashing it. Though like many languages has it's flaws, it still remains a solid language. The same with VB, virtually no-one in *this* audience considers VB a great language, which is reinforced by the fact that no-one's really putting much effort into creating a VB like tool for Linux (albeit there are several dead projects that have tried). It's a shame because VB actually works quite well for a particular niche- quickly developing business apps. In the case of VB, I can safely predict most people here will not give it credit because of it's links to Monopolysoft.
Blender And Linux Fan
<%@ Language=VBScript %>
Is you see this, please call Crime Stoppers at (888)580-TIPS.
>>I wish some higher level languages would force the use of comments in code, make it part of the declaration for a class or function.
I'm not sure if that would help... how many "// fucking compiler requires this" comments would you see?
/* this is the mandatory comment */
7 November 2006: The day Americans realized corruption and incompetence weren't addressing 11 September 2001
But, there are MANY times when operator overloading would make things sooo much easier. Which would you rather read:
complex z1(0,1);
complex z2(1,0);
complex z3 = z1+z2;
or
complex z1(0,1);
complex z2(1,0);
complex z3 = complexMath.Add(z1, z2);
?
(The second is still better than z3=z1.Add(z2) IMHO)
I'll take the first any day.
ANSI C itself is at least stable. The procedural part of the language is generally accepted (it's basically the same in Java, C++, etc.) The declaration syntax has problems. It's broken for historical reasons. Originally, C was LALR(1), but then came "typedef", and it went downhill from there with "class", etc. Nobody has been able to fix this properly. This is why the parser gets lost in so many error situations.
C++ suffers from some early bad design decisions. Templates came late. Strostrup knew about templates, and decided not to put them in. This led to great pain and ugly code, templates went in, and it's taken a decade to clean up that mess.
Java was supposed to clean this all up, but now Java is getting generics, which it wasn't supposed to need. So it's going down the same path as C++, but with a new set of mistakes.
Other attempts to fix C include Objective C (which still has a following) "C+@" (a Bell Labs product that predates Java), "C#", a Microsoft variant, and several others with tiny market share such as "D". None are enormously better than C.
I'd like to see C++ cleaned up, but the ANSI committee is more interested in putting in obscure features for template writers.
I hate to break it to you, but compiled BASIC is very very old, long before VB. I remember compiling eBASIC startrek games in 1979 on CDOS (a CP/M variant from Cromemco).
Shhh, he's having a Microsoft bashing moment... it could be dangerous to interrupt slashdotters whilst in this state, you never know what they might do...
Phil
"Cattle Prods solve most of life's little problems."
Actually i enjoy programming in a lot of languages and, as problably most who programmed for a while, the problem is seldom the language (otherwise you chose the wrong for the job).
:(
But it always get's ugly when it comes to debugging. You're in a bad mood anyway (it's a bug - probably your bug - and it will cost you, very probably, even more time than programming the whole f**king function).
No matter which language, after a while you start hating your debugger. You're programming 3D and have a problem with vectors - all u see variables with some numbers. You're programming a database and the results don't fit.. all you see are variables with wrong result. Etc...
It's always like your car broke down and you get messages like iron content of bumper 100%, mass of bumper 1.4, foo.ineedtorenamethis 1.5...
And then you gotta dig through the dirt
I'm a writer, a poet, a genius, I know it. I don't buy software, I grow it.
It is easy to rip on an article with the sort of vacuous criticisms you fired off, but you really did not address a single real issue in the article. First off, you make it sound like he is advocating JS, which in reading the article is clearly not the case.
Secondly, covering your criticisms:
When he said that working with anonymous structures or structures by reference can be ugly, you interpreted 'ugly' as 'looks like.' But the ugliness in 'my $count = keys %{ $self->{groups}[HACKERS] };' is ugly in more than just looks.
The poster above already pointed out your gross oversimplifications regarding Java.
Finally, your point that "there are much worse things to complain about languages, besides syntax, and inappropriate usage," is correct, and the article itself does just that.
In short, your analysis is overly simplistic, and full of fluff.
Hyperbole is the worst thing ever.
A programming language where I don't have to do any work. One where I can just decide, "hey, I have a great idea for a program" and then discover that my computer had already programmed it for me.
There's a growing sense that even if The Future comes,
most of us won't be able to afford it.
-- Lemmy
Other than that, the language is just like the favorite couch - it doesn't really matter where you sit, but that one just happens to be more comfortable.
That's one of the reasons .NET is cool. It provides a unified runtime library that caters to any number of languages, as long as someone has bothered to port them. The end result should always be the same. We joke about COBOL.NET, but the reality is, it's made possible by this - dare I say - revolutionary idea. Soon we'll have Python.NET, Perl.NET, Ruby.NET, PHP.NET, etc, etc.
You will be assimilated =)
Bjarne wanted to put generics in from the very beginning.
Java "cleans up" nothing, it simply strips out all the more powerful features of C and C++ which novices tend to stub their toes on. Oh, and it adds one important feature: inner classes. Unfortunately the result is a language whose omitions actually make it more verbose and harder to maintain than C++.
Neither ObjC nor C# is an attempt to "fix" C; Objective C is an attempt to embed a Smalltalk object system in C, and C# is an attempt to fix Java. Neither of them are applicable to the same problem domains as C.
Everything in C++ belongs there, and most of it was intended to go in from a very early stage. The only thing that needs to be "cleaned up" is the C preprocessor. Templates could use easier syntax but no one has come up with anything signifigantly better than the current syntax.
--
CPAN rules. - Guido van Rossum
I think that this won't happen, partially for Mr. Kringle's comment above, but mostly because there is a difference between what you do and why you did it (and again from why you didn't do it a different way). You can see function, but you can't necessarilly see the intent of the programmer. There are many times in my programs where a single line (often, less than 10 characters long) will result in several lines of comments explaining why it is done that way. That way, the poor boob who inheirits the job of extending/fixing the program (who is usually me) has a fighting chance of figuring out my intent, not just my procedure.
you should read everything on the internet as if it had "but I'm probably talking out of my ass" appended to it.
I can't stand machine language. I'll be typing along and accidently type a '0' when I meant to type a '1' and my program goes apeshit. They should fix that.
Probably about as many as the number of "// TODO: Place code here" in Visual C++ projects.
The cake is a pie
Better would be languages which are self-documenting...
There is no language that will force perfect code. There is always room for a poor programmer to produce hard-to-understand code. Functions that do two unrelated things, confusing control flow, bad variable names, broken code that was repeatedly patched instead of being cleaned up... the possibilities are endless.
Nonetheless, some languages have been designed with self-documenting code in mind; sometimes it even works.
If you look at languages like COBOL, they have long descriptive keyword names designed to make the code easy to read. But you get tired of looking at those long keywords.
I haven't used ADA, but I understand that it is somewhat designed for self-documenting code, and that as a result you are hemmed in on all sides by language rules. (ADA fans please comment here.)
The best language I have seen for this is Python. As a rule there is exactly one way to do things, so you don't trip over obscure hackish tricks that you have to puzzle out. The language doesn't force self-documenting or comments, but it does force indentation; everyone indents their Python pretty much the same (compare with the mess that is C indentation). The language is high-level enough, with lots of libraries, so you don't need to write 10 lines of code just to do one simple thing.
Python was designed by a guy who is both a computer geek and a math geek. The math geek in him led to a very tidy language design, and I like it very much. I think schools ought to be using Python to teach introductory programming classes.
steveha
lf(1): it's like ls(1) but sorts filenames by extension, tersely
If you overload + so that it suddenly means "Multiply by 34 and truncate to the nearest prime", that's not the language's fault: that's your own fault for being a damnfool idiot. Just like if you overload + for complex numbers so that it does complex arithmetic, it's not to the language's credit: it's to your credit that you used an appropriate overload.
Look at LISP, in which pretty much any part of the language can be overloaded. Nobody's ever complained that this linguistic flexibility has harmed LISP; in fact, this linguistic flexibility is almost universally hailed as one of LISP's strengths.
Parting thought for the overloading-is-bad crowd:
C overloads, too.
After all, you can do:
... I mean, come on. C overloads, so "overloading is evil" is a meme which you really ought to know better than to propagate.
Overloading isn't evil.
Stupid overloading is evil.
And you will never, never, never, succeed in creating a programming language in which it is impossible to do stupid things.
One fault I find with the author's assessment is that he is evaluating the language only from the standpoint of the one who is writing in it. I think a better language assessment would also evaluate a language from the viewpoint of the poor bastard who actually has to read someone else's code written in that langage. Does the language have the tendency to produce code that is readable and understandable by the person who didn't write it? Or does the language have the tendency to produce code that is readable/understandable by only its original author?
For example, Perl allows the programmer who writes a perl program try to make their code as terse and unreadable as possible, fitting everything on one line by exploiting some bizarre behavior of the perl interpreter. While this "expressiveness" might be wonderful to the person who's writing the code, it's really going to be a problem for a second person who might want to contribute to it or maintain the project after the original author threw in the towel or got hit by a bus.
Another example is operator overloading. Perhaps operator overloading is useful to the first person writing the code, as it provides a nice little shortcut where they can do foo + bar as opposed to something like foo.add(bar). But if there's another person who's decided to work on this project, and they're not very familiar with the code and they are trying to get the idea of how it works, how can they tell whether foo+bar is a mathematical operation or some sort of concatenation? Yes, if they look over the code enough, they can understand it. But perhaps that extra amount of fuss and the extra amount of time wasted trying to make sense of things will convince that person it would be easier to write their own stuff than try to reuse someone else's.
A final area I wish the author focused on is documentation. Does the language support some sort of embedded and standardized documentation that make it easier for the first programmer to provide information that would help a second programmer make sense of the code, or is documentation at the discretion and mercy of the first programmer and whatever bizarre and non-standard documentation system they might use?
I would suspect that projects using languages that make it harder on the person who has to read the code have higher incidences of duplication of effort and a great NIH (Not Invented Here) tendency.
But that's just my opinion.
Ergonomica Auctorita Illico!
I don't have any hands you insensitive clod!
Do you even lift?
These aren't the 'roids you're looking for.
Except that you messed it up. The question mark should indicate a boolean return value.
(define language? (lambda (x) (equal? 'scheme)))
You can tell my code is better, because it has more trailing parentheses.
Smalltalk is quite self-documenting. I'm sure most C/C++/java/Perl/Python programmers think you're joking when you talk about a "self-documenting language," but they're real.
:= 1. ":= is assignment" :a :b | a + b ] "block creation- a block closure, aka anonymous subroutine"
A simple langauge plus a decent code browser can equal a self-documenting language. Methods are organized into logical groups (e.g. "accessing" "initialization" etc), and clicking on a category will tell you the methods there. Especially when there is a tradition for short (7 lines or less is the rule) methods, as in Smalltalk- you can usually see what the entire method is doing just by looking at it, if you cannot guess at what is is for by looking at the name.
People may think this is an exageration, especially if they're used to systems that require various man pages, books, and on-line class lib references just to write some code. Other than one book on Smalltalk style, I've not read any books on Smalltalk. I read some tutorials when I began, but after you learn the basic syntax [1], the very basic ideas [2], and especially, how to browse classes, you learn as you go, finding out classes to use as you need them.
[1] All of Smalltalk's syntax can be summarized as-
a
obj + 2. "a binary message"
obj methodName. "a unary messsage"
obj methodName: argument. "a keyword message, unlim keywords"
[
[2] You don't even need to know anything about OOP or OOA/D- simpyl the rudiments of *object-based* programming... simply understand that an object is a chunk of data that can do certain things.
Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
Let's start this off nice and flameworthy: what is the point of using C anymore? Nearly any valid C program is a valid C++ program, and C++ gives me the option of selectively using much higher-level abstractions than C can support, with little or no overhead, in a much safer and easire-to-debug way than any pure-C approximation. And most of the projects which are coded in C these days shouldn't even be coded in C++; they should be coded in something higher-level like Java or Python.
C++
Java
Perl
Python
By far the biggest problem with Python is the user community. There's something about Pythoneers that make them glom onto the language with religious zeal, and then go around telling every one else that their own language of choice isn't elegant enough. Many Python users have the mistaken impression that Python is a carefully worked-out work of modern programming cleanliness like Scheme. In fact, Python was an unremarkable in-house procedural "little language" that, rather than dying the graceful death that most such languages eventually experience, was hyped to a larger audience and has been loaded down with all kinds of trendy features. Unfortunetely, due to it's humble roots, these features have gone in rather awkwardly.
All this would be fine, in fact, it would be similar to Perl's story, if it weren't for the singular nature of Python apologists. Python is perhaps the only open-source language whose users will proudly and vehemently defend a language flaw as a feature. The best example is the post-facto rationalization of the extra "self" argument to methods, which the Python FAQ helpfully explains was simply an artifact of the way OO was hacked into an originally procedural language. This fact doesn't deter the fanatics however, who will happily tell you that it was an intentional feature and that it somehow makes Python better.
Other examples of Python's awkward growing pains and the inexplicable attitude of it's users: the fact that Pytho defines private variables as variables whose
--
CPAN rules. - Guido van Rossum
I think you'll find this guy does know how to program.
As well as being well-respected within the Perl community (And possibly other languages too) he's the O'Reilly technical editor, the author of their "Extreme Programming Guide" and the chief author of "Writing Weblogs in Slash".
I have a feeling I may well have just been trolled, but I thought it worth dropping this here so people at least knew that this guy was not some random schoolkid knocking out half-formed opinionating.
My advice: Do a little research before posting
404 Not Found: No such file or resource as '.sig'
Ok begin flaming me but I love what I've seen of C# so far. I'm not a very experienced programmer, but I was forced through C, C++, MIPS assembly, shellscripts, and Java in college. Since then I've done C# and PHP on my own. So far I like C# the best.
Why? C is an ancient ugly mess that needs to adapt or die. I'd hate to do more than a 200 line program in it because I'd get lost without objects. "Oh but you can use objects in C by doing blah blah struct blah blah kludge etc." No thanks, it took me years to figure out what the big deal with objects was and how to use them without overusing them, and I'm never going back now for anything serious.
C++ has objects you say, but they always feel like it's grafted on to C. Granted it works, and it's still reasonably portable, which is C's main advantage these days, but some things are still just ugly. How about an array who's size you don't know until runtime? Welcome back to pointers 101. Sure you can use new and delete instead of malloc and it looks nicer, but alot of things just don't have really elegant solutions, and the standard libraries are too sparse for what modern apps do with modern languages.
Java... everything you hate about C++ fixed the wrong way! Yay we have big useful libraries now... but they're constantly changing, bitching that what you just used is now "depreciated", doing things you're not allowed to do etc. No I do not want to use something called "vector" to replace a linked list, give me a freaking "linked list" object! Even if it's just a renamed vector at least it doesn't confuse people into thinking I'm going to have calculus and matrices popping out in the next few lines. This may have been the fault of my instructor but he loved crap like this. "Don't use the Stack class, use vector to make your own stack!" Oh and just because I don't want to do something with pointers if I can help it doesn't mean I don't EVER want to use pointers, I'd like to code without a babysitter please. If I screw up at least it's me to blame. Everything must be a class! Umm yeah that's great when I just want a struct with an int and a float so I don't have to write half a dozen methods to implement a "proper" class with private data and constructor and operators and copy... Put up with all this and you're rewarded with 10x slower performance and maybe cross-platform execution on alternate tuesdays when it's raining and the moon is waxing.
PHP seems nice, though I haven't really written much of anything in it yet. Some things kinda weird me out like how nothing cares if your variable is an int, float, string, etc. It's kinda nifty but extremely unsettling at the same time. At least it's easy to spot variables since they all start with $. I really don't have much else to say about it yet.
By now everyone's waiting for why I like C#. I like it because it fixes the things I hate about C++ and Java and just seems to make everything work smooth. Want to use pointers? Sure, just put it in an unsafe section for the over paranoid. Want to use objects? It's easy. Want to do threading? We've got this easy to use library for it. How about resize an array? No problem. Arrays remember their own sizes. They can even sort themselves. They can even sort themselves and another array at the same time based on the values in the first array (someone PLEASE show me how to do this with qsort() in C++ elegantly). Networking? Got it. Performance? Eh, about 20% hit from C++ on my machine, less if you use ngen to precompile it. Still too bad? Ok, put your critical sections in C++, C, or even ASM libraries and link them seamlessly. GUI apps? Tons of easy to use stuff there, though it's mostly windows specific. The downside is you don't get the portability of other languages... yet.
Introducing the new Occam Fusion! Now with sqrt(-1) fewer blades!
This was a very interesting article. I natively speak Perl, C, and C++, know enough about PHP to get by, and still remember some Commodore 64 BASIC (10 ? CHR$(147)). I am also, as I believe I've said before, not afraid to learn things like Java, Python, Ruby, maybe even Visual Basic again (God forbid) should they prove exceedingly relevant to my case - in fact, I quite look forward to knowing (hopefully) all of them and then some. But never Pascal. (Just kidding.)
I've really found that the thing I hate most about programming in general is that no single language is the right one to use for any of my programs! I am very interested in any effort I ever come across to do functional merging of disparate environments. In addition to a couple of workarounds I've invented in the past for shoehorning Perl into PHP, I like reading about things like SWIG, the open CLR, and even COM (the concept more than the implementation), and a smile always comes to my face when I think about the Inline library written for Perl.
Now, the thing I really pine for is all of this interlanguage binding stuff being easy, fairly portable, more synactically simple, and less hacky. I know that these exist, but not quite completely together. If I write a program in Perl with use Inline C, I can never be sure that anyone else has all the development tools necessary to compile all the C on the fly. Writing a program in Visual Basic with a nice mouse-drawn GUI and an external component is really easy - but it's Visual Basic. Writing a component wrapper for Perl is fairly straightforward with SWIG, but some well-thought-out language features would make it easier. And COM... I'm going to have to try wrapping my head around that book again someday... I'm sure the ATL makes it all very simple, but can I use ATL from MinGW? From C? From Perl? And don't try to tell me that I need to learn yet another flavor of XML to make all of this work.
That's mis tus centavos.
(Note: I disclaim perfection. Don't hit me too hard; I admit I haven't done enough of my homework to claim this post isn't full of holes. Once I've looked this whole matter through, if ever, and if I still haven't come up with anything good, I may just have to take a deep breath, lay down a syntax, figure out how to use a lexer generator and a compiler compiler, and throw together some ghastly but very easy-to-use homogeneous aggregator system. Either that, or I wait for Parrot to interoperate with Mono...)
As a particular example, take PHP's error handling. The language has no real exceptions, which is forgivable--but it insists of making up for it by faking them.
It has something akin to sigaction(), but much less powerful. It allows you to provide one function to handle all errors, except for some that PHP insists on handling itself. At least that function can switch on the error, right? Nope! There are only 5 different error codes which your code can catch, only 3 of which you can actually throw (again, with a function instead of a language construct).
And if you thought this was bad, try the error handling in the library. Each set of functions seems to have its own function to check for errors, and you have to repeatedly check the manual to find out how a function indicates failure. I've seen the following different methods of indicating failure:
function returns FALSE
function returns TRUE
function prints a message to the browser
function returns 0
function returns 1
function returns nonzero
function returns negative
call another function to find out
functions returns something that can be fed into another function to find out
function raises an error condition you can catch (through fake exceptions described above)
function raises an error condition you can't catch
pass in a variable by reference and the result will be there
check if the returned array is empty, and if it is use a different function to find out whether that indicates an error or just a (legitimate in context) empty array
Don't even get me started on the naming conventions of functions, or the ordering of their arguments. (Check out the array functions if you want some good examples.)
PHP is a language that was designed for small, simple CGI scripts, and it does this well. It does not scale. PHP was never meant to be used from the command line, but how else can you write a cron job to do some nightly maintenance? (Write in another language? Sure, and give up all the libraries you've written for the project.) Sure, you can use lynx -dump http://example.com/nightly.php >/dev/null, but then you have to make sure no one but you can use that script, and it's just generally an ugly thing to do.
For all of its faults (and it has many), one of the thigs Perl does well is provide actual language features for things like merging arrays, sorting arrays with a user-provided comparison function, or declaring a variable with loop scope. PHP's libraries keep growing, which is nice, but the language itself is too small and too limited. I don't want to use library functions for everything, nor do I honestly care whether the language is even context-free. I just want a lanugage that doesn't suck.
</rant>
Gates' Law: Every 18 months, the speed of software halves.