ProgrammingPro #54: Rust for Blockchain, Uno 5.2 Multi-Platform .NET Development, GitHub Copilot Enhancements, and React 19 Features
Bite-sized actionable content, practical tutorials, and resources for programmers
Today’s issue is brought to you by:
Tired of pricey eSignature APIs that are hard to integrate and debug? Developers choose airSlate SignNow API for:
Easy setup & reliability (4.5/5 on G2)
Unbeatable price-to-value
White labeling with multi-brand support
Detailed documentation
API dashboard, Postman collections, & SDKs
Expert tech support
Welcome to this week’s edition of ProgrammingPro!
In today’s Expert Insight, we bring you an excerpt from the recently published book,
Rust for Blockchain Application Development, which talks about the advantages of using Rust for blockchain development, including its role in enhancing security, efficiency, and interoperability across various blockchain platforms and smart contract development.
News Highlights: Uno Platform 5.2 simplifies multi-platform .NET development; GitHub Copilot Workspace boosts developer efficiency with guided feature creation; React 19 introduces async transitions for improved UI management; OpenText's extension ensures open source library security in DevOps workflows.
My top 5 picks from today’s learning resources:
Automate Your Workflow - How To Build a Task Scheduler with Python🤖
K2 Compiler Performance Benchmarks and How to Measure Them on Your Projects📊
But there’s more, so dive right in.
Stay Awesome!
Divya Anne Selvaraj
Editor-in-Chief
PS: This week, we are kicking off monthly feedback surveys which will run from the start to the end of the month. We invite you to take the opportunity to tell us what you think about ProgrammingPro so far, request a learning resource for future issues, tell us what you think about a recent development in the Programming world, and earn a Packt Credit each month to buy a book of your choice.
This month, we would love to hear your thoughts on the rising trend of using LLMs to help with code understanding. Take the survey to learn more and join the conversation!
🗞️News and Analysis🔎
Google lays off staff from Flutter, Dart and Python teams weeks before its developer conference: Google has shifted the Python team's responsibilities to a new group in Munich. Read to learn about the strategic shifts at Google.
OpenText releases new browser extension that verifies if open source libraries meet company security policies: Open Source Select integrates into the DevOps lifecycle to improve security. Read to learn how it enhances productivity.
GitHub Copilot Workspace provides developers a full step-by-step plan for creating features, applications: The platform utilizes natural language to boost creativity and efficiency. Read to learn how it reduces cognitive strain.
Uno Platform 5.2 Brings .NET Single Project Targeting 9 Platforms: The update enables developers to target nine platforms—iOS, Android, Windows, Mac, and various web and embedded systems—with a unified project structure. Read to learn how this simplifies development and reduces build times.
Amazon CodeWhisperer hushed by Q Developer, now generally available, while Q Apps enter preview: This integration enhances Q Developer with features like AI-powered code suggestions, security scanning, and code transformation capabilities. Read to learn more.
React 19 builds on async transitions: The version, now in beta, introduces support for asynchronous functions in transitions, aiding in the automatic handling of pending states, errors, forms, and optimistic updates. Read to learn about more new functionalities.
Svelte 5 moves to release candidate stage: Features such as the Runes API for enhanced reactivity, overhauled event handling, improved component composition, and native TypeScript support have been introduced. Read to learn how they facilitate more efficient development with reduced boilerplate.
🎓Tutorials and Learning Resources💡
Python
Top 10 Python Libraries for Data Visualization in 2024: This article covers the 10 libraries’ unique features, use cases, and strengths. Read to be able to choose the right tools for your specific needs.
Automate Your Workflow - How To Build a Task Scheduler with Python: This article explains how to build a Python-based task scheduler that automates the execution of Python scripts across all major operating systems. Read to enhance your productivity.
For more Python resources go to PythonPro
C# and .NET
New C# 12 feature proves controversial: Primary constructors ‘worst feature I’ve ever seen implemented’: While controversial, primary constructors are likely to remain a part of the language. Read to learn about the feature’s pros and cons.
🎓Tutorial | Getting the Current Time in C# - A Guide: This article covers methods like DateTime.Now, DateTime.UtcNow, and DateTimeOffset. Read to learn why you should use universal time, formatting, and time zone handling.
🎓Tutorial | Pipelines for .NET: This guide outlines essential pipeline steps like checkout, clean, restore, build, tests, and packaging. Read to learn through GitHub Actions examples provided for both program execution and NuGet package publishing.
C and C++
💼Case Study | Speeding up C++ build times: Figma engineers tackled slow C++ build times by identifying unnecessary includes as a major issue. Read to discover a multifaceted approach that cut build times by 50%.
C++17 parallel algorithms and HIPSTDPAR: ROCm 6.1, an open-source platform designed by AMD to enhance GPU computing, has introduced HIPSTDPAR, to optimize performance, especially on AMD CDNA2™ and CDNA3™ architectures. Read to learn how to exploiting multi-core and GPU architectures.
Variadic Functions in C: This article discusses implementation techniques and caveats, such as undefined behavior when mismatched argument types or counts occur, and the lack of built-in type safety. Read to learn best practices to avoid common errors.
Java
Modernizing Testing Practices for Jakarta EE Projects: This article highlights the importance of data-driven testing and the use of advanced testing libraries like JUnit Jupiter and AssertJ. Read to learn how to ensure more reliable and maintainable enterprise applications.
JPA vs Hibernate: What is the difference between them?: JPA, or Java Persistence API, sets the standard for Java custom software development, while Hibernate is an open-source ORM architecture. Read to be able to select the right tool for your needs.
🎓Tutorial | Spring Boot Timeout Handling With RestClient, WebClient, and RestTemplate: This tutorial provides code examples for each approach, demonstrating how to set timeouts effectively. Read to be able to ensure application responsiveness and reliability in various network conditions and service availability scenarios.
JavaScript and TypeScript
🎓Tutorial | How to use JavaScript statements in your programs: This article is a guide on using JavaScript statements to control program flow, including error handling. Read to enhance your coding problem-solving skills.
MoonBit adds JS backend, up to 25x faster than native JS: MoonBit, initially launched to enhance WebAssembly usage, now supports a JavaScript backend. Read if you are looking for high-speed, efficient coding and execution in web and cloud applications.
Announcing TypeScript 5.5 Beta: The new version introduces several enhancements including inferred type predicates, control flow narrowing, and type imports in JSDoc. Read to learn more.
Go
Evolving the Go Standard Library with math/rand/v2: This article discusses improvements in Go 1.22 aimed at modernizing the library while maintaining the essential characteristics that Go users rely on, such as speed and repeatability for non-cryptographic purposes. Read for insights into the strategic evolution of Go's standard library.
Go or Rust? Just Listen to the Bots: This article details the auhor’s exploration of using Go and Rust to create conversational bots that debate programming languages. Read to expand your skills in both languages and utilize APIs for text-to-speech and LLMs.
Rust
6 Rust programming mistakes to watch out for: This article delves into memory safety, borrowing, and error handling within the Rust language. Read to be able to write more robust and efficient code.
Rust Stream API visualized and exposed: This article explores the complexities and limitations of Rust's Stream API, highlighting its potential pitfalls in handling concurrency, backpressure, and execution. Read to gain insight through real-time Bevy visualizations.
PHP
A Free PHP Webpage View Counter that Ignores Self-Identified Robots: This article introduces a self-designed PHP webpage view counter that operates without relying on third-party services and specifically avoids counting views from identifiable web robots. Read to learn how to implement a lightweight and privacy-focused page view counter in PHP.
SQL
A Logic Language for Distributed SQL Queries: This article describes the development of Polar, a logic language designed to streamline authorization across microservices. Read to learn how Polar facilitates efficient and scalable authorization mechanisms in distributed systems.
Ruby
Choosing the Right Audit Trail Approach in Ruby: This article explores various Ruby gems for creating audit trails, each with unique strengths. Read to learn how to select an appropriate audit trail method based on specific application requirements.
Swift
Developing Embedded Applications with Swift: This article discusses the potential of using Swift for embedded development, specifically on microcontroller units (MCUs) without a Memory Management Unit (MMU). Read to learn how to set up and debug projects using high-level programming.
Kotlin
K2 Compiler Performance Benchmarks and How to Measure Them on Your Projects: This article discusses the performance enhancements of the new K2 compiler for Kotlin, which offers significant improvements over its predecessor. Read to learn detailed methods to measure the K2 compiler's performance.
🌟Best Practices, Advice, and Case Studies🚀
How to Use Multiple GitHub Accounts: This article offers a solution to the challenges of switching between personal and work accounts, which can lead to a cluttered commit history. Read to learn about effective strategies to manage multiple GitHub accounts by setting up SSH keys and directory-specific Git configurations.
Is Your Test Suite Brittle? Maybe It’s Too DRY: While DRY aims to eliminate unnecessary duplication in code, its strict application in test code can obscure the intention of tests and complicate maintenance. Read to discover a more balanced approach.
If Software Quality Is Everybody’s Responsibility, So Is Failure: This article discusses the misconception that software quality is solely the responsibility of testers. Read to learn why it should be a shared responsibility across the entire organization.
Turbocharge Innovation With Automated API Generation - Leveraging Automated API Generation for a Competitive Advantage: This article discusses the benefits of integrating generative AI with low- and no-code platforms for API generation. Read to learn how these technologies can accelerate time to market and foster innovation.
Take the Survey, Get a Packt credit!
🧠 Expert Insight 📚
Here’s an excerpt from “Chapter 2: Rust – Necessary Concepts for Building Blockchains” in the book, Rust for Blockchain Application Development
by Akhil Sharma.
Rust’s advantage for blockchains
Blockchains and blockchain-related technologies that use Rust have an edge over others and this …(excerpt) is dedicated to exploring this aspect. Let’s learn about how these technologies benefit
from using Rust.
Blockchains that use Rust
Some of today’s most popular blockchains, such as Solana, NEAR, and Polkadot, use Rust primarily. Polkadot even has a framework called Substrate that can be used to build new blockchains …and this is the framework that was used to build Polkadot itself..
Many new, highly innovative blockchains such as Aptos and Sui also use Rust…
Hyperledger’s Sawtooth is an open source, enterprise-ready blockchain solution for building, deploying, and running distributed ledgers, and this project is also built entirely on the Rust programming language.
Elrond has a WebAssembly virtual machine that utilizes Elrond’s web assembly framework and is also based on Rust.
The use of Rust is growing rapidly among blockchain projects and the Web3 community at large and in the coming years, we will see an exponential increase... (Now let’s look at) some technologies that make working with blockchains a bit easier. The best part is that these technologies are based on Rust.
Foundry for Ethereum
Ethereum, one of the most popular blockchains, requires smart contracts to be written in the Solidity programming language. But to build, compile, test, and deploy these contracts based on different environments, we usually use …JavaScript/Node.js (frameworks).
However, Rust engineers also have an option, and that is Foundry – a fast, portable, and modular toolkit for Ethereum but one that uses Rust. You get all the benefits of using Rust, such as cargo for managing dependencies and compiling the contracts….
As part of Foundry, you get three packages – Forge, an Ethereum testing framework, Cast, a tool for interacting with smart contracts and on-chain EVM data, and Anvil, a local Ethereum node, just like Ganache or the Hardhat network.
So, Foundry is a comprehensive, capable toolset for working with Ethereum but solely using Rust.
The Fe, Move, and ink! languages
New programming languages are being built with Rust that are specifically designed for building smart contracts. These languages provide us with the benefit of Rust but at the same time restrict the scope to reduce the size of the executable and also reduce the learning curve in comparison to Rust.
Fe is an alternative to the popular Solidity language for building smart contracts for the Ethereum blockchain and all other chains that use the Ethereum Virtual Machine (EVM). Fe is simple and the syntax is inspired by Python. It is built with Rust and introduces concepts such as constant generics, which let a user write clean code without sacrificing compile-time guarantees (we learned about zero-cost abstractions previously; this is the same concept).
Fe uses the same intermediate language (Yul) as Solidity, which means it’s not just a great choice for Ethereum mainnet but also many Layer 2 solutions.
Move is a new programming language that was created by the Diem Association, backed by Meta, and built with Rust. It’s built for applications such as blockchains, where safety and correctness are paramount. It is an executable bytecode language that’s designed to provide safe and verifiable transaction-oriented computation.
ink! is a programming language developed by Parity Technologies, the parent company of Polkadot and Substrate, for writing smart contracts on blockchain platforms built using the Substrate framework. This language is specifically tailored to enhance the development of smart contracts, leveraging Substrate’s capabilities to offer a robust environment for blockchain applications. ink! is not to be confused with the INK language, which is written in Go. ink! is completely written in Rust and all the contracts written with ink! are compiled into WebAssembly.
… With time, Rust will only be more important and it’ll be critical to learn Rust to build on blockchains.
Interesting blockchain projects built with Rust
We already know about various blockchains that are built with Rust (Solana, Polkadot, NEAR, Aptos, and Sui), but apart from these blockchains, there are many interesting projects in the blockchain space that use Rust. Here are a few:
Comit is a project that enables cross-blockchain interoperability between multiple popular chains such as Ethereum, Monero, and Bitcoin. It doesn’t introduce a blockchain of its own to provide this functionality, so it is in the blockchain space, without being a blockchain itself.
Bonfida is a token vesting, open source program that enables you to declare timelines for your tokens to get vested/distributed among your founding team, developers, and early users.
Astar is a multi-chain smart contract project built with Rust. It empowers developers to write smart contracts for a single chain, at which point the smart contract can be used across multiple blockchains and virtual machines. While Astar and Comit are both trying to solve the interoperability problem, they’re both doing it differently and using a different approach.
The Graph is another highly innovative project. It is a protocol for building decentralized applications on Ethereum and IPFS but using GraphQL. It’s open source and built primarily with Rust.
The list of new blockchain projects is increasing every day and more developers are choosing to use Rust to build innovative projects in the blockchain space, especially projects that enable the development of blockchains or smart contracts.
Advantages of Rust-based languages compared to Solidity
In the past few sections, we learned about Fe, Move, and ink! – all languages that are used for smart contract development, but all of them are built using Rust. The other very popular programming language for creating smart contracts is Solidity and a common question that comes up is how Solidity compares to Rust-based languages.
The main benefits Solidity provides are that it’s ultra-light and is very simple to learn, especially for people coming from a JavaScript background. This is the reason why some developers feel that Solidity is better for smart contract development usage compared to Rust since Rust is quite extensive and heavy, has longer build times, and also has quite a steep learning curve.
But the main difference to understand here is that Rust is the preferred language for blockchain or protocol development and not just smart contract development, meaning that Rust has a much wider and more complex use case. However, let’s also address the usage of Rust specifically for smart contract development, where Solidity is considered a great language to use.
For smart contract development, instead of using Rust, which is quite extensive, there are options such as Move, ink!, and Fe, which are based on Rust, meaning that they provide most of the benefits of Rust but provide this functionality in a simple and light package that’s also quite easy to learn and understand. This completely bridges the gap between the benefits that Solidity provides over Rust.
There are also quite a few limitations with Solidity that Rust-based languages overcome easily. For one, smart contracts that are built with Solidity usually have way more vulnerabilities than the ones built with Rust.
Since Rust is super-optimized, smart contracts end up consuming fewer gas fees compared to those built with Solidity.
Let’s say we wanted to represent a Bbock in Rust. Here, we can use a feature called struct, which enables us to define a custom data type by creating a collection of data types that Rust already understands.
The following code shows a block from a blockchain that uses a Rust struct:
pub struct Block {
pub id: u64,
pub hash: String,
pub previous_hash: String,
pub timestamp: i64,
pub txn_data: String,
pub nonce: u64,
}
In the preceding code snippet, hash and previous_hash are represented as strings. timestamp is a 64-bit signed integer (i64) and nonce is a 64-bit unsigned integer (u64). txn_data is simply the data of transactions that the block will hold. We have used String to represent this, but in the real world, it’s going to be a data structure such as an array or vector. We will implement that when we build the blockchain later in this book.
Let’s observe how a blockchain can be represented:
pub struct Blockchain {
pub blocks: Vec<Block>,
}
Notice that by using structs, we can also represent an entire blockchain, which is simply a collection of multiple blocks. We have represented a collection of blocks by using a Rust feature called Vec, which enables us to store multiple structs. So, in short, a vector is a collection of structs.
Note
In a blockchain struct, there’s no need for logic to connect the blocks, and this simplistic implementation throws off inexperienced engineers. The fact is that the “connection” logic is inherently present inside the block itself, where we store the hash value of the previous block in the previous_hash field.
Rust for Blockchain Application Development by Akhil Sharma was published in April 2024. You can read the entire first chapter and buy the book here! Packt library subscribers can continue reading the entire book for free here.
🛠️ Useful Tools ⚒️
Quill: an open-source, customizable WYSIWYG rich text editor with a modular architecture that ensures consistent formatting across different platforms and browsers.
Spotify Portal for Backstage: a tool that simplifies the process of setting up developer portals using Backstage, offering features like Setup and Catalog Wizards, Software Templates, and plugins.
htpy: a Python library designed to facilitate the writing of HTML directly in Python code, offering a straightforward and efficient alternative to traditional template languages by leveraging Python's own syntax and structures.
That’s all for today.
We have an entire range of newsletters with focused content for tech pros. Subscribe to the ones you find the most useful here. Complete ProgrammingPro archives can be found here. Complete PythonPro archives are here.
If your company is interested in reaching an audience of developers, software engineers, and tech decision makers, you may want to advertise with us.
If you have any comments or feedback, take the survey, leave a comment below.