What Makes a Powerful Programming Language? 1332
A not-so Anonymous Coward queries: "My company is about to start development on a new project, and I have to decide on a language and development environment. My boss gave me a set of criteria which needs to be filled: intuitive and easy to use IDE; simplified GUI design and event handling; advanced error handling; advanced object oriented design including multiple inheritance, abstract classes, and garbage collection; full support for operator and function overloading; and portable (at compile-time) across various platforms. I have already looked at C++, Java, C++, C#, Eiffel, and even VB.net; I may be missing something but as far as I can tell all of these languages are missing something from this list. Is there a language available that has all of these features? I thought that someone from Slashdot would be able to point me in the right direction?" If you were to design a language from the ground up, what features would you include and why?
Re:Why doesn't... (Score:3, Informative)
Re:Why doesn't... (Score:3, Informative)
Only language that comes close... (Score:3, Informative)
Ruby (Score:5, Informative)
It all depends... (Score:2, Informative)
The best solution is ultimately probably using two languages - perhaps Java for interface work / portability, but also C for anything that needs to interface to hardware, or needs the performance. I'm only using Java and C as examples - but other languages are the same.
Most languages can't do everything. Pick the best for the task required and the skills available.
What's wrong with C++? (Score:3, Informative)
I don't get it; what's wrong with good ol' C++, according to that list?
I can only see two possible deficiencies according to your requirements. The first is the lack of a truly portable GUI library (though you can get libraries like Qt that are reasonably cross-platform in some cases). The second is the garbage collection, but (a) you can use a garbage collector for C++ (if you must...) and (b) using the right basic tools and techniques, garbage collection is largely unnecessary in a C++ program anyway.
The biggest problem with C++ is getting people who program it, as opposed to C-with-bolted-on-classes-here-and-there. But if you've got a half-decent team and someone with smarts in charge, all of your concerns should be non-issues.
Ada (Score:1, Informative)
Here are some Ada links:
Ask your boss what he *really* wants. (Score:2, Informative)
The list of requirements he's given you reads like a job description that's been through the HR department. The first thing you do when responding to a job ad stating "Position requires at least 5 years C/C++, Java, Perl, and SQL experience on multiple platforms," is ask "What do you really want?" The same applies here.
SpecTCL (Score:2, Informative)
C++ (Score:5, Informative)
Let us take a look at how C++ compares.
Intuitive, easy-to-use UI, check. This is a stupid requirement for a language, though, as any reasonable language should allow your choice of UIs. I've used Visual Studio for C++ as well as emacs and, currently, KDevelop [kdevelop.org], which I like quite a lot.
Simplified GUI design and event handling. C++ does not determine how GUIs are handled but we use Qt [trolltech.com] which works very well for what we want. Visual Studio lets you do GUI design inside of it, as does Borland C++ Builder.
Advanced Error Handling. Define advanced. C++ gives you try-catch, etc. and provided you put a big of work into it, can be pretty good at error handling.
Advanced object oriented design including multiple inheritance, abstract classes, and garbage collection. Well, C++ is the language most people think of when someone says OO. That said, C++ does not have any built-in garbage collection which is in my opinion a shame. Still, you can plug in garbage collection if you want, though the URLs escape me. In my experience, this has slowed down the execution of my C++ applications considerably but that said, my applications tend to allocate and deallocate memory quite frequently.
Full support for operator and function overloading. Yes, C++ provides this.
Portable (at compile-time) across various platforms. Well, C++ is NOT, in my experience, as portable as Java is. That said, if you use a platform independent GUI library such as Qt and you are smart in how you code, you shouldn't have any great problems. Gnu Autoconf, Automake, and Libtool, published by New Riders, will help you out here.
So is C++ the language for you? That is impossible for me to say. The two major things it is missing is a GUI library (though Qt is excellent for this) and garbage collection (though this may not be a big issue). Personally, I find it easier to code in Java, mostly because Java does not allow things like multiple inheritence or operator overloading. Don't get me wrong, there is good reason to use these (and my C++ code occasionally does) but on the other hand, it can lead to much hassles. Very few projects really need multiple inheritence, for example, and MI can lead to all kinds of nasty problems. Do you really want to sink to the level of virtual inheritence, for example?
Really, though, we cannot help you out all that much more without knowing what kind of project you are working on. Your requirements seem to indicate this is not a small project. As a result, I'd advise against VB.Net, having spent a year working in VB on a project about a third of a million lines of code long. C# has potential (it is a blunted-scissors version of C++) but really isn't mature enough at the moment. Eiffel I have no experience with. Java is great in SOME circumstances but I'd hesitate to recommend it to you without more information. And then there's C++, which I have spoken about in great length here. But C++ is a tricky language to use correctly.
Re:Python (Score:3, Informative)
I'm working at a software firm where we're using Python and Tk for our GUI development.
The only big complaint I have about Python is that I would really like to be able to enforce static typing. In python, you can get some "thing" as a parameter and perform operations on it, call methods on it, return it back, without having any idea what it is you're working on until run-time, when your program barfs on the thing it got.
Of course, the dynamic typing allows fast development, but the maintenance afterwards (especially when the code has changed hands) can be a bit of a chore sometimes.
Overall, however, I think Python is extremely cool.
Re:Operator overloading (Score:3, Informative)
That's one thing I dislike about Java; it intentionally cripples the features available to the user whilst using similar features in the design of the language. For example, you wouldn't want to write Java in Java, because it just isn't functional enough to do a decent job.
Re:Operator overloading (Score:2, Informative)
Re:Operator overloading (Score:2, Informative)
Note that if your operator is inlined and the compiler is reasonably smart, these temporaries are often optimized away. Usually when they aren't, the cost of the copy is low compared to the overall cost of the operation.
Re:Why doesn't... (Score:1, Informative)
class MyClass : public Queue, public Session, public Thread
{
yada:
}
Easy to maintain... as a matter of fact, I haven't touched those three base classes in a year and the ability to use their features like like that is wonderful! No reference passing, no single-inheritence "chains", no pointers to maintain. It's all handled on the "inside"
One base class is a custom, thread-safe queue. Another is an ORACLE OCI session. And yet another is a Thread.
Very useful!
Best Regards!
Re:Python (Score:1, Informative)
As far as GUIs go, Python has excellent bindings for EVERY major GUI toolkit. My personal favorite is wxPython. Check it out!
Python has operator overloading (Score:4, Informative)
Paul
Why just one language? (Score:3, Informative)
So, here's my list
Does such a thing exist??? Every language has an IDE. Visual Studios, JBuilder, Emacs, KDevelopers, etc.
Well, this really depends on the operating system. Java's the good place to go here. If that can't be done, GTK and Qt are good libraries and they use the standard X style callback mechanism which is so much nicer than message based systems. What your really looking though is for a WYSIWYG GUI designer so I'd recommend Glade or whatever comes with the IDE you go with.
Such a buzz word... Java and C++ both use exceptions. Good error handling has more to do with a projects design though and not really the particular language...
Lets get our terminology right
IMHO, MI is necessary for advanced projects but Java interfaces _almost_ make MI unnecessary. You may do well to evaluate whether you truly need MI. What really matters, is how good your development team is.
This really should be in Java if you ask me but it isn't. You really don't need it. You could use interfaces instead. Of course, C++ support for operator overloading is great. Again though, you should really evaluate if you truly need such an advanced feature. If you just going to use it to concat strings then you don't need it.
Java or GCC. C++ is portable as long as it's GCC on both platforms
I think I'd have to agree with the general sentiment that you really need to evaluate your requirements because they are extremely unjustified and appear to be either (1) a bad manager, (2) pressure from employees to obtain "resume builder" skills, or (3) a very complicated project which you are not providing very much required information for
No language can satisify all your requirements perfectly. C++ comes closest. A combiniation of C++ and Java would do the job nicely.
Just a quick point... (Score:3, Informative)
However, operator overloading is simply syntactic sugar and can be supplied either through an advanced IDE (I may look at jEdit to see how hard it would be to implement there) or through a preprocessor (jpp is one such preprocessor, though it seems hard to find on the net these days).
When doing operator overloading, it would be good to eliminate temporaries if possible. If a 'c' array object already exists before the assignment, it would be nice if "c = a + b" generated "c.assign(a.plus(b))" rather than the naive "c = new Array(a.plus(b))", which causes heap thrashing and unnecessary overhead. My guess is that this kind of optimization would be easier with an IDE type approach. (I hope that made sense!)
299,792,458 m/s...not just a good idea, its the law!
Re:Ruby (Score:2, Informative)
programming languages are engineering tradeoffs (Score:5, Informative)
Still, given your feature list, CommonLisp may be your best bet (the CMU CommonLisp implementation for Linux is pretty good). It's a very expressive language and compiles into reasonably good code, although it doesn't have much static type checking, the language definition is messy, C-like performance can be hard to achieve, its C interface is a bit cumbersome, its libraries are less than stellar, and its user community is tiny. Bigloo, a compiler for Scheme, interfaces more nicely with the rest of the world and generates reasonably good code, but lacks threads and has a less expressive object system.
If you want something statically typed, O'Caml is a great language, combining object oriented and functional programming. It generates good code and interfaces reasonably well with C. However, you don't get overloading.
For great libraries, reasonable performance, and good standardization, Java can't be beat, but the language itself can be a little tedious. C# fixes some of the tedium of Java, but its libraries and performance are nowhere near as good yet, and it's pretty much Microsoft-only for now.
And don't forget about C++. For complicated numerical algorithms that need to run fast, there is nothing better than C++. For complicated GUIs, and interactive applications there is almost nothing worse, however.
So, overall, there just isn't a single answer. Every language is an engineering tradeoff. Learn many of them, and you will benefit both from the experience and the choices you have.
Better still, Python's successor (Score:3, Informative)
All of the above in sensible doses. Plus it's more fun. And a prettier colour. (-:
BTW, XP isn't a cheap ripoff, just a clumsy one. I suspect that the TCO will work out noticeably worse than WinME. Windows started life without scaleable elevators (to pick a known example) because one William Henry Gates III told the developers to take them out again so that it looked more Mac-like. Dilbert of a few days ago [dilbert.com] is fitting commentary.
Dons asbestos undies, prepares to duck...
Re:Python - doesn't fit the bill (Score:1, Informative)
You are wrong with abstract classes. Certainly there is no special keyword (eg. abstract) but you can write classes with unimplemented methods .
Delphi/Kylix/C++Builder (Score:4, Informative)
I work with Delphi on a daily basis. Delphi supports (fully) all of the following:
Re:Who cares? Language wars are over (Score:2, Informative)
Here's a categorized list of companies successfully using Allegro Common Lisp [franz.com], along with a couple examples from each; follow the links for more companies and more information:
Ruby does have mixins (Score:2, Informative)
Using MI tends to get messy anyway, especially when you end up with some kind of diamond inheritance tree. I personally tend to avoid MI even in languages that allow me to do it. I have to say that I much prefer Ruby's approach of using Mixins.
Re:Java Interfaces (Score:3, Informative)
Several other people have addressed the issue of callbacks, but I am interested in talking about your assertion that interfaces are only for callbacks. Interfaces are contracts that are at the heart of polymophism, a client doesn't care "what" your object is as long as it provides the services you need.
Others may disagree, but in my opinion, multiple inheritance in C++ is the result of confusion between polymorphism and reuse on the part of the language developers. If you want to reuse multiple objects and also provide similar services to two or more of those objects it is much clearer to the observer of your code if those parent classes implement interfaces describing their services and you include instances of the classes you need as private member variables and you delegate to those private member instances in your implementation of the interface methods that you need to provide.
I think this is much better than having tons of confusion over similar method names with grossly different semantics, figuring out which parent class a virtual method is tied to, dealing with virtual vs non-virtual inheritance, and the tons of other things that make deciding through inspection who exactly implements the bar() method on your class foo next to impossible without having 4 monitors.
Re:Whitespace as syntax (Score:3, Informative)
Eh?
>>> for i in range(0,4): print i
0
1
2
3
>>> for i in range(0,25): print filter(lambda a: a % 2, range(0,i))
Works in Python. You'll have to try harder to find some other reason to hate it.
Consider Python carefully (Score:3, Informative)
If you're looking for the weirder OO features like operator overloading, you'll find them in Python, but the calisthenics you have to go through to do it might make you think twice about using it.
The only real drawback to Python is the execution speed. One of the AI projects I previously mentioned worked great (and I completed it probably 10 times faster than I would have had I been using C/C++), but it ran very very slowly. The cause of the problem is clear -- no static typing, reference-count garbage collection, a stack-based VM (I ain't knockin' it! It's just hard to optimize)...
If you are planning to do anything compute-intensive, maybe Python is not the right choice. It's always possible to break out to C/C++ with the Python API (to do your compute-intensive tasks), but there are drawbacks: over time, the Python C-API will probably drift, and you'll have to keep tweaking your native code to keep it working. Also, the inner workings of Python, especially refcounts, can be boggling and the source of bugs and memory leaks that can be fantastically hard to track down.
If you consider Python, then great. Just keep these points in mind.
Re:Have you been playing Wack-A-Troll too long? (Score:2, Informative)
I can't tell whether you're being sarcastic or whether you really don't know about Common Lisp [lisp.org]. Dynamic, strong typing, compilers and interpreters, great IDEs and debuggers, easy runtime modification and incremental compilation, flexible and powerful object system (including multiple-inheritance, multiple-dispatch, method combination... and the ability to modify its behavior), macros that have the full power of the language, etc...
Also see CLiki [telent.net] and The Common Lisp Hyper Spec [xanalys.com]
Re:Whitespace as syntax (Score:3, Informative)
What you can't do in python is make your code's actual block structure inconsistant with your code's apparent block structure -- and thank Guido for that!
And as another poster mentioned, you *can* stick the trivial loops on line 1. Python's a bit smarter than most folks who don't know it assume it to be.
Borland Delphi? (Score:2, Informative)
Try Ada-95 (Score:3, Informative)
URLs To backup my bald assertions below. Browse the sites and you'll see studies and numbers. Facts not Religious opinion. Adapower [adapower.com] is a good start. Or the Ada Information Clearinghouse [adaic.com]
IDE - there's a variety of freeware ones.
Simplified GUI - there's a variety of bindings to various APIs, from X-windows to SWING to W32. Plus many other simplified freeware ones, some thin, some thick. Pick which one is most appropriate. Ada (the language) doesn't have anything more advanced than stdio - but then again, neither does Java, it relies on the awt and swing libraries *shrug*
Advanced Error Handling - Java's exceptions contain more info than Ada's. Ada ones are more simple, easy to use, but I think Java's are better in most ways. They should be - both C++ and Java copied their exception handling from Ada's 1983 incarnation. OTOH most of the time all Java programmers (like me) do is make an exception without using any of the internal data, so YMMV.
Advanced OOD including multiple inheritance and abstract classes - As regards OOD. Ada's the most flexible of the lot. You can do strict OO, but don't have to. Methods are properties of Classes(actually packages) rather than objects, so you can say Wooden.paint(a_wooden_door) or Door.paint(a_wooden_door) rather than a_wooden_door.paint(). So you get all the advantages of multiple inheritance, without the horrendous penalties (which method are you inheriting, the paint for wooden things or the paint for doors?). Abstract classes are used all the time.
Garbage Collection - Ada doesn't produce garbage in general. You can do most things using statically allocated memory, or dynamic allocation within a statically-defined garbage-collected area. When you want dynamic allocation, you can choose to rely on the compiler's garbage collection, if it exists, but you're also given tools for explicit disposal of garbage. Note that Java has true garbage collection, but even Sun says that you can't rely on it, you should use explicit disposal. This is true not just for Java, but in general.
Operator/Function Overloading Ada has had this since 1983. Often copied, never bettered
Portable Stories abound of million- and 100,000-line Ada programs that require a dozen lines changed to make em work on different systems. My own personal war story is of a 20,000 liner developed on a 386 on an Irvine compiler, ported with 3 lines changed to a MicroVax using a DEC compiler, thence to a Vax using another DEC compiler, then to an embedded system using a DDC-I compiler. Was an AI to do anti-missile defence, people's lives depended on it. It's been in service since 1995. Cost less to make than the 7,000 lines of C in its test bed too. I've just help finish a 20,000 line piece of spaceflight avionics that makes not one Operating System call, even though it has 60+ simultaneous threads of execution. Oh yes, there's a shareware (or GNU licence? I forget) Ada compiler that produces Java bytecode, so will run on any Sun JVM.
So why isn't Ada-95 used by anyone? Because everyone knows it's too big (nearly as many keywords as C++,), needs a huge machine to run (bigger than a 286 running at 4 MHz - which was big in 1983 when Ada-83 was invented), it's designed by a committee (like Linux - one really good designer Jean Ichbiah, then peer review), and it's a product of the US Military (like Unix, and the Web - designed for not by). Oh yes, and expensive (GNAT is open source...) and uses a lot of risky concepts ( to wit, Operator Overloading, Object Oriented Design, Exceptions, all risky and untried in 1983 ). It's also obsolete, (the Ada-95 version being a little younger than C++). And it is used, for Avionics of all modern airliners ( Illyushin, Boeing, Lockheed, Airbus) and many satellites, railway- and air- traffic control systems, where quality is vital. It's not used much elsewhere, as there's a vested interest for software developers and programmers to keep software buggy (so they have job security) and quick to market (it takes a long time to develop reliable software).
So Ada's perfect, right? Wrong. It's just better than most general-purpose languages for many purposes. BUT It's not language of the month ( C# this month? ) so getting Ada programmers is very difficult. Though it's easy to learn, based like the similar Eiffel, Delphi, Object Pascal and Modula-2/3 on Pascal. If you've programmed hardware design in VDML, or used Oracle's access language, you've used Ada without knowing it.
Re:Try Ada-95 (Score:3, Informative)
> Simplified GUI - there's a variety of bindings to various APIs, from X-windows to SWING to W32.
Increasingly popular for Ada is GtkAda [act-europe.fr], a thick, well-documented, OO binding for Gtk+. It is portable between *n*x and Windows.
> Garbage Collection
IIRC, the language spec makes garbage collection optional, and almost no one implements it.
> So why isn't Ada-95 used by anyone? Because
"Designed by committed" is the sort of argument prejudice evokes when there aren't any real arguments. People use stuff designed by committee all the time withoug whingeing about it. The argument ought to be about the design, not about the designer(s).
Ada95 (Score:1, Informative)
I know, people start throwing things at you when you mention Ada. But how many of those people have actually used Ada95 and not the old obsolete standard...
Also compilers for Ada aren't that expensive nowadays, they even come for free (speech). Soon a part of the gcc 3.0 branch (keep up the good work GNAT!).
Au revoir
Re:Why doesn't... (Mod him up to a zillion!) (Score:1, Informative)
So what does your base-object provide ? A type-info field ? So that you can write glorious switch-on-type code ?
Fact is, it doesnt buy you anything. If you need type-info in your classes, chances are you got somehting seriously wrong. Most small projects get around that, but in medium or big - sized ones youre fucked.
The only chance for survival is decoupling, decoupling, decoupling. Common base objecst dont let you do that.
Re:Have you been playing Wack-A-Troll too long? (Score:2, Informative)
The reason is that Lisp programs are Lisp data structures. This is the foundation on which Lisp's incredibly cool macro system is based -- macros in Lisp can perform arbitrary computations on the program tree, not just do simple and/or awkward textual substitutions. It's also not any harder to type or understand than more conventional syntax, once you get used to it. Don't let the shock of the unusual turn you off.
Perl OO with Encapsulation, and other comments (Score:2, Informative)
Secondly, Perl OO is conforming with Perl's TIMTOWTDI (There Is More Than One Way To Do It) design goal. While native Perl OO is pretty casual in its encapsulation, if you want Bondage-And-Discipline OO, you can use one of Damian's Class::Classes, with Contract programming or Data hiding enforcement or ... there are at least 6 choices. At least one should have multiple inheritance grafted on, although I can't recommend actually using multiple inheritance of implementation (except maybe in CLOS); multiple inheritance of interface (like in Java or COM) seems safe enough.
Likewise, anything else Perl is missing can be added via other modules -- many of which probably already exist, but can be custom crafted on demand. This includes Operator Overloading, which can be added, for whatever cases are required, using Inline::Filter -- using the full power of Perl as a macro-language for Perl, to enhance the syntax as desired. Not for the faint of heart, but a good Perl consultant can whip it up for you.
GUI's -- Yes, it is true development of GUI's isn't built into Perl, unless you count the TCL modules as "built in". Ability to do GUIs does seem to run counter to portability (at compile time, whenever that is); this requirement may force your choice on Java. Perl has Gnome, TK/GTK, and Curses interfaces already. See CPAN [cpan.org]
Thirdly, Perl6 will likely be mostly functional before .NET this summer, and _will_ be all things to all people, thanks to the modular bolt-on accessories. (Operator overloading will apparently be a part of the PARROT runtime for Perl 6, as well as in Perl6.)
Fourthly, Reality Context: Did The Boss specify that you had to be able to hire programmers in this language? Cheap or expensive? With lots of experience or not? Here or offshore? Eiffel's a great language, if you don't mind all your staff speaking French.
Regarding the evils of Lisp ... see the story of Yahoo!Stores Paul Graham: Beating the Averages [paulgraham.com] or /. #1539239 [slashdot.org]
for a real world $ucce$$ story with Lisp and why; amusingly, he turned up just last week /. #1917202 [slashdot.org].
-- Bill
ADA is the best (Score:2, Informative)
Every new feature that you see in the modern languages today was in ADA years ago.
* better concurreny (protected types)
* better realtime systems( tasks)
* better exception handling(fail-safe systems)
* is a strongly typed language.
* better interrupt handling
* very early on introduced the philosophy of reusable code.
* had intefaces when java was still in its infancy
.....
and is used in: financial services, avionics, aeronautics, air traffic control, telecommunications, medical devices, power plants, railroads, astrophysics, satellites, and defense, to name a few.
If you are going to develop a realtime system forget about everything else... use ADA.
my two cents