views:

452

answers:

14

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++?

+15  A: 

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 ;-)

Péter Török
+1 That's the best I could come up with too!
David Relihan
You could add "My colleagues" or "The maintainers" are more experienced in C++.
Matthieu M.
@Matthieu, thanks, added.
Péter Török
"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/...)." I think I'm feeling that one...but he said that he stopped doing optimizations in his code when he found out that "the compiler does this for you"...So you'd think he'd know that Java and C# do compiler optimizations under the hood as well.
leeand00
@leeand00, unfortunately a lot of people stop learning at some point in their life :-( sometimes this happens when they become promoted :-(( which in itself can be fine - unless they keep believing that they are as technically competent as ever :-(((
Péter Török
+1  A: 

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... :)

Michael Dorgan
support-base, portability, library support aren't really arguments for C++... Java is more directly portable, has better general libraries, and a huge developer base. He needs answers that mean C++ is a good choice despite not being the normal best choice for business apps
John
"Ease of portability" is not a really good argument because it is only too easy to write code that will not be portable. And while there are many libraries available in C++, each platform has its own set of commonly used libraries.
jhominal
+9  A: 

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)

John
This answer makes sense. +1 John
leeand00
+4  A: 
  • 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#)
baultista
Explain why "performance is a major concern" for a generic business app and I'll give you the -1 back...?
John
@John: He is not saying that. He is saying "in the event that performance is a major concern for a specific business application, it would justify implementation in C++".
danben
It really depends on what the "generic business application" is doing. We have apps to handle data processing/loading specifically written in C++, with developers citing performance as the reason we haven't deprecated it in favour of a solution written in managed code (for the sake of maintenance by future developers, as we have few people here with C++ expertise). Spot on, danben.
baultista
@danben if we're going to treat this as a generic "what's the difference between C++ and other languages" question it's a duplicate and should be closed... I don't think that's what the author meant at all.
John
@John: I won't disagree with that. Look at the top-voted answer.
danben
A: 

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).

pastjean
A: 

Needing to write close to the machine (It is possible in higher level languages but I find it more natural in C++).

utnapistim
He said a business app, so this is specifically talking about a generic app not something where we assume performance is an issue.
John
Business apps can't care about performance? Really? None? Ever? For instance, a "basic business app" that presents simplified analytics might have to process an enormous amount of data behind the scenes to present a pretty picture to the user.
frankc
That's not something that would be expected from a typical basic app. If it's doing large amounts of computation it's no longer simple. The majority of apps and web-apps are just dialogs/web-pages that let you view and save data... glorified CRUD.
John
Your scope of what you think business apps need to do is quite limited. It's a big world out there. You should not be making such blanket statements.
frankc
A: 

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++.

caspin
Everyone's jumping on performance... read the question. In basic apps - dialogs and DBs - it's not a factor, from his wording I think that's the key question here?
John
Saying is C# or Java can perform just as well as unoptimized C++ is stretching the truth. There are not very many cases where even a rigged benchmark can show them performing even close to the same. Equal performance should not be used as a selling point of Java or C# over C++. There are many other reasons to possibly choose them, use those instead.
mfperzel
Does it do what I want instantly when I click the button? If so it's not a factor...
John
@John Right, I meant a basic client-server application with Dialogs and DBs.
leeand00
+19  A: 

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:

  1. Portability over wide range of CPU architectures... not likely for a business app.
  2. Device Drivers in native code... ditto.
  3. High performance floating point number crunching (i.e. SIMD)... ditto.
  4. Ability to interface with assembly language routines... ditto.
  5. 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.

Amardeep
All other concerns pale in compared to this last one, IMO. If using Language X will ship a product faster because the team is more familiar with it/existing code is written in it/a third-party library you need uses it/any other reason, you are *not* doing your employer a favor embarking on a holy war against X because you don't like it for minor technical reasons.
On the other hand, you would need to be really much more proficient in C++ for it to have a better time to market. Linking, compiling, pre-processing, not falling in low-level pitfalls… That's a lot of work.
jhominal
+2  A: 

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).
caspin
+2  A: 

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.

Kelly French
But you'd make Java/.net install through your installer in such cases... unless it was a specific platform which the initial question suggests is not the case.
John
Basically it's when you want to have one less assumption. There are machines that are too old to support .Net, maybe it's the hardware like a 400MHz Pentium, maybe it's the OS version (Windows 95 for example).
Kelly French
But then we're in a specialised situation again... definitely such cases exist but unless you know this it's something you'd ask about but not expect.
John
True - the "basic business app" is where Visual Basic shines. That hypothetical oil rig will not keep 400 Mhz Pentiums with W95.
MSalters
+1  A: 

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.

Noah Roberts
C++ is fundamentally more work and messing about than many other languages. You can do it, but unless your dev team's skill is biased towards C++ something else is objectively better... less code to write, better graphical design tools, etc. And, I should note, I am a C++ guy by trade.
John
That's just nonsense.
Noah Roberts
+5  A: 

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).

Jerry Coffin
I actually agree with the "Java GUI sucks" argument, perhaps it's better these days but I never met a Java app that looked like a Windows app running on Windows (or a Mac app when running on Mac).
John
You can use GTK# for any platform supported by Mono - you just have one more installer to run and it will play on Microsoft's .NET (Tomboy does that for example).
jhominal
+2  A: 

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:

  1. You have a lot of libraries already available with the default language installation (true for all the three languages mentioned above)
  2. GUI is easy to design (in C++ without some 3rd party libraries you're out of luck)
  3. What you do is guaranteed to be portable across platforms
  4. 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)
  5. A lot of documentation (true for all the three languages mentioned)

Disadvantages:

  1. It's not C++ :)
  2. It's not as fast as it can get but the performance is no issue in case of "basic business application"
  3. Some issues that may appear may not be easily fixed without some C/C++ coding behind the curtain.
Iulian Şerbănoiu
A: 

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.

John