[sdiy] Programming Language Recommendation

Brian Willoughby brianw at audiobanshee.com
Tue Dec 8 23:44:56 CET 2020

On Dec 6, 2020, at 06:59, Ingo Debus wrote:
> Am 05.12.2020 um 22:11 schrieb Brian Willoughby:
>> Also note that C++ and Objective C are built on top of standard C. They're literally extensions of C, so everything you learn about C will be 100% applicable to C++ or ObjC.
> When I was looking into Objective C (more than 10 years ago), I found that that language is almost (but not entirely) unlike C. Still it’s true that it is „compatible“, as in every valid C program is also a valid Objective C program. But if you want to use these nice Objective C features, you don’t program C-style. So, this compatibility is 100% true but 100% useless information, much like in that old joke:
> https://flunkingfamily.com/best-microsoft-joke-ever-will-enjoy/
> (still wondering why this joke is about Microsoft and not Apple).

It's very interesting that your experience is completely different from mine. I've been using Objective C for almost 30 years, and standard C for about 35. There have been countless projects that I started in standard C and then promoted to Objective C once I realized that I needed a bit more than mere C structures can easily handle. Rather than 100% useless, I've found it incredibly helpful to simply rename my foo.c source to foo.m and continue developing. In fact, I never have much to change to upgrade C to ObjC, because everything that was working in C will continue to work in ObjC. Only the new features have to be non-C.

If you know standard C thoroughly, then Objective C should only take 2 weeks to learn. In that sense, there's way more overlap than with just about any other language pairing. C++ is much further from C than this.

I learned assembly first, then C, then Objective C - with brief excursions into BASIC, PASCAL, and then later a very serious excursion into Display Postscript (rather similar to FORTH in some ways). The thing about Objective C is that the language finally taught me to design at a level much higher than the language. This helps with embedded projects because there are often hardware peripherals that can take on major tasks much more efficiently than the CPU. Whether a design is broken down into objects or hardware peripherals, it's still a matter of breaking a design down into manageable components.

Perhaps learning Objective C has changed the way that I design, even in standard C. Also, perhaps the fact that I knew standard C thoroughly before learning ObjC, that means I've been able to keep the differences in syntax and design to an absolute minimum.

Of course, in the embedded world, there's about 0% chance of converting a standard C firmware to Objective C. It's theoretically possible, because the compiler is portable, but I don't know of any embedded runtimes for ObjC (not counting iOS, since it's closed).

Regardless of whether anyone agrees that everything you learn about C is 100% applicable to C++ or ObjC, I still recommend that folks take the time to learn Standard C as fully as possible. It's far better to know a language completely, especially a language as pervasive as C, rather than learn several different languages at only a cursory level.

> Java, on the other hand, is much more C-like, but not compatible.

Java borrowed from Objective C (Java 2 interfaces are ObjC protocols) after having borrowed from standard C in the beginning.

> Ingo


More information about the Synth-diy mailing list