Categories
Languages

Infographic: Programming languages adoption trends 2020

Languages are a beloved subject of debate and the kernels of some of the strongest developer communities. The choice of programming language matters deeply to developers because they want to keep their skills up to date and marketable. They matter to toolmakers too, because they want to make sure they provide the most useful SDKs. So which programming languages had notable changes in adoption trends in the last 3 years? Find the answers in our infographic with key findings from our Developer Economics 19th edition survey, which ran in June-August 2020 and reached 17,000 developers in 159 countries. 

JavaScript is the most popular programming language

As of Q3 2020, 12.4M developers globally were using JavaScript. We also estimate that in mid-2020 there were 21.3M active software developers in the world. So, 58% of all developers use JavaScript. Notably, the JavaScript community has been growing in size consistently for the past three years. Between Q2 2017 and Q3 2020, nearly 5M developers joined the community – by far the highest growth in absolute terms across all languages. Even in software sectors where JavaScript is least popular, like data science or AR/VR, over a fifth of developers use it in their projects. 

It’s a good idea to learn Python

For the second half-year period in a row, Python is the most widely adopted language behind JavaScript. Python now counts 9M users, after adding 2.2M net new developers in the past year alone, outranking Java at the beginning of 2020. The rise of data science and machine learning (ML) is a clear factor in its popularity. An impressive 77% of ML developers and data scientists currently use Python. For perspective, only 22% use R, the other language often associated with data science.

What’s new with Java and other well- established programming languages?

Java, with over 8M active users worldwide, is the cornerstone of the mobile app ecosystem – Android – as well as one of the most important general-purpose languages. It’s adoption may have remained stable in the past six months but, in the overall picture, the Java community has gained 1.6M developers since mid-2017, which corresponds to a 24% growth.

The group of major, well-established languages is completed with C/C++ (6.3M), PHP (6.1M) and C# (6M). The fact that C# lost three places in the ranking of language communities during the last three years is mostly explained by its slower growth compared to C/C++ and PHP. C and C++ remain core languages in IoT projects (for both on-device and application-level coding), whereas PHP is still the second most commonly used language in web applications, after JavaScript. On the other hand, C# may be sustaining its dominance in the game and AR/VR developer ecosystems, but it seems to be losing its edge in desktop development – possibly due to the emergence of cross-platform tools based on web technologies.

Android developers behind Kotlin growth

Kotlin is one of the fastest growing language communities, having increased more than two-fold in size since the end of 2017, from 1.1M in Q4 2017 to 2.3M in Q3 2020. This is also very evident from Kotlin’s ranking, where it moved from 11th to ninth place during that period – a trend that’s largely attributed to Google’s decision to make Kotlin its preferred language for Android development. 

Swift surpassed Kotlin in popularity this year, after attracting slightly more net new developers in the first half of 2020 (400k vs 300k). Since Swift became the default language for development across all Apple platforms, the adoption of Objective C has been decreasing steadily. This phase-out from the Apple app ecosystem is also matched by a significant drop in the rank of Objective C, from ninth to 12th place. 

Finally, the more niche languages – Go, Ruby, Rust, and Lua – are still much smaller, with up to 1.5M active software developers each. Ruby and Lua have been around for more than two decades now, but their communities have essentially stopped growing in the last three years. On the contrary, Go and Rust appear to be actively adding developers, although it is still unclear whether the two languages will climb the programming language ranking in the coming period.

What’s your favourite programming language? Take our Developer Economics 20th edition survey to support your choice!

Infographic: Programming languages adoption trends 2020
Categories
Languages

Understanding Swift: 5 things app developers should know

The most surprising thing to come out of Apple’s WWDC event this year was a new programming language for iOS and Mac development – Swift. To the sceptical this might not seem like anything more than a way to entice more new developers to build apps exclusively for Apple platforms and lock them in. While investment in developer tools is always partly about making a platform attractive to developers, this move has far more benefits and strategic implications.

Swift-de

1. What is Swift?

Swift is a statically typed, compiled language, interoperable with the Objective-C and C code that are currently used to build Apple’s platforms and the native apps that run on them. However, it also has the feel and features of more modern scripting languages. In creating Swift, Apple has attempted to give developers the best of both worlds, the performance of native code but the convenience and productivity of a scripting language.

2. Faster, Safer and Less Code

In fact, Apple claims that Swift is faster than Objective-C, yet at the same time developers are freed from the burden of explicitly declaring types (they’re inferred), or manually managing memory (it uses automatic reference counting). With features such as “optionals” (a generic way of checking if things exist before using them) and type safety (no default attempt at an implicit cast), the compiler is able to prevent many of the worst bugs that crop up in the C family of languages while reducing the amount of code that has to be written and maintained. Another productivity enhancing change from the legacy of C is the elimination of header files, keeping interface definitions and implementations in one place.

3. Interactive

Although reducing the amount of code required to perform simple tasks is productivity enhancing on its own, even greater benefits are obtained by reducing feedback cycles. In the same way that a simulator allows more rapid testing of new code and ideas than building for a device and installing, live coding environments provide almost instant feedback as the code is written. Such tools are not traditionally available to compiled languages but Apple has created “Playgrounds” for Swift. These don’t provide live coding for an entire app but allow developers to experiment with new algorithms or bits of UI in such an environment before copying them into an app. Similarly, whilst being able to inspect variables in a debugger is useful, it’s even better to be able to interact with an app while it’s running. Swift provides a REPL (Read-Eval-Print-Loop) for this, much like the debug console for JavaScript in most browser development tools.

4. Functional friendly

The language also has functions (and closures) as first class objects with a much more readable syntax than Objective-C’s blocks, making it easier to apply functional programming techniques. This could be particularly helpful for fans of Functional Reactive Programming (FRP) – a programming paradigm that has been gaining in popularity for app development amongst a lot of smart developers. It helps to eliminate complexity when dealing with things like user input and asynchronous network communication – two key areas for most mobile apps. A team at GitHub actually created an FRP library for Objective-C, called ReactiveCocoa, which is extremely well thought out but forced into the most painful syntax by the language.

5. What’s the catch?

Sounds a bit too good to be true, right? Being a compiled language and using reference counting, rather than a garbage collector, developers are still responsible for avoiding memory leaks due to strong reference cycles. These happen when two objects refer to one another, directly or via a chain of other objects. So, while the language may be beginner friendly, it makes it fairly easy to write code that leaks memory. To avoid this, developers need to understand how the memory is managed for them and how to break these cycles. It’s not horribly complex but it’s a long way from not having to worry about memory management at all. That said, most iOS apps will get away with leaking a bit of memory – usually the device will just silently kill them in the background when the memory is required for another app.

Being compatible with C and Objective-C makes Swift a fairly big language – there are quite a lot of concepts and bits of syntax to learn for a new developer, rather than one coming from an Objective-C background. Also, as a type safe language, Swift is going to be much less forgiving to the novice that would prefer the compiler just figured out what they meant when comparing the integer 1 with the floating point value 1.0 or the string “1”.

Swift is currently an iOS & Mac only proprietary language. Unlike Objective-C, which has an open source compiler and runtime (used by Apportable) there’s not likely to be any way to use the code on Android or other platforms. However, most developers wanting a cross-platform approach are unlikely to have started with Objective-C anyway, so this is not really creating significant extra lock-in. It might just persuade some developers choosing a cross-platform tool to target iOS because it’s easier, to create a fully native app instead.

Why does it matter?

First, more developers. Although modern Objective-C has a lot of good points, it’s an evolution of a very old language. Syntactically it’s quite different from most other modern languages – it borrowed from Smalltalk while the rest of the world followed C/C++. This creates a barrier to entry for developers in other languages because the code initially looks alien. Additionally, any language that has pointers is a hard sell and steep learning curve for complete beginners. Swift fixes those things and should make developing for Apple products attractive to an even wider audience.

Second, more productive developers. Greater productivity means lower cost of development and/or shorter time to market. The combination of more rapid development and lower fragmentation versus Android should help to keep iOS as the first platform developers target, even as its market share continues to shrink through the faster growth of Android globally. This is very important if Apple intends to stay exclusively at the premium end of the market.

Last but not least, happy developers. Although several cynical commentators have latched onto the proprietary language lock-in angle, it seems rather unlikely that giving developers a new language to learn is going to lock them into developing for a platform when the barrier to exit is, well, learning a new language! Instead consider that Apple is primarily aiming to retain developers through loyalty rather than lock-in with this particular move. It should not be underestimated how much good tools can contribute to the enjoyment of daily development work. If Swift can deliver on its promises then other platforms will have to be that much more attractive to tempt the best developers away.