An often fruitful brainstorming technique is to look at some attribute, assert the opposite, and then stress it to an extreme.
As a thought experiment in language design, consider a highly structured language in which There Are Few Ways To Do It, or even There Is Exactly One Way To Do It, TIEOWTTI.
I have some ideas, but I would like to hear others before contaminating yours. This is not a troll or a homework. I'm thinking about what are the benefits and costs of languages with complicated syntaxes versus other sorts of languages.
Assume there exist perfect tools which compile to perfect do-what-I-mean code, regardless of syntax.
- Mitch
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: TIEOWTTI
by Ovid (Cardinal) on Apr 15, 2002 at 20:27 UTC | |
The difference between the "one way" and "multiple ways" is often a matter of the power behind the language. From what I have seen, languages that boast "one way" tend to be easier to learn and are often a better environment for programmers of low to medium skill. However, advanced programmers often get frustrated when encountering an implementation obstacle generated by the "one way" paradigm. With Perl, "multiple ways" tend to offer much more power and flexibility, but at the cost of added danger. From what I have seen, programmers need to have a higher skill level to tackle tough projects in Perl, but the reward is fewer obstacles. For example, I've never seen an AUTOLOAD type of functionality in Java. I can't do multiple inheritance if I think I need to. I can't do closures with Python. Most of the time, we shouldn't be allowed to even dream of doing some of those things, but if we need to, it's nice to know that we can. Cheers, Join the Perlmonks Setiathome Group or just click on the the link and check out our stats. | [reply] |
by cascade_fx (Sexton) on Apr 16, 2002 at 13:47 UTC | |
The difference between the "one way" and "multiple ways" is often a matter of the power behind the language. From what I have seen, languages that boast "one way" tend to be easier to learn and are often a better environment for programmers of low to medium skill. However, advanced programmers often get frustrated when encountering an implementation obstacle generated by the "one way" paradigm. While I fully adhere to the There Is More Than One Way To Do It philosophy of Perl, I do have some experience which marks a more concrete benefit of the There Is Exactly One Way To Do It. While a more structured language may be easier to learn, more importantly (I think) it offers benefits in automatic/compile-time optimization. While in college, I took a high performance computing class where we learned all manner of ways to exploit architectural differences in various platforms as well as ways to exploit code structures to gain an increasing number of performance enhancements from particular pieces of code. We did most of our work in C and would use all the compile time options for optimizing compililation that the compiler offered. Generally we got pretty good results. However, when the problem was rewritten in Fortran using the same techniques and compile time options, it was much much faster. The reason being that Fortran's data typing and control structures require that they are strictly adhered to. Because of there being exactly one way to do it, the compiler can make optomizing assumptions that it just can't do in C (having to cover all of its potential bases). I love Perl and I think its benefits outwiegh any problems. In fact, I am happy with its performance, finding it to be a lot faster than I expected. It just seems that TIMTOWTDI may hamper its ultimate performance. On the other hand, writing a C program that can do the same complex manipulations that the average Perl program does can be very time consuming. Seen in that light, Perl gains its optimization benefits on the front end of a project. Then again, I could be wrong -- cascadefx | [reply] |
Re: TIEOWTTI
by tachyon (Chancellor) on Apr 15, 2002 at 21:27 UTC | |
Perl is like rope and what a long rope it gives you. Like rope you can use it to tie things together or.....hang yourself so you can die horribly. Is rope inherently evil? Inherently good? Useful? Dangerous? Is it easy to learn the ropes? Should rope be kept out of the hands of children and minors? compile to perfect do-what-I-mean code No computer does what you mean. Computers are dumb as a box of hammers and do exactly what you say, no matter what the language (unless there are bugs in the compiler in which case they generally core dump :-) See AlsoSNAFU-principle
cheers tachyon s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print | [reply] |
Re: TIEOWTTI
by tadman (Prior) on Apr 15, 2002 at 22:37 UTC | |
By the same analogy, Perl gives you about five hammers of varying size, from small to large, some easy to hold and comfortable for long periods of use, while others are big and heavy and tricky to use properly. There are even a few things that can work like a hammer, either in a pinch, or by design. On top of that there are things that do hammering quite well but aren't even hammers. There are even things that can be made to hammer, even though they aren't supposed to and people are often shocked that they can. So where a normal toolbox would have the usual implements, Perl seems to throw in some tools that can't be described in terms of regular tools. There are some "Swiss Army" type tools, and there are some very specific tools for that rare occasion when you need them, but when you do, you'll be glad that they're there. The great thing about TMTOWTDI is that you can choose which way you want To Do It. Maybe you're only used to working with hammers and screwdrivers and the other things frighten you, which is certainly likely given some of the truly abstract tools found in Perl. Nothing forces you to use all the other ways, of course, excepting the natural urge to explore, and perhaps a good dose of Laziness, Impatience or Hubris. If anything, Perl could stand to have a few more things thrown in for good measure. With Perl 6 I'm sure there will be a lot of new toys in the toolbox, and Even More Ways To Do It. | [reply] |
Re: TIEOWTTI
by brianarn (Chaplain) on Apr 15, 2002 at 21:41 UTC | |
This was utterly disgusting to have to do, as I didn't know TCL at all and had to learn the language. The company I worked for was really big on TCL, even though I wanted to use any other language, like Perl or PHP. After learning TCL and then learning Perl (which by no means am I done doing, there's still SO much to learn), I've noticed that TCL was much more simplistic. It wasn't exactly TIEOWTTI, but TAFWTDI (there are few ways to do it). In that sense, it was much more straightforward for a new coder. I later discovered that this simplicity in TCL was why the company chose it over a language with more ways to do it (and hang yourself doing it). The code that I was working on would be put into production, and I'd be moved onto another project, another site, whatever - and someone would come along later to maintain it. I'm not saying that someone else's Perl is necessarily less maintainable than someone's TCL code, but to be honest, it seems that languages with fewer ways to do things are good for cases where multiple people will be maintaining the code over the span of some years. Just a few thoughts as to why fewer ways are sometimes nicer. ~Brian | [reply] |
Re: TIEOWTTI
by grinder (Bishop) on Apr 16, 2002 at 10:01 UTC | |
What is difficult is mapping your problem domain to the language. I often find myself wanting to attack a problem in a certain way, and after frustrating myself for an hour or two, come to the conclusion that it's not possible, so I have to throw away the code and start off on a different tack. It comes down to second-guessing the language designer, thinking how they thought, trying and come up with an approach that will fit in with the language. In this sense, it's a much more constraining experience. You're not actually expressing yourself, you're just trying to get a job completed by trying to slot your square pegs into the language's round holes. Another aspect of this debate is orthogonality. The word gets bandied about a lot, and I'm not sure everyone agrees on what it means, I'm not sure I even understand it myself. But what it means for me is that something you pick up in one corner of the language can successfully be applied to another part of the language... and it will work! Perl excels at this sort of thing, like the notion of the last expression in a block is returned, and lazy evaluation and what not. Visual Basic is an utterly unorthogonal language. It has a sort of object dot notation syntax, so you can say
... but, in some instances, that doesn't work. For reasons that escape me (no doubt due to the evolution of the language over the years (god only knows what the parser source looks like)), you come across strange cases, where you have to do something like
And that is the only way to do it! Okay, it's a bit of a pathological case, but I think you get the picture. Languages that let you do the same thing in different ways by definition tend to stay out of your way, so that you can concentrate on the task, and not have to keep adjusting to the tool. update: missing "from" noted by tye. Thanks :)print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u' | [reply] [d/l] [select] |
Re: TIEOWTTI
by stephen (Priest) on Apr 15, 2002 at 21:10 UTC | |
Of course, this isn't TOO different from XSLT, just a change in emphasis really. But still, practically any human-usable language will have MTOWTDI. We are creatures of ambiguity. stephen | [reply] [d/l] |
Re: TIEOWTTI
by Sweeper (Pilgrim) on Apr 16, 2002 at 05:44 UTC | |
Consider societies: which societies are the most prosperous? Societies with a single political party or societies with More Than One Way To Think? | [reply] |
Re: TIEOWTTI
by BUU (Prior) on Apr 15, 2002 at 21:26 UTC | |
| [reply] |