Navigation
Search
|
State of JavaScript: Highlights of the JavaScript developer survey
Wednesday January 22, 2025. 10:00 AM , from InfoWorld
Getting a complete picture of the multi-headed beast that is the JavaScript ecosystem isn’t easy, but the annual State of JavaScript survey is a good place to start. What makes this survey stand out is that it attracts the input of thousands of working developers and other JavaScript enthusiasts. Reading it gives you a real sense of the movements that are defining the language and its ecosystem.
Here I’ve collected my key takeaways from the recently released 2024 State of JavaScript survey, starting with a look at one of the most important trends currently rocking the world of software development. We’ll also look at ongoing pain points, popular new language features, and a plethora of tools and frameworks ranked by popularity and use. AI code generators Despite all indications that AI is eating programming, 14% of developers responding to the 2024 State of JavaScript survey said they did not use any AI code generator at all. For developers who were leaning on AI copilots, ChatGPT was #1 (67%), followed by GitHub Copilot (48%), Claude (23%), and Gemini (14%). JavaScript pain points It turns out some JavaScript developers still want static types, with 32% of respondents identifying the lack of types as painful. One of the proposals making the rounds is Type annotations, which would allow coders to opt-in to static types directly in JavaScript. A question that arises is what would happen to TypeScript if JavaScript were to gain static types. However, it seems that adding this feature is a slow process, in part because many developers are content with TypeScript. The advantage of adding types to the JavaScript spec would be eliminating the compilation step that TypeScript requires. With close to a third of developers still interested, it seems only a matter of time before static types are accessible directly in JavaScript. Pain points in features and usage At a higher level, developers noted they are missing features found in other languages, including a standard library (43%), Signals (39%), and a pipe operator (23%). Another category of pain point is usage, where developers noted deficiencies in architecture (35%) and state management (31%), followed by dependency management (29%), build tools (28%), and performance (24%). Newer JavaScript language features JavaScript and its feature set are always evolving. This year’s survey asked developers which of several newer syntax features they were using. Three rose to the top. Nullish coalescing You are surely still programming in 2023 if you haven’t at least experimented with the concise beauty of the nullish coalescing operator, introduced in ECMAScript 11. But that’s okay: it only takes about five minutes to get the gist of the?? syntax. Here’s an example of how to use it to replace explicit null checks on an object chain: let machineStatus = report?.machine?.status?? 'No thinking machines!'; If report or machine are null, the expression will short-circuit and machineStatus will default to “No thinking machines!” According to the survey, a full 85% of respondents have adopted this operator in their code. Promise.allSettled() and Promise.any() A Promise is a handy way to deal with asynchronous operations and the allSettled() and any() methods give you a simple way to say: wait for all or any of the operations to complete. These are two very common needs in async, and developers are taking to the new syntax, with 47% of respondents saying they use allSettled() and 43% any(). Array.toSorted() Forty percent of respondents have started using Array.toSorted, and it’s easy to see why. It takes a common need—sorting an array of values—and makes it simple. It uses natural order (like alphanumeric for strings) by default, but you can also provide a sort function: const spiceInventory = [ { spice: 'Melange', quantity: 500 }, { spice: 'Sapho', quantity: 100 }, { spice: 'Rakis', quantity: 200 } ]; // Sort by quantity in descending order const sortedInventory = spiceInventory.toSorted((a, b) => b.quantity - a.quantity); Set methods: union, intersection, difference A Set is a collection with no duplicates, drawn from set theory. Sets will always be somewhat narrow in their use; in fact, currently 76% of respondents say they have yet to use the new feature in JavaScript. Nonetheless, Sets are perfect for some scenarios, and some are starting to catch on: Set.union()—used by 16% of respondents Merge sets: const set1 = new Set([1, 2, 3]); const set2 = new Set([3, 4, 5]); const unionSet = set1.union(set2); // Result: Set {1, 2, 3, 4, 5} Set.intersection()—used by 15% of respondents Find the shared parts: const set1 = new Set([1, 2, 3]); const set2 = new Set([3, 4, 5]); const intersectionSet = set1.intersection(set2); // Result: Set {3} Set.difference()—used by 15% of respondents Find the different elements: const set1 = new Set([1, 2, 3]); const set2 = new Set([3, 4, 5]); const differenceSet = set1.difference(set2); // Result: Set {1, 2} Object.groupBy() Another new feature, Object.groupBy(), gives you a dead-simple mechanism for organizing objects according to a property. As of the 2024 survey, 33% of respondents indicate they have used it. This is one of those features you’ll likely ignore until you need it—and then you’ll find it’s the perfect solution for your problem: const books = [ { title: 'The Hitchhiker's Guide to the Galaxy', genre: 'Science Fiction' }, { title: 'Pride and Prejudice', genre: 'Romance' }, { title: 'The Lord of the Rings', genre: 'Fantasy' }, { title: '1984', genre: 'Science Fiction' } ]; const booksByGenre = Object.groupBy(books, (book) => book.genre); /* Gives you: { 'Science Fiction': [ { title: 'The Hitchhiker's Guide to the Galaxy', genre: 'Science Fiction' }, { title: '1984', genre: 'Science Fiction' } ], 'Romance': [ { title: 'Pride and Prejudice', genre: 'Romance' } ], 'Fantasy': [ { title: 'The Lord of the Rings', genre: 'Fantasy' } ] } */ Libraries and frameworks The State of JavaScript survey captures an enormous amount of data about the tools and frameworks developers are using, including the current general sentiment about each tool and changes in sentiment and usage over time. This ingenious chart takes a wide view, showing sentiment change over time for build tools, front end, back end, meta-frameworks, and testing tools. We’ll look more closely at a few specific categories. Front-end frameworks Angular is in an interesting moment, as it bounces off a long-term decline in popularity to recover strongly in both “positive opinion” sentiment and usage. As of the 2024 survey, Angular has successfully pulled itself out of the “little used/unliked” quadrant. This framework might be worth a look if you haven’t checked it out in a while. Svelte and Vue: These two open-source darlings are neck-and-neck with “would use again” sentiment at an impressive 88% and 87%, respectively. React: The flagship reactive framework remains strong, with a “used it and liked it” rating of 43%. This year’s survey allowed for “used it, no sentiment” and React showed 24% there. Not surprisingly, almost no respondents said they had not heard of React. Build and repository tools Vite is the star among build tools in terms of growing usage and developer sentiment. Fifty-one percent of respondents said they have used Vite and have a positive feeling about it. It’s clearly winning developers over with its take on the build-chain experience. It boasts a 98% retention rate—the highest of all the ranked build tools. pnpm is touted as a fast drop-in replacement for npm, which also supports monorepos. It has 93% positive sentiment and ~42% of respondents said they had used and liked it. Fifteen percent of respondents hadn’t yet heard of it. After Vite, esbuild is considered the most-loved build tool according to the State of JavaScript survey, with 91% user approval. It touts its speed over other tools and built-in support for JavaScript, TypeScript, CSS, and JSX. Another interesting build choice you may not have heard about is SWC, a Rust-based build tool that is meant for speed and one-stop compile/bundle builds. The survey indicates it has an 86% positivity rating. Testing tools On to the onerous, must-do task of testing. Just kidding, sort of. Fortunately, there are plenty of frameworks to help with testing, and a few stood out. Right alongside Vite is its testing framework, Vitetest, with 98% retention among users. A library to check out if you are ever forced to do testing. Another contender is Playwright, also very popular with a 94% “would use again” rating from users. The aptly named Testing Library shows 91% positive sentiment among users. Meta-frameworks The 2024 survey shows a subtle but discernible downturn in user sentiment about meta-frameworks, even while actual usage continues to increase. Astro.js is a standout among meta-frameworks. Its usage is growing rapidly, and while its “positive sentiment” shows a slight decline over time, 94% of users said they “would use it again.” The upshot is that Astro.js remains a rising star in its class. With a “would use again” rating of 90%, SvelteKit continues to be a popular meta-framework option. In line with the general trend, its sentiment has declined somewhat over the past couple of years. The pioneer and still the most popular of the meta-frameworks by far, Next.js is holding steady against last year in usage, while its sentiment has declined sharply to a still-solid 68%. Other notable libraries The survey covers quite a few other libraries, as well. Two notables are Lodash, which 43% of respondents reported using regularly, and Three.js, the premier 3D library for JavaScript. It’s worth visiting the Three.js website just to explore demos like this one. Now that’s just neat. Hosting services AWS is still the most popular cloud hosting service—but not by much! Here’s a quick rundown of the most popular by survey respondents: AWS—44% Vercel—40% GitHub Pages—38% Netlify—38% Cloudflare—21% Heroku—19% The story here seems to be that the top four hosting platforms are the kings of JavaScript hosting, with everyone else bringing up the rear. Conclusion The JavaScript ecosystem continues to be a festival of evolving tools, frameworks, and features. The most recent State of JavaScript survey gives us an extremely useful way to stay up to date and get a good look at things.
https://www.infoworld.com/article/3804318/state-of-javascript-highlights-from-the-latest-javascript-...
Related News |
25 sources
Current Date
Jan, Thu 23 - 13:25 CET
|