What is best couple for developing small and fast GUI application with some graphical editor features - C++ and (VB or Win32)?
It has to make some time consuming calculations, so i need it to work as fast as possib开发者_如何学编程le.
Also thought about Delphi. So. Is it a question of taste(or habit) or not and what can you advice me then?
Let's try to analyse them:
C++
Pros:
- Generates native code, so it's fast.
- Allows very low-level access to go all out in optimizations.
- Can be highly cross-platform.
- More prone to unreadable code. (Personally, I think that the fact a utility like cdecl even EXISTS, is a good sign that parts of C is not meant to be readable - and since C++ is mostly a superset of C, the same applies here.)
Cons:
- You need to manage a lot on your own, which can easily introduce memory leaks and the like if you aren't careful to get all of this managed somehow (smart pointers, for example).
- Compiling is sloooow.
Delphi
Pros:
- Fast compilation.
- Generates native code with no runtime dependencies by default.
- Allows you to easily integrate low-level assembly if you want to.
- You generally don't need to mess with pointers, but you can if you want to.
- Very nice GUI builder, and the VCL is a nice toolbox which serves most of your basic component needs.
- Delphi code is generally pretty easy to read.
Cons:
- Delphi isn't as widespread of a language, so references might be a problem.
- If you need to interface with external DLLs, you're less likely to find finished Delphi code that allows you to call the DLL methods; you are more likely to need to write the required declarations yourself (there are tools, apparently, but I don't know how well they work...)
VB6
Pros:
- There are still a LOT of references out there.
- Let's face it, while we may not like the language, it is pretty easy to read.
Cons:
- Extremely outdated environment.
- Not supported anymore.
- Not suitable for code needing to be overly efficient.
VB.NET (C# as well)
Pros:
- Due to the architecture of the .NET framework, you could theoretically get more performance, because it is able to optimize the code for the specific CPU it's being run on.
- Gigantic library at your disposal (.NET framework).
- Memory is pretty much managed for you. That means it's a lot harder to mess something up there.
- Popular languages, so lots of references out there.
Cons:
- Memory is pretty much managed for you. This means some performance aspects are out of your control.
- You can't really drop down to low-level assembler code, because it's compiled to an intermediary format. Sure, you could implement your own method in IL, but there's usually not as much to be gained as with assembler.
My personal vote goes to Delphi, because it lets me build fast applications quickly, and the latest releases have really improved on the feature set and the usability of the IDE.
The choice is simple. Delphi, hands down. C++ has the high-powered calculation ability you need, but no good GUI builder. VB's got a good form designer, but good luck getting high performance out of it, in either VB6 or the .NET version!
Delphi compiles to very efficient native code, and even includes an inline assembler if you need to tweak your calculations at that level. And it has a very easy-to-use form designer. As long as you only need to compile support Win32, Delphi's the obvious choice. (And that restriction's looking like it's going to change soon, from what the Delphi team's been saying lately...)
I have to disagree with Mason. If you're writing a Windows GUI application that needs to execute fast, and be easy to build, C# is the way to go. With .NET 3.5 you can get very fast calculations through the .NET runtime and it has great form editing support. Furthermore if you have experience with C++, C# is very easy to pick up.
Another added benefit of C# is that if you find down the road that your calculations are too slow, you can always write the computationally expensive code in C++, wrap it in a DLL, and call it from C#.
All in all C# beats anything else at quickly building Windows applications without sacrificing too much performance.
As a last statement I'd like to say that I am not paid by Microsoft, I generally hate managed languages, and to this day I avoid writing C# whenever possible because I prefer C++. That said, the usefulness of C# has made me a believer in using it for anything that either needs to be done quickly or needs a user interface, because fiddling around with MFC, WTL, ATL or COM totally sucks.
If you have worked in a language before that is the best choice. The time to learn a new environment is long compared to the gains for most language in the short term.
That said -- if you plan on working in an environment for more than, I don't know, a year then it makes sense to learn a new one.
精彩评论