Aside from "I've already implemented it in C++", and "You must develop it in C++ for it to run on X", what are some good reasons for developing a basic business application in pure C++?
The first and foremost good reason is:
- "I am / the project team is far more experienced in C++ than in other programming languages"
Other compelling ones include:
"Resource efficiency and performance is a major concern" - although Java by now is often comparable in speed to C++ in general applications, good C++ code still can be much more memory-efficient.
"My boss insists it be written in C++ (possibly because he has read in an article 12 years ago that Java/C#/... is slow/unreliable/...)." - it was not stated that only technical reasons count ;-)
Large programmer support base. 'Ease' of Portability. Large variety and depth of libraries available across many platforms. It's the language I assume you want to use and are most familiar with... :)
A particular 3rd-party library that I need to use is written in C/C++.
(doesn't force you to use C++ but a significant factor)
- I and/or my team is more efficient at writing code in C++
- Performance is a major concern (assuming your alt. is J2xE or .NET/C#)
Speed, control over the features, loads of libraries and you can embed pretty much any script engine in it. More people around you know it so you can get help
You must choose a language you have an easy with it (or want to devellop a skills with).
Needing to write close to the machine (It is possible in higher level languages but I find it more natural in C++).
When you're going to spend a lot of resources optimizing an application, C++ can often provide better returns than C# or Java. If you're going to spend very little time optimizing (90% of the applications out there), well written C# or Java may perform just as well as well written c++.
I'm primarily a C++ developer and advocate yet even I wouldn't write a basic business application in it.
Strong reasons for using C++ would be things like:
- Portability over wide range of CPU architectures... not likely for a business app.
- Device Drivers in native code... ditto.
- High performance floating point number crunching (i.e. SIMD)... ditto.
- Ability to interface with assembly language routines... ditto.
- Need to manage memory manually for extended runs... ditto.
But there is one major one: TIME TO MARKET.
If your skills allow you to do it faster in C++ it is a hard argument to debate.
Someone asked a similar question, with the focus being on google's Chrome browser.
- Even though C# is an open standard, the .NET libraries are not.
- The domain knowledge/experience for your application is mostly held by C++ programmers.
- C++ is trivially compatible with many stable/performant libraries.
- The application needs to get close to the metal, Java and C# excel at making that difficult.
- There are few large C#/Java applications, while there are many large C++ apps. So for larger apps C++ is less of an unknown.
- Native plugins are far easier with C++ than Java or C# (JNI, COM).
Reduced dependencies on the target platform.
You don't have to wonder whether .Net libraries or the right version of the JRE are installed. Even though that's a given for the latest operating systems. For example, you need it to run on a box out in the field in a remote location with limited connectivity and who knows how old the box is.
Business apps don't have to be all data-input-in-a-clean-office. What about data collection for a pipeline or drilling rig? The guys working there are worried about getting their job done, not what version of Mono is needed for the Linux distro du jour.
Why not? Which language to use is almost arbitrary for a "basic business app". C++ is just as good a language as any other for the purpose.
Maybe the person who is deciding prefers the reassurances offered by using a statically typed language, which, short of the rather new D, C++ is about the only one out there.
Maybe the person who is deciding prefers the reassurances offered by using a deterministic memory model rather than using a GC which may actually never clean anything up.
Really though, the real reason may simply be, "Why not?" Backed by a good GUI framework C++ can be a very good "business app" development language.
Compared to Java, the primary reason is to keep your users from hating you. Java has its own windowing library that produces applications that look and feel foreign and clumsy to most users accustomed to Windows, MacOS or most X window managers (though at least Linux users are more accustomed to pluggable window managers and associated variations in look and feel so they're likely to find it somewhat less objectionable).
Comparing to .NET is a bit more difficult. First, a lot depends on whether you care about portability. If so, you need to restrict your development to the parts of .NET that are supported by Mono. That's a pretty big subset, but it's still missing a few important parts (e.g., at least the last time I looked, WPF support was missing completely).
That means if you care about portability, you pretty much have to restrict yourself to WinForms instead of WPF. In the process, you get back to (a milder version of) the problem with Java -- even though computational performance will be more than adequate for most business applications, the application will still feel somewhat slow and clumsy. On something like MacOS, it'll also be fairly foreign. While they're working on this problem, there's nothing that I'd consider really usable available today. You can write Mono/OS X apps that use other interfaces such as Cocoa and GTK, but doing so means losing portability to Microsoft's implementation.
On the C++ side, you can use Qt if you care about portability, and while it may not produce the "sexiest" UI possible, it'll be plenty good so users don't object to the result. If you don't care about portability, you can use a "native" toolkit and get slightly "sexier" results (e.g., MFC on Windows directly supports Office style ribbon bars, which are possible but much more of a challenge in .NET applications).
Besides from the reasons mentioned by Péter Török, I cannot see any.
[Talking from personal experience]
With a C++ programmer you can easily develop an application directly in Java/C# an possibly Python.
Advantages:
- You have a lot of libraries already available with the default language installation (true for all the three languages mentioned above)
- GUI is easy to design (in C++ without some 3rd party libraries you're out of luck)
- What you do is guaranteed to be portable across platforms
- You don't have to deal with linking, compilation flags issues (people who tried using more libraries (10-20) in one program know what I'm talking about - some libraries have different flags that are incompatible with others and this forces you to create wrappers - which is not productive)
- A lot of documentation (true for all the three languages mentioned)
Disadvantages:
- It's not C++ :)
- It's not as fast as it can get but the performance is no issue in case of "basic business application"
- Some issues that may appear may not be easily fixed without some C/C++ coding behind the curtain.
Is the question about the strengths of C++ in a broad sweeping sense? Then they are: maturity, performance, OO, portability, huge set of libraries and APIs, ... the list goes on. All pretty well-known things.
Is the question to compare C++ to some other language? Then what is the other language and what are the criteria we should use for comparison?
If this truly is for a "basic" application, then just about any mainstream language is trivially justified. The difference between C++ and another language is not going to be vast when the application is basic.
What is meant by "pure" C++? Does this mean C++ without any libraries that aren't part of the C++ standard? If so, this is silly hypothetical question. Like asking someone to code with one arm tied behind their back, to use Perl without any 3rd party modules, use JDBC without vendor-specific drivers, C without 3rd party libraries. The fact is third party libraries do exist and should be considered available when evaluating (or justifying) a language.