PDA

View Full Version : Are so many programming languages really necessary?


Mogura
05-22-2008, 08:10 AM
This thread is an offshoot of the one I started in the Work and Education forum, Why careers in programming suck: To view links or images in this forum your post count must be 2 or greater. You currently have 0 posts.

I read through some of the threads in this forum regarding the self study of programming languages. For someone starting out in programming, and trying to decide which language to learn it must be overwhelming, with all of the choices available.

The question is, are so many programming languages really necessary, and how did we end up with so many programming languages in the first place? (OK, that's 2 questions).

When it comes to natural languages, the number of languages in the world are rapidly decreasing as we standardize on a common platform (English). However, when it comes to programming languages, we are moving in the opposite direction.

Is it just not possible or practical to standardize on one or just a few programming languages? Could we not just standardize on C++ (or some other platform)? Or is it that there are some features in other programming languages that just cannot be implemented in C++?

Could some of the programming gurus in this forum provide some insight? I would like to understand this better. Thx...

thod
05-22-2008, 08:59 AM
C++ is good, you can do anything with it. But it is big and clunky. The problem is you cannot do things as fast with it as you can with other specialized languages. If you wanted to interrogate a database and show the results in nice forms then C++ is not the language of choice. The other language already knows how to talk to Oracle and how to query it, it has predefined forms that are simply configured. You can knock up a working app very fast. Doing this from first principles with C++ would take much longer. Even if you had a class library to do all this for you.

We use C++ because you can do anything. When you hit the limits of what the package can do you can always write something to make it do exactly what the clients want. The trade off is always flexibility v development time. Take SQL for example, its a very good language for querying a database. Its results based so you dont need to know the data layout on the disc's. The SQL engine may be written in C++, it parses your SQL query and finds the data according to the engines rules. Now you could do the engine writing or you could go to disc yourself with Read() and Write() but the time taken to develop that would be much greater.

MikeMayer
05-22-2008, 04:09 PM
Different programming languages are better suited for different purposes.

A great example of this is that thing that people use to make the internet.... HTML.

Some may argue that its not a programming language but I would say that it is in fact. It follows all the things that any sort of scripting or programming language does.

You could express HTML in a EBNF form (Extended Backus–Naur form To view links or images in this forum your post count must be 2 or greater. You currently have 0 posts.)... A trait that a "programming language" requires.

However, its extraordinarily high level and thus is easy to be grasped by anyone (myspace peoples sometimes get good at it...).

Along those same lines- Java, C++, and the many of the C family are so syntactically similar that its easy to jump around them as your needs see fit.

Java is a very useful educational tool and lots of universities teach it exclusively in introductory comp sci classes since the students can deal with the paradigms of programming and not the tedious memory details... That's, of course, not to say that it's any less than any other language. Just different.

C++ is extraordinarily powerful but requires the programmer to take care of a lot of things more modern languages handle built in. Memory management being what I'm thinking about upfront.

A very Microsoft centric business world makes it so that C#/VB.NET and the other languages that run on the .NET CLR the defacto languages for "business/enterprise apps". This isn't to say that they aren't good for anything else. They are certainly great languages and have a lot of usefulness. Its just too bad that the .NET CLR is exclusive to Windows. (Mono isn't quite perfect).

=====

So what it comes down to: There are a lot of different programming languages because there are tons of applications which have different requirements.

You couldn't expect a watch or a microwave to be programmed with C++ (i'm sure it happens but...) its probably just microcode or some kind of assembly language that's translated.

Just like you wouldn't expect a behemoth of an application like Word to be written in assembler (although its NOT impossible... just... well I wouldn't want to be the guy on that team).

So yeah, different kinds of apps, different requirements, different timelines... manageability, maintainability, cross-platform, scalabilty... etc

Those are the things that people need to consider when choosing a language to code anything in.



Additionally, functional languages like Lisp... those are in our future for multi processing systems. Languages like C++ have numerous problems with sharing memory with many CPUs that functional languages do not have.

That being said.. I think people should standardize on a language like Python... which isn't entirely a functional language but is very close.

To view links or images in this forum your post count must be 2 or greater. You currently have 0 posts.(programming_language)

pitseleh402
05-27-2008, 03:53 AM
Before I delve into the main topic, I would have to say I'm somewhat shocked to think that natural languages in existence are converging (standardized) around English. I don't think that's true, not that it'd be an easy task to prove or disprove. I know that the number of extinct languages are on the rise, but that's mainly because the ethnic groups responsible for the languages go extinct. That on its own is considered a big problem among sociology circle. Diversity, yada yada...

I'm gonna aim for the lowest-common-denominator, so don't get offended if I seem to spend too much time in basics.. I tend to get caught up in the fine details (occupational hazard as a computer scientist). Please don't feel intimidated. I will try to make it clear the parts that are important, so you can safely skim over fine details without trying to remember everything.

Why do we have this wide variety of programming languages (PL)? Answering that question should probably begin with thinking about what exactly PLs are designed to do. One of the fundamental things that they teach in computer science(CS) courses (the academically oriented ones, not vocational) is the concept of abstraction. Before giving away too much, PLs are the very embodiment of that philosophy of abstraction.

It goes without saying computers are immensely complicated device, probably the most complicated among human creations. At the lowest level, computers are just calculators. They essentially do everything that they are told to do, down to the very last detail. Since we're talking about the ontology of PL, we can safely disregard pretty much everything except the CPU. There are two parts that are of interest in a typical CPU; registers and execution unit. Registers are very small memory that can hold small piece of information (32bits in 32bit machines and 64 bits in 64bit machines.. etc). Execution unit is essentially the "calculator" part. You can give it two numbers, tell it to add/subtract/multiply etc, and it will return the result.

Just like you have heard millions of times, at that level, every thing is ones and zeros. For instance, here's a single machine instruction for x86 architecture.

00110000110000100100

What that does is to add two numbers; one found in a register called ecx, and the other found in esp. (This is not strictly true, but I'm just gonna leave it at that since we're not here to discuss x86 instruction set architecture specifics.)

That's the level at which programmers worked in in the 50s. (you know, the punch cards and such). All I can say about that is, I'm very glad that I wasn't around back then.

One thing they did to "raise" the level of abstraction is to invent a primitive translator. With it, they can write this code,

add ecx,[esp]

feed it to the translator, and the translator will spit out the above 0s and 1s. Much more convenient and easier to understand than simple 0s and 1s. This is called assembly language. Note that there isn't much else to this translator (that's why it's called translator, not "compiler").

Programmers started to actually "write" code in this language, and that went on for a while. That's all they had at the time, so they used this to do everything, write operating systems, device drivers, financial software, missile trajectory calculation, etc etc. It's much easier but still very hard to use since, as computer scientists would say, the level of abstraction is too low.

What you have to realize is that, modern computers operate essentially the same as the above. At the very low level, those intel core 2 duos and amd opterons are all executing a stream of machine instructions, really really fast. It's just that nobody programs at that level anymore.

Now, let's go to the other end of this. Take the following expression in c-like syntax for example.

z = x + y;

To humans, that's very easy to understand. Take the value stored in x and the value stored in y, add the two, and store the result into the variable called z. One can expect the z to contain the sum of x and y after that instruction has finished executing. Now imagine what would the CPU have to do in order to make that happen (implement). Then imagine the amount of effort that would be required to do the same using assembly language or even machine instructions.

It is very easy to mistakenly think that the computers themselves are operating at much higher-level than what they used to in the dawn of computing. They aren't. We humans just got better at dealing with the complexity. And PLs are the fruit of such effort.

As I mentioned above, I consider myself fortunate to be around this time as a computer scientist. However, the flipside is true as well; I would be even better off if I were around later in the future (well, assuming we don't destroy ourselves before that future date). The field of computer science is merely at the birth stage. Computers haven't been around for that long, much less the modern ones. There are first-generation computer science researchers that are still alive. (A contrived analogy would be like having Pythagoras alive and kicking these days.)

Unlike the hardwares that have seen exponential growth rate in the 90s and early 00s, software has stagnated. Or, rather, it just never took off. It was never even on the linear growth pattern. Take C/C++ for example: the essence of that language paradigm have been around since 70s (when C was invented). It's mind-boggling that how conservative programmers are in that regard.

New ideas are constantly generated in the research community, and only fraction of that ever see the light of the day as an actual implementation, used by programmers. Truth is that we still don't know how to program computers effectively, much less easily. And that is at the heart of the reason why there are so many programming languages out there. If we had some sort of divine knowledge on how to easily develop and optimize software, we wouldn't be swamped by the sheer number of PLs that are out there currently.

On a more pragmatic note, I think the question was actually two-part (well it was, but I mean in different way. The original two questions actually shared the same root). Is it necessary that there are so many programming languages? And is it necessary to learn all that?

I think your original analogy would work better in answering this question. There are many many natural languages out there, but it isn't necessary to learn all of them. If you were to travel to Japan, for instance, learning Japanese would probably be a good idea, especially given how Japanese people are usually quite bad at English (It's ok, I'm part Japanese so I can say that ;)). I'm not trying to promote ethnic stereotype (needless to say, there are Japanese people who speak very good English), but it is true. You can't really fair well knowing just English there.

However, regardless of what part of the world a particular language was originated, we can expect the language to have words for concepts like sky, trees, people, water, air, etc. To an extraterrestrial trying to learn about life on earth, simply learning the French for the sake of learning that particular language is probably not the best strategy. It can learn about French words for sky, trees, people, water, air, but it would never truly understand the actual meaning of them, much less get to _use_ them unless they travel to earth, specifically the French-speaking regions, in their UFOs or particle transporters. (Yes I did go a little too far on that analogy.) And, even if they master French, they would still not be able to communicate well in the States. However, they would be in much better position to learn English. The point here is that learning a specific language for the sake of learning that specific language might not be the best path to learning how to "program" computers, i.e. how to get computers to do what we (humans) want them to do. As scary as it might seem at first, it is _necessary_ to have a working knowledge of what goes inside, i.e. what actually happens when I write such and such line in this particular language.

As a result, I can't point out a specific programming language that's all that's needed to learn how to program computers. Some people mentioned C++, and yes, it is a very versatile language, but at the same time, rather hard to learn. Without exaggeration, in order to get to the level where you really know what you're doing with C++ (which is probably the level that "professional" C++ programmers are), it usually takes several years of effort. Java is a good choice, especially as a learning tool. On the interpreted side, python and ruby are good choices as well.

As I mentioned above, these languages, especially the popular ones, all have strengths and weaknesses. And above all, there was very specific reason why they were created and became popular in the first place. It's not only important to note such points, but also crucial to understand the reasoning behind them.

This rarely occurs, but it is my opinion that learning a new language should start with essentially a hunger for certain attribute. Once such need is located, and a suitable language found, the matter of learning is merely the act of quenching that thirst. Learning a new language just for the sake of learning that language not only will prove difficult and, worse, boring, but ultimately useless. As I mentioned above, PLs are human inventions that provide necessary means to programmers to tackle the giant hairy, and extremely dumb and ego-less, beast of modern computers.

b.

AutisticCuckoo
05-27-2008, 05:24 AM
First of all, I don't agree that English is becoming some sort of standard language in the sense that it is replacing other languages. It may be the new lingua franca that allows people in different countries to communicate, but that's something very different. Just look at the EU, where every important document has to be translated into a host of official languages.

Secondly, I'll contest MikeMayer's statement that HTML is a programming language. It's a markup language that explains what various bits of content are – not how they look or how they behave. It lacks most fundamental traits of programming languages, such as flow control (conditions, loops).

The abundance of programming languages has several causes. The most important one may be that some of them serve different purposes.

A language like C++ is extremely powerful and lets you do just about anything, but requires that you know what you're doing and leaves a lot of responsibility up to you.

Syntactically similar languages like Java and C# offer much of the power of C++, but implement restrictions in certain areas. The result is a language that is easier to use for non-gurus. They are equally useful for the majority of applications, but there are specialised niches where they can't compete with C++, just as there are areas where C++ can't compete with its predecessor, C.

A language like Visual Basic is even easier to use for a beginner, but has more restrictions than the more complex and powerful languages.

There's a balance between power and ease of use, which normally dictates which language is best suited for you. The ones that manage to be easy to learn and yet offer sufficient power and scalability for a wide range of applications become more popular than those that are too complex or too restricted.

There's also the matter of portability. Assembly language is as powerful as it gets, but you'll have to rewrite the application from scratch if you want to move it to another processor architecture. Languages like C and C++ make it somewhat easier to port, but you still have to recompile and probably change some of the system libraries and such. Java compiles to portable byte code, making it even easier to port. Then you have interpreted languages like JavaScript or PHP at the other extreme: you just move the source code and you're done.

Mogura
05-27-2008, 05:25 AM
Everyone,

Good posts/responses thus far...

pitseleh402,

For the sake of brevity, I didn't really go into detail to support my comment regarding the standardization of communication forms onto English. What I had in mind when I was making my post was the extinction or near-extinction of the languages of ethnic groups that adopted English. Native American and Gaelic languages are some examples that immediately come to mind (some language "adoptions" were forced, while others came about due to economic situations). Actually, other countries have seen similar scenarios play out in the adoption of their national languages. France is one example. Japan is another (the Ainu language is all but extinct). Overall, the trend is the reduction of the number of natural languages. I cannot recall any examples of new natural languages emerging (I think they are still debating whether "Ebonics" constitutes a language).

So, it would seem that standardizing on one programming language would be impractical/impossible. That said, would it still be impractical to reduce the number of programming languages to a manageable handful? I mean, look at all of the .NET programming languages Microsoft has created. Are all of those languages so different that no two languages can be used to accomplish the same task, or is Microsoft just trying to boost its market share by flooding the market with these languages?

AutisticCuckoo
05-27-2008, 05:52 AM
I'm not really sure there are that many languages in practical everyday use. As for .NET, I think it's much like I said above: they cater to different categories of developers (and perhaps, as a result, applications). C#.NET has a steeper learning curve than VB.NET for a beginner, but may be more practical for large, complex applications (which beginners don't usually write).

pitseleh402
05-27-2008, 09:22 PM
Given that there is no necessity in trying to master or even learn every PL out there, I don't see why there should be an artificial driving force to try to reduce the number of PLs out there. As Mike Mayer mentioned in his post, different languages are suited for different purposes.

Even for your end, there are well-designed pedagogical PLs out there. The motivation for standardization itself assumes the deep-seated belief that there is this one principle that allows humans to write good software efficiently, in majority of situations. There isn't, or should I say, we just don't know.

It's much like good craftsmen's toolbox. You could invent a giant swiss-army-knife that can do pretty much everything other standard tools can do, but that still wouldn't replace the toolbox full of tools. Especially when there are new tools invented everyday, resorting to such do-it-all wouldn't be what a good craftsman would do. And I haven't even mentioned the ridiculously fast-paced evolution of hardwares.

The very fact that you have encountered certain PL is the testament to how useful it is to certain general enough tasks. There are PLs invented everywhere (some people even have toy PLs that they play with.) that never see the light of the day. It might seem that PLs that appear essentially the same are springing up from everywhere, but there really is a market force in effect that separates the wheat from the chaff.

Having said that, I do have to agree with your suspicion with M$'s (mal)practice. Similar to their previous business practices, M$ seems to be pushing .NET platform down the developers and consumers' collective throat and, in doing so, invented many languages (they all compile to the same virtual instruction architecture - CLR) to suit variety of needs. They're trying to piggyback on the now tried-and-true virtual machine technology. (There are many kinds of VMs but here I'm referring to the application VM, specifically Java virtual machine - JVM).

b.

HackerX
05-28-2008, 04:03 AM
pretty much been covered.

Different strokes for different folks. Or, you can use a hammer to drive in a screw, but it won't be the same.

Essentially, languages like C# and Java, exist to take the pre existing skills of existing developers with C/C++, but remove having to deal with the crap that slows down development in a business environment and where the advantages of C/C++ aren't worth the disadvantages (time is $$). If the end result is the same, but it takes 1/2 the time to develop it, then that's a huge saving for a business.

The same can really be said of most languages, you just have to change the context to suit.

VB.net exists simply because of the huge existing base of VB developers + VB code base that was out there at the time. As for why there was such a huge VB code base out there, see my comments about speed of development.

MikeMayer
05-28-2008, 04:28 AM
Alright. For my comment about HTML... I was referring that to its importance as a markup language, which to many, is virtually a programming language.

walfin
06-14-2008, 02:46 AM
Loosely speaking, HTML is a kind of declarative programming language where most of the source code is in the form of data strings (you could say the default mode is to interpret tokens as strings to be sent to the intrinsic print function instead of as identifiers). HTML could also (loosely) be seen to be a kind of FSM control mechanism (<b> is an "instruction" to "turn on" bold, </b> turns it off, though of course i don't think most web browsers are really FSMs). In that sense, a markup language can rightfully be considered to be a form of programming language. Programming languages do not have to be imperative.

Although HTML doesn't "look" like a programming language you could also easily make an xml based imperative language such as
<xor op1=eax op2=eax />
...
<rep><stosd /></rep>

so the form is merely a matter of taste and style.

HTML is a "programming" language that is TRULY necessary since it fills a much needed void (for content presentation on the web).

As for the general question of whether so many programming languages are necessary, at present i would say we have more languages than necessary since there's a lot of duplication in functionality across languages, although different tasks generally require different languages.

One day, i think, we will be able to code in whatever language we desire. So English/French/Japanese would become the programming languages of choice for the masses. Coders, of course, would begin to use C++ for everyday conversation in the tradition of their secret sects :P.

AutisticCuckoo
06-14-2008, 04:12 AM
When you show me how to do a while loop or an if-then-else statement in HTML, I'll believe you. :)

walfin
06-15-2008, 11:56 AM
Like i said, a programming language doesn't have to be imperative. HTML doesn't have a while loop, neither does prolog (well, at least not formally defined in the standard).

it is possible to construct an infinite loop in html if you make use of 2 files

html1.html
...<iframe src="html2.html"></iframe>...
html2.html
...<iframe src="html1.html"></iframe>...

making extensive use of multiple files, nested subfolders and meta refresh tags, it might be possible to even control the loop.

just because a language cannot do if then else or while doesn't mean it's certainly not a programming language, it just means it's not imperative. it takes it out of the general purpose programming league, that's all.

as this post has digressed significantly from the topic, i shall be posting a new topic about this.

AutisticCuckoo
06-15-2008, 04:09 PM
You're cheating! :)
IFRAME is deprecated. So does that mean that HTML 4.01 Transitional is a programming language, but not HTML 4.01 Strict? :)

walfin
06-17-2008, 11:47 AM
hee hee...
don't know about that. but can't the object tag be used now instead?
n that's not cheating, it's just judicious use of techniques. :P