Game World!

Join A World Of Gamers

Enter your email address:

Delivered by FeedBurner

Followers

Popular Posts

Friday, 2 July 2021

Should I learn C++ Swift?

 The killer feature C++ has is seamless integration with C code as well as being a well established language which a lot of code is written in. C++ has a lot of practitioners. Not to mention countless libraries for GUI programming, 3D graphics engines, and a multitude of other things which takes a very long time to write.

So seen from the perspective of someone intending to write some new piece of code, they have several things to consider:

  1. How good is the language itself.
  2. What sort of libraries exist that will help me do what I want to achieve.
  3. What is the community around that language? How easy is it to get help, hire people or ask questions.

C++ is very strong on the latter points. However IMHO C++ is a terrible language. If not for the vast amount of code, libraries and knowledge that exists out there, nobody in their right mind would pick C++ for their project.

Swift is IMHO better than C++ in almost every area, if the languages were compared in a vacuum. It gives similar performance. It has much stricter and better type system. It is more well defined. C++ has a lot of areas with undefined behavior which leads to bugs and problems. Swift is a lot faster to learn as a language.

I have been doing C++ programming on and off for over 20 years, and despite all that experience a lot of problems I never found a good solution for in C++. I still struggle with how to solve problems in C++. The language simply gets in the way too frequently. In contrast with just minimal training in Swift, I can quickly solve problems I struggled a long time with in C++.

Not to mention the Swift compiler catches so many serious bugs, that goes completely undetected by a C++ compiler. C++ last time I used it e.g. cannot catch that you are calling a virtual function indirectly from a constructor.

Keep in mind that better technology does not necessarily win. The PC architecture was never very good. Yet it beat out significantly better architectures. Price, availability and momentum mattered more. The x86 CPU architecture was not particular good, but it beat the competition because intel was able to pour far more resources into advancing it. C++ is in a bit similar situation. A lot of people are invested in C++, so despite its creaky foundations it is moving ahead because a lot of resources is poured in to make it better.

Floating Button

Button