Explore the benefits and any costs with using C# versus Swift or Objective C.
- [Instructor] C# on a Mac? So what is C# and why would you want to use it for Mac development? C# is a general purpose strongly-typed object oriented programming language. But so is Objective-C and so is Swift. So you might be asking yourself why you'd want to develop software on the Mac using C#. The easiest answer is portability. You can't port software written in Objective-C or Swift to another platform other than iOS or macOS.
There's an obvious attraction to a system that allows you to write code once and run it in a variety of platforms. If you're publishing your work in app stores you'd like to publish to all of them, not just Apple's. I also think that C# is a more attractive option for the seemingly millions of Java developers out there who were disenfranchised from the Apple software development landscape back in 2012. Java used to be a first-class citizen on the Mac complete with a special JDK written by Apple and a set of bindings that allowed you to make Cocoa-style apps in Java.
I learned Visual Basic and that's what got me hooked on Visual Studio, which is a descendant of the Visual Basic IDE devised by the famous Alan Cooper. Later I learned Java because it was the hot new thing but quickly became disappointed with the performance of the apps built using the earliest JDKs. The thing about this was that it wasn't really different from learning Visual Basic. They both use strong variable types which line up nicely and Int means the same thing in both languages. They both use dot syntax for objects.
There are a lot of similarities. Objective-C, on the the other hand, is a lot more like C++ development. While C++ is probably one of the most powerful programming languages you'd ever come across the learning curve is steep and the language itself can be unforgiving. Ask anyone who's made a mistake with a pointer and contrast that to the experience you get with C# or Java automated garbage collection. I think that Objective-C was unattractive to the broader coding community because it's so different from the Visual Basic, Delphi, and Java worlds many of us came from.
C# is exactly like Java. The syntax is the same but C# uses different keywords. Learning C# is very easy coming from any other language, including C++ and Objective-C. And since Microsoft doubled down on supporting as many platforms as makes sense with their tools we now have a language that's easy to learn yet powerful enough for anything you throw at it from console apps to desktop, web, and mobile application development. You can do it all in C# and now you can do it all on the Mac.
- Exploring C# on a Mac
- Creating a reusable code library
- Classes and properties
- Loops, arrays, and lists
- Creating a console app
- Creating a command-line app
- Creating a Mac desktop app
- Creating a UI with view controllers and actions