Thread: Is C++ getting too complex for today's technology?

  1. #16
    Registered User
    Join Date
    Dec 2003
    Posts
    50
    Someone has to write all those C and C++ libraries that are easy to use. My take on this is that C and C++ will still be alive and kicking for a long time. The question now is: what programming work do you want to do? Creating libraries that are easy for others to use? Or, use libraries created by others as building blocks for your system?

  2. #17
    Registered User
    Join Date
    Aug 2005
    Posts
    128
    Definitely writing new libraries in C++ is a plus for the langugage.

    I have a background in many languages (.NET, VS 6.0, ASP, PHP to name a few).

    If a company has switched from c++ to VB.NET then (perhaps) it's because they shouldn't have been writing in C++ to begin. VB, in any form, is great for building window and database driven programs. C++, while it can be done, isn't best for everyday applications that are database-driven and heavy into user interaction. Think data-entry apps or an invoicing system.

    I'm learning c++ and using my new knowledge to write a windows service. However, for the front-end user interface which would only be used to rarely make a few options changes and wouldn't be running all the time, I'm writing it in VB. I have a few other reasons for the split but suffice it to say, programmers need to know a few languages and know how to use them together. I have a VB program that uses PHP. Why? Because that was the only way to solve a problem.

    C++ will always (can I say that?) be around as long as new libraries are written. If I recall correctly, that's a lot of .NET advantages - new standard libraries that use to be coded with a ton of code now done to a few lines. So for that reason, learn it if you can.

    Every programmer has a choice in life...do I become a good (C++, java, .NET, etc) programmer and specialize in one language OR do I become a good programmer who has enough knowledge to provide a solution by using whatever technologies it takes to make it happen? I've found being the latter is much more rewarding. The question of "Can this be done?" shouldn't be based on a limited programming technology but by feasibility.

    Why have I said all this? Too much coffee.

  3. #18
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283
    I agree with everything above. Managed and unmanaged code can work together, so investing time in C# and C++ can only mean more power at the end, and I'll continue to learn each. I guess right now I don't really require every ounce of speed and power, so C# seems more benefitial for my own project ideas. I wish to persue client applications, web services, mobile programming, and a side in game programming. I think anyone would say C# is a better gear for what I want to do, but still, I agree that any programmer must know C++ efficiently because sooner or later, you'll have to maintain these products in much of the world, including upgrading, debugging, etc. I don't think any programmer can afford to ignore 90% of what the world runs on.

  4. #19
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    Interesting thread on using multiple languages in a project:
    http://www.erlang.org/ml-archive/erl.../msg00357.html

    Essay on why one should use a language of more power rather than politically accepted languages:
    http://www.paulgraham.com/icad.html

    Postscript file outlining introduction of erlang and the benefits it provided over using Java/C++:
    http://ortdotlove.net/docs/erlang/bits.ps

    In my personnel opinion, the reason we still have so much C/C++ code kicking around is, in a large part, due to legacy code and secondly ignorant people. Legacy code is difficult to deal with, in most situations it is probably going to cost more money to rewrite it then to maintain it (up until a point), and the people which control the budget arn't thinking that far ahead. As for the second point, in a commercial environment the people which will decide how much money to spend, who to hire, and how to advertise their product are not software engineers. This means that they generaly know very little about the tools used to create a product not to mention the technical issues involved in deploying it. Managers are often swayed easily by politics (when it comes to languages). A easy example: Java, Objet orientated, and XML are lovely buzzwords that most managers enjoy hearing, saying, and advertising. If they havn't heard of the language/technology then it means it's not good or worth using. A lot of programmers are fairly ignorant too. Many have come to the unfortunate conclusion that C and C like languages are the answer to all questions. For some reason many of them have come to the conclusion C is the first language (after assembly) chronologically and the most accepted, thus producing the best products. Often they are shocked to hear that Lisp has been compiled long before C. Also, many confuse speed with being A) an attribute of the language B) important to their particular application C) unobtainable by any other programming language.

    A) Languages don't have speed, implementations do. Various implementations vary. We can compare solutions to problems in implementations of different languages, but this even does not yield useful results generally.

    B) Most languages are I/O bound. An IRC client is waiting on input 99% of it's run time. Anything it does is probably calling hooks and passing data over a wire. Networking in generally is I/O bound and most decent language implementations are quite fast enough so that even in an interpreted implementation the I/O is still going to be the bottle neck.

    C) Most scientific applications I've seen don't use C or C++ as the frontend language. They might write some of the implementations of functions in C or C++, which is different. Look at languages like J, K, and SML. J and K are made for high performance mathematical processing. SML is fairly mathematically orientated. The design of the language lends itself to being fairly easy to optimize. J, K, and SML have all shown capable of reaching C-like speeds with generally less work to obtain it and (generally) more readable and portable code.

    Don't confuse any of my statements with saying C and C++ are never the answer. There are particular situations where such a language has implementations written for them that can do things other languages can't. However, one should not think this is an aspect of the language. But rather the amount of work that has been put into their implemenations. Given C and C++'s popularity *a lot* of work has been put into them so, of course, their are implementations for them that can do quite a bit.

    In regards to the threads topic, C++ has a massive language. It is quite difficult to write a large complex C++ application without a reference. Not to mention, once you start throwing template meta programming into the mix things quickly become even more confusing. Debugging a boost::spirit error message takes a degree in science.

    Finally, it seems that many people consider C# an upward motion, it seems (to me obviously), that is more of a lateral move. C# seems to mostly provide aesthetic improvments and security improvments. The constructs of the language really havn't changed much. The expressivness hasn't been increased very much. Am I wrong here?

  5. #20
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283
    There's nothing to disagree about here. I think 90% of applications don't really require performance as the #1 key, so productivity seems to be the complement of performance. Either you need something that needs every ounce of speed (and there's very few programs in this area), or use some wrapper (basically MFC#) with benefits such as greater security, architecture-neutral, mixed-language programming, modern memory management, and component-oriented. Obviously, a large amount of software can use this without just worrying specifically about performance. I see games always using C++, but I'm sure with today's technology, it's becoming a headache. But of course, game companies are known to have built their own wrappers and COM files over the years, so it's really up in the air.

  6. #21
    Registered User
    Join Date
    Aug 2005
    Posts
    128
    excellent points, orbitz.

  7. #22
    Registered User
    Join Date
    Aug 2005
    Posts
    128
    Orbitz, the post on multiple languages highlights a good example of a bad design.

    In the cases of mixing languages, I wasn't speaking of compartmentalizing parts such as that. I was thinking more of using a second language where either one cannot perform a task or could be done more easily - i.e. GUI creation to modify a parm file.

  8. #23
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283
    I must ask, though:

    Can C++ use .NET extensions, which would return all the managed benefits? I tried /clrldSyntax, and was able to use __property, __sealed, etc. This is cool!

    I'm thinking about focusing on both languages equally because I find something that all other languages lack: control. If C++ can create .NET and Java down to their core, isn't that worth taking pride for? Isn't that worth the lengthy study? Isn't that worth fighting for?!
    Last edited by dxfoo; 09-09-2005 at 02:02 PM.

  9. #24
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    dxfoo:
    Yes, it is called Managed C++. It allows usage of a garbage collector and the various .NET classes.

    If C++ can create .NET and Java down to their core, isn't that worth taking pride for?
    In my opinion? Not really. Neither .NET or Java are all that novel or innovative. They have their uses but I can't think of a situation where I would choose to use either of them for a new project. So C++ was used to write their VM's. So what? You could use just about any langauge to write another languages VM, I don't see how the programmers choosing to use C++ makes C++ any more interesting.

    I find something that all other languages lack: control.
    What does this mean exactly? What is control? How do other languages lack it?

    FoodDude:
    Indeed, I wouldn't say that that part of the paste is directed exactly at you. However, programs written in multiple languages is becoming more common. For instance Python allows you to interface with C and C++ fairly seemlessly which is quite nice for doing those things that require a tight loop. Erlang provides a similar mechanism that is quite simple. Just about any language can also communicate with each other via sockets

  10. #25
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283
    You know how to kill my joy.

    For control, I meant speed you can depend on to carry out compilers for today's new technology.

    I'm using C++ using managed extensions. I guess that's called Managed C++? There's a language called C++.NET. I'm guessing you're not talking about that.

    Well, thanks guys. I guess a simple answer is "no" to the OP question. C++ continues to amaze me. Someone here is going to tell me I can use GDI+ for C++ too.

    This is worth going for. Coming to think of it, I'm already pretty good with .NET. I'm always looking for ways to improve int it. This would be a good time to start looking at the lower end of things and finish this reference book.
    Last edited by dxfoo; 09-09-2005 at 02:22 PM.

  11. #26
    I am me, who else?
    Join Date
    Oct 2002
    Posts
    250
    Quote Originally Posted by dxfoo
    You know how to kill my joy.

    For control, I meant speed you can depend on to carry out compilers for today's new technology.

    I'm using C++ using managed extensions. I guess that's called Managed C++? There's a language called C++.NET. I'm guessing you're not talking about that.

    Well, thanks guys. I guess a simple answer is "no" to the OP question. C++ continues to amaze me. Someone here is going to tell me I can use GDI+ for C++ too.

    This is worth going for. Coming to think of it, I'm already pretty good with .NET. I'm always looking for ways to improve int it. This would be a good time to start looking at the lower end of things and finish this reference book.

    Last I heard Managed C++ was another way of saying C#.

    The point to consider is that most languages have a niche. Perl is good with text, PHP is pretty decent for web dev, C/C++ has the more unique niche of being very flexible. It might NOT BE THE BEST at any one thing, but it can be implemented in a number of ways. Its much more flexible than anything else that I know of (though if there is something more flexible please share it ). I think C/C++, VB, C# etc will stay around for quite a while since each is good in its own area, however I think C/C++ will remain more the choice in many things because of its power and flexibility.

  12. #27
    Software engineer
    Join Date
    Aug 2005
    Location
    Oregon
    Posts
    283
    This article was great regarding MC++.

    Some highlights:
    * The best performance of generated IL code
    * Allows a developer to keep performance-critical portions of the code in native code.
    * Gives seamless access to all unmanaged libraries, such as DLLs, statically-linked libraries, COM objects, template libraries, and more.
    * Leverages existing investments in C++ programming skills and legacy C++ code.
    * Porting unmanaged code to .NET: MC++ allows you to take existing unmanaged code and compile it to managed code (with the /clr compiler switch and IJW).
    * Provides the easiest way to add .NET support to your existing native C++ Windows applications, by allowing you to bridge the gap between the two environments with as little work on your behalf as possible, and with the lowest performance penalty.

    That's no C#

    "One of the areas that MC++ excels in, and is in fact unique in amongst the .NET languages, is the ability to take an existing unmanaged (C++) application, recompile it with the /clr switch, have it generate MSIL and then run under the CLR, unmanaged. This extraordinary feat is aptly termed "It Just Works (IJW)!" There are some limitations, but for the most part, the application will just run."

    What it's good for, I don't know. But it's another C++ goodie to play around with.

    Article:
    http://www.ondotnet.com/pub/a/dotnet...intromcpp.html
    Last edited by dxfoo; 09-09-2005 at 02:59 PM.

  13. #28
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Oh, how I hate the word "leverage".


    Anyway. Managed C++ (or C++.Net, they are the same) was developed mainly as an interface between Managed and Unmanaged (native) code. Some of the core .Net classes are implemented in C++, because they need to interface with the CLR, which was written in native C++. MC++ can also be used to provide interfaces to existing C++ libraries for pure .Net languages, or use .Net components from C++.
    However, beyond these uses, MC++ has several key disadvantages:
    1) It lacks the speed of native code. MC++ is compiled to .Net IL and executed by the CLR.
    2) It lacks some of the features that distinguish C++ from similar languages, namely templates and multiple inheritance.
    3) It lacks the ease-of-use of C#. There is no auto-boxing, no foreach loop, no proper property support (at least the last time I checked, which was in VS.Net 2002), no proper event support. The syntax is less clear - since everything is a pointer, you have the * for every type. You also need the __value keyword for every Managed struct and the __gc keyword for every Managed class.
    4) It lacks the compilation speed of C#, due to its considerably more complex grammar.

    So MC++ is not desireable for a complete .Net application.


    I was going to post something about languages in general, too, but all important points have been made.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  14. #29
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    There is another factor that I have not seen anyone mention that is (and should be) a part of deciding on the language. Sure, language A may be the theoretically optimal language for the problem, but if the developer(s) are not proficient in language A -- and have would have negligible additional future benefit from becoming so -- but language B will solve the problem well, and the developer(s) are proficient in it, then there is a strong case for language B. This isn't laziness, it is merely acceptance of the fact that time is not unlimited, deadlines exist, and people have other things to do in their lives.

    So, by virtue of the fact that there are so many competent C++, so this presents a strong argument for the language since it is rather general purpose.

    Cheers
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  15. #30
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    So, by virtue of the fact that there are so many competent C++
    My guess is you havn't dealt with many C++ programmers. Trust me, not many are competent.

    but if the developer(s) are not proficient in language A
    This is somewhat of a fair comment. However let me do my best to give an argument against it. Let's assume there are two project types. Commercial and Open Source. For commercial we have a project manager who's job is to find programmers, hire them, pay them, yadda yadda. For an open source project we have a bunch of programmers together who have a neat idea and want to implement it.

    For the first situation, it's the project managers job to find programmers who are proficient in the needed technology to solve the problem. So in other words, if the developers can't learn the language or don't know it then they shouldn't be working on the project and the project manager has failed at finding the best people for the job. You might counter by saying, "perhaps it's a new project and they don't want to hire completley new developers for the project". Well, ok, use the same developers. For starters, what are you doing hiring one trick pony developers. They only know C++, maybe Java, or C#? Secondly, if you really want to use language A when language B would suit it, go for it. If your competitors are smart they will use language B and soon, if you are lucky, they will be buying you out. Take something like C++ vs Erlang for a telecomm application. Studies have shown the Erlang application is probably going to be developed 4times faster (on average). If your competitor can advance their project 4times faster than you then any neat feature you add will quickly be added and possibly surpassed by your competitor. Alternativly, being able to develope faster means you can hire fewer developeres but get the same results.

    For the open source situation. You'll generally have some developers with some neat ideas and want to show the world. In this situation, they should have plenty of time to learn the language and implement their application in it. Afterall, once you know one language it is fairly simple to pick up any other language. They want to express their ideas to the world don't they? Why not do it in the best possible way.

    There are a few situations in which usign the less optimal language is acceptable. The most immediate one that comes to mind is client specifications. This comes out of the ignorance statment of my previous post. Some clients want their product in a certain language and won't be told no by anyone.

    I hope those arguments seem fair and justified.


    dxfroo
    For control, I meant speed you can depend on to carry out compilers for today's new technology.
    I don't know what this means, care to explain?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Complex Number Class
    By Sephiroth1109 in forum C++ Programming
    Replies: 15
    Last Post: 12-12-2007, 04:46 PM
  2. Why am I getting 'undelcared identifier' ???
    By Bill83 in forum C++ Programming
    Replies: 2
    Last Post: 02-15-2006, 01:00 PM
  3. arithmetic operator friend functions
    By linucksrox in forum C++ Programming
    Replies: 7
    Last Post: 02-06-2006, 11:39 PM
  4. 2 am complex double conversion woes
    By Roule in forum C++ Programming
    Replies: 1
    Last Post: 10-14-2004, 02:53 PM
  5. Problem from texbook
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 07-26-2002, 04:55 AM