[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Low-level vs. High-level programming (was My First Computer)



Kelly Hall <hall@priest.com> wrote:
| "Kevin Lawton" <kepla@btinternet.com> wrote in message
| news:bcplc6$b5e$4@titan.btinternet.com...
|| One thing I have noticed is that
|| programming languages seem to evolve to absorb the processing power
|| available to them. Assembler and C are massively powerfull and
|| efficient, but require much skill to use properly. The result is
|| small fast programs which can get the best performance out of the
|| hardware they are running on.
|
| In my opinion, *programs* can be fast and efficient; programming
| languages themselves are rather neutral.  For example: a good
| programmer can implement a fast and efficient algorithm in Java that
| would outperform a bad algorithm in C.

I think it would take a brilliant Java programmer and an extremely bad C
algorithm for that situation to arise.
My point was that given programmers of reasonably similar competency, the C
code will be smaller and quicker than the Java. Also, I would not expect the
C programmer to take much longer than the Java programmer to write their
program, though Java programmers appear to be paid a littlew more than C
programmers. Net result, similar development costs but less efficient Java
programs.

| By the time you figure in development time (writing a web server in
| assembly will likely take a lot more time than writing a web server
| in Java) and account for best usages in each language (I'll probably
| spend more a lot more time analyzing when data is allocated and freed
| in C than in Java), I find Java isn't all that inefficient for my
| desktop and server programming needs.  Use the right tool for the job
| at hand: for a lot of my unix programming I use Perl - sure, it's
| grossly inefficient, but for parts of my system that doesn't need to
| run fast, perl is very convenient.  I use C when performance is an
| issue.  When I have Unix systems too small to support Perl, I use AWK
| or Bourne shell.

I too use scripting languages, especially for 'quick and dirty' jobs - I'm
no stranger to sed, awk and Perl myself.
I've found that Java often tends to be too slow for desktop programming as,
unless you are running on an n-GHz machine you can actually watch the screen
being painted. Resource use in Java also seems to be somewhat higher than in
C.

|| Java, HTML, etc are barely 'coding' at all - they are more like a
|| technical specification of a program than the program code itself -
|| the result being that the computer has to do far more work at
|| runtime to sucessfully execute the program.
|
| HTML doesn't describe computation - it's a markup language for web
| pages; what exactly did you mean?  JavaScript?  ASP?

Wel - yes, if you want to be specific.

| Java isn't much different than C when it comes to expressing
| computation. In neither case can I say something like:
|   given an array a[0..i]
|   return a[0..i] such that for all j=0..i-1, a[j] <= a[j+1]
| and have the compiler magically cough up a sort routine.  Are you
| thinking about functional languages like Haskell and SML?  I've seen
| quicksort as a one-liner in Haskell.

Okay, in the above example you'd be writing a sort in C or assembler,
whereas in Java you could arrange your program to use array manipulation.
Some of the older languages, Cobol for example, can manage to sort an array
in a line or two of code. Once you're experienced enough to have done this
sort of thing a few times before, it doesn't take that long to write
whatever your chosen language is. My point relates to the size of the
resultant code and how long it takes to execute.
Kevin.