views:

224

answers:

6

I was teaching my wife C a few days ago and went on to teach her the basics of C++.

Now my question is all programming languages have been devised so as to make our mode of communication with the computer easy right ?

Else it would have been a chore communicating with them in machine language instructions, right ?

So programming languages are just for human convenience right ?

+2  A: 

Yes. That is the core idea of high level languages. Providing a more human friendly interface between the computer and the human.

Years back the programmer was needed to know about the internal architecture and program using a low level machine instructions. Day by day the languages become more human friendly.

Example :

; Hello World in 68000 Assembler (Atari ST)

 move.l #helloworld,-(A7)
 move   #9,-(A7)
 trap   #1
 addq.l #6,A7
 move   #0,-(A7)
 trap   #1
 helloworld:
      dc.b "Hello World!",$0d,$0a,0

But now you can use java and say,

system.out.println("Hello World");

The Wikipedia contains a brief but nice introduction on high level languages.

Chathuranga Chandrasekara
Where is Hello World in brainfuck?
Hamish Grubijan
Well, that line of Java with a bucketload of supporting infrastructure like imports, the class definition, the static main and so forth. You would have been better off using Python where you really *can* do that in one line.
paxdiablo
@ lpthnc : Ha Ha.. Nice idea.. Here we go... http://en.wikipedia.org/wiki/Brainfuck
Chathuranga Chandrasekara
brainfuck is fantastic.good to hear.
Jichao
+3  A: 

In a word, "Yes". But each language is born out of a different need. Some require more expansive ways of describing problems. Others come from a need to perform a very specific task in a very specific way. Some are meant to do simple things very efficiently, and others are meant to do extremely complicated things with a minimum of task description, and so on.

But yes, at the core, each language is some intermediate language that ultimately is written to save us from having to remember

10110110 11100100 11010010
10101110 11100000 11111010
10010110 10101010 11000001
Joel Etherton
+4  A: 

Convenience is one way of putting it.

A programming language, and programming in general, is about reducing complexity. Taking a process or concept that is difficult or impossible to express at the lowest level and molding it into something much simpler to work with.

Aaronaught
+1 Although, I would say 'reducing' isn't the correct word; it's more about how we *manage* complexity. Managing complexity has the added effect of making a complex task *appear* less complex. Even though the complexity still exists, we aren't always aware of it.
Charlie Salts
+3  A: 

Now my question is all programming languages have been devised so as to make our mode of communication with the computer easy right ?

That's part of it, yes. All programming languages specialize to some degree on the tasks they try to solve. Some try to be good general-purpose languages, suitable for a variety of tasks. Others tend to be better at specific tasks, like text processing (e.g. Perl) or visualizations (e.g. Processing).

So programming languages are just for human convenience right ?

It's certainly true that programming languages make our lives easier. But we don't use them just for the convenience. We use languages for many different reasons:

  • Higher-level languages allow us to express highly abstract concepts in concise ways, without needing to overspecify the system.
  • Some languages adapt well to changes in design and requirements that we might encounter.
  • Lower-level languages offer more micromanagement and control over exactly how things are done.
  • Dynamic languages allow us to be more flexible with the kinds of types we can deal with.
  • Functional languages allow us to express complex relationships as a series of simple operations.

All of these combine to give us very powerful tools to choose from when we tackle problems. That's the real reason we use programming languages: to make it easier and less painful to solve what would otherwise be very complicated problems to express in machine language.

John Feminella
A: 

Yes, because..

  • You want to do more with less
  • You want to automate tedious repetitive tasks
this. __curious_geek
+2  A: 

At its most basic, yes, programming languages are just a "convenience". But it is actually more than that. It's abstracting ideas from mechanics such that those ideas become clear and more meaningful.

To illustrate, I'll use a "programming language" that is much older than the concept of mechanical computers: algebra.

Yes, basically algebra is just a convenience for mathematicians to write equations in shorthand. But it is more than that, it makes concepts in mathematics clearer and easier to discuss. Imagine being a mathematician in Pythagoras's time who did not have access to the "programming language" called algebra. Working in mathematics involves reasoning with the "assembly language" called "human speech":

The area of a square whose sides are constructed from the hypotenuse
of a right angle triangle is the sum of the area of two squares constructed
from the remaining sides of the triangle.

This was actually how the ancient Greeks reasoned in mathematics. And it was tedious. Then the Arabs came and invented symbolic manipulation and implemented it in the "programming language" called algebra. Now you can discuss the Pythagorean theorem clearly with:

 2       2        2
a   =   b    +   c

Much easier to manipulate and use. Even though both methods of reasoning are technically the same using the algebraic form to find the length of a side is easier:

           _______________
          /
         /   2        2
b   =   V   a    -   c

Imagine trying to figure that out without algebra.

It's similar with programming languages. If you just work in assembly or even C you will never consider concepts like closures, continuations, monads, object orientation etc. Some of these concepts are fundamental to computer science but is very alien to computer hardware. To work comfortably with these concepts you need to abstract the ideas away from the implementation - thus programming languages are born.

slebetman
+1 nice answer.
Jichao