Quote:
Originally Posted by
matsp
Speed of development is a compromise. You can have lots of freedom (which often translates to being able to write high-performing code), or you can have a language that gives you lots of functionality - but not quite as much freedom.
Thank you for a detailed well explained answer. But I am unable to see the point here. I see no flexibility loss when doing Perl. I want list of file names. Easy. I want them sorted. Easy. I want them based on a pattern. Easy. What I lost here? Flexible also. I can do whatever I want.
Quote:
C is a low-level language. It gives the developer a good level of control of EXACTLY what is going on. But this also means that the language is quite complex to develop code in - because you need to give the compiler a lot of details of what you want done, and how you want it done, when you want it done, where you want it done, and which colour you want it done in. On the other extreme we have shell-scripts and batch-files for example. They don't allow much flexibility or detail on what gets done - but in a few lines you can write something that does quite a bit of work. However, if it's calculationally heavy, then it's going to take quite a bit of time to complete (assuming you can even express what you want done). And like Ford Model-T, you can have it in any colour you like, as long as black is the colour you like, and it's delivered when it's ready - whenever that may be.
I was impressed with how simply a language can be expressed. Which can do do much of stuff. I am not a fan of brain........ language. Which means being small is not my preference. But C being so small and still so useful is what I like. When I say C is slowing me, I mean, for example:
in Perl I would read a line like this:
$line = <STDIN>;
In C I had to estimate my longest possible length of line. Then create a char[] large enough. Then after reading from stdin I had to make sure no data was left in input buffer.
But on a positive side, Perl can not write another Perl. C can write many Perl like languages.
Quote:
Assembler goes a step further than C, and thus takes even longer to develop code in.
Yeah. I just ordered my Pentium* manuals from intel. They are shipping for free. I am really excited about MMX/SSE* struff. I know nothing about them yet.
Quote:
Unfortunately, it's hard to define a language that gives the programmer freedom and control, as well as simplicity in use. C++ gives the user some choices here, since if you want full control, you can use it like C (for the pedants who like to point out that C and C++ do not support exactly the same things, it is ALMOST the same language as C), but you can also use the Standard Template Libraries (STL), and various other "ready made" solutions that give a reasonable compromise between development speed and freedom.
Shell scripting is extreme example. It is more of command control language rather than a programming language. But I do not get the point of flexibility loss. Again.
Quote:
Of course, to write high-speed code, you also need to use the right algorithms - if the programmer uses the most stupid bit of code in highly optimized assembler, it will probably not beat a "slow" language using a fast algorithm. Being clever about things beats having a fast language. We can estimate that the speed-up of a fast language is about 10x that of a slow one (it obviously varies a bit - 2x - 30x would be a likely range). But if we take an example of searching, where we have 1 million items in a list, and the "stupid programmer" chooses a linear search - on average, we will search half the list, so 500000 "hits" on the list. A binary search will do the same in maximum log2(1000000) "hits", which is 20 "hits". So it's about 2500x faster.
Yeah. In a book. This was the first thing that inspired me. That think better algorithms first. They will speed up in any language.
:)