ProgrammingPro #61: Apple Elevates Xcode 16 with AI, Swift Set to Replace C++?, Rust 1.79 Features, and .NET MAUI for VS Code Now Ready
Bite-sized actionable content, practical tutorials, and resources for programmers
Welcome to this week’s edition of ProgrammingPro!
In today’s Expert Insight, we bring you an excerpt from the recently published book, Enterprise Architecture with .NET, which briefly discusses how to effectively apply the open/closed principle to both object-oriented programming and information systems.
News Highlights: Apple updates Xcode 16 with AI code completion and performance boosts; Swift touted as C++ successor with enhanced safety and OS support; Rust 1.79 simplifies coding with new inline const expressions; and Microsoft's .NET MAUI for VS Code is production-ready.
My top 5 picks from today’s learning resources:
Using ChatGPT Tool/Function calls with JavaScript and Node.js💬
Zero to Performance Hero - How to Benchmark and Profile Your eBPF Code in Rust🚀
Using Generative AI in Software Project Management to Bridge Domains and Accelerate Productivity🌉
But there’s more, so dive right in.
Stay Awesome!
Divya Anne Selvaraj
Editor-in-Chief
PS: Do share your opinions, your feedback on ProgrammingPro, and earn your one Packt credit for the month. Take the survey!
🗞️News and Analysis🔎
Apple’s Xcode 16 adds AI-powered code completion: The update enhances the IDE with features like improved module dependency builds for better parallelism and debugger performance. Read to learn about all the advancements in Xcode 16.
JavaScript needs more money: Existing funding levels don’t match the enormous reliance on and risks associated with open source components. Read to learn about the revenue-sharing model being implemented by the OpenJS Foundation.
Swift the best choice to succeed C++, Apple says: At WWDC, Swift's upcoming features, including full data race safety and expanded Linux and Windows support, were highlighted as reasons to make it ideal for replacing C++. Read to learn more.
Rust stabilizes inline const expressions: Rust 1.79 allows inline consts to utilize in-scope generics and infer types, and simplifies constraints on associated types. Read to learn about all the latest features in the release.
Htmx 2.0 released, aims to replace complex JavaScript frameworks with easily understood HTML attributes: This update also discontinues support for Internet Explorer and introduces new features like the htmx.swap() method for better content management. Read to learn more.
Microsoft declares .NET MAUI extension for VS Code production-ready – but devs will take some convincing: Despite its potential, developers remain skeptical due to past issues with missing features and stability concerns. Read for more.
Nearly 20% of running Microsoft SQL Servers have passed end of support: IT asset management platform, Lansweeper’s report, reflects a broader IT challenge, where updating critical but outdated software is often avoided until absolutely necessary, despite potential security risks. Read for more insights.
🎓Tutorials and Learning Resources💡
Python
Understanding HTTP Server by implementing in Python: Using Python's socket module, this article provides a practical example of creating a server that listens for connections, receives requests, and sends back content. Read to learn how.
Getting Started with Google Colab - A Beginner's Guide: Google Colab is a platform that allows you to write and execute Python code directly in your web browser. Read to learn how to utilize the platform for managing notebooks.
For more Python resources go to PythonPro
C# and .NET
Building Generative AI apps with .NET 8: Discusses .NET 8’s abilities for creating AI-enhanced applications. Read to discover the latest samples, libraries, and the new documentation hub for everything .NET and AI.
🎓Tutorial | ASP.NET forms validation and htmx: Covers the history of validation in ASP.NET, various validation techniques, and introduces htmx for unobtrusive validation. Read to explore both client-side and server-side techniques.
🎓Tutorial | DataTable in C# — Usage + Examples: Provides a comprehensive guide on using DataTables in C#, covering creation, manipulation, and data export. Read to pick up practical skills for managing in-memory data.
C and C++
Binding a C++ Library to 10 Programming Languages: Covers Python, JavaScript, Rust, Objective-C/Swift, GoLang, Java, and C 99, detailing specific files, implementation notes, and packaging difficulties. Read for insights into the strategic decisions needed while working with multi-language projects.
💼Case Study | Goodbye to the C++ Implementation of Zig: Discusses replacing the old C++ compiler for Zig with a more efficient WebAssembly-based system, significantly reducing the codebase by 80,000 lines. Read to learn more.
🎓Tutorial | How to Use Secure Sockets in C on Linux: Focuses on encrypting transmitted data using libssl from OpenSSL. Read to learn how to enhance security in client-server communications and prevent potential data interception.
Java
🎓Tutorial | How to use typesafe enums in Java: Typesafe enums in Java offer enhanced safety and functionality over traditional enumerated types. Read to learn how to leverage the the Enum class’ support for added behaviors and data.
🎓Tutorial | Polymorphism and inheritance in Java: Explains how Polymorphism allows objects to perform different actions based on their specific types. Read to learn how to utilize Java's object-oriented capabilities to their fullest potential.
What's wrong with Java's sun.misc.Unsafe?: Used since 2002 for low-level operations, the sun.misc.Unsafe class is being phased out due to its risks. Read to discover standardized alternatives that preserve Java's integrity.
JavaScript and TypeScript
🎓Tutorial | Using ChatGPT Tool/Function calls with JavaScript and Node.js: Shows how to structure prompts and tool call schemas, manage API interactions, and more. Read to learn how to enhance functionality and interaction in your apps.
🎓Tutorial | Extracting all URLs of your sitemap.xml with JavaScript: Outlines steps from fetching the XML file to parsing and querying it for URLs. Read to learn how to automate the extraction of URLs from a sitemap.xml file using JavaScript.
🎓Tutorial | Supporting Dual Package for CJS and ESM in TypeScript Library: Discusses file extensions like .cjs, .mjs, and .js, their uses, and how to configure package.json for dual compatibility. Read to learn how to ensure broad compatibility.
Go
🎓Tutorial | Streaming HTML – Asynchronous DOM Updates without JavaScript: Introduces techniques for updating HTML content asynchronously without JavaScript, utilizing the Declarative Shadow DOM and HTTP streaming responses. Read for an example using Go.
Go is a platform: Discusses the strengths of the Go programming language including its development speed, security features, and performance. Read to gain an understanding of Go's comprehensive ecosystem.
Rust
5 popular Rust web frameworks—which one is right for you?: Reviews Actix Web, Rocket, Warp, Axum, and Poem, highlighting their unique features and suitability for different contexts. Read to be able to select the right one for yourself.
🎓Tutorial | Zero to Performance Hero - How to Benchmark and Profile Your eBPF Code in Rust: Emphasizes the strategic use of Rust for eBPF code in kernel and user spaces due to its speed and safety. Read to learn how to optimize and maintain system performance efficiently.
PHP
🎓Tutorial | Practical Logging for PHP Applications with OpenTelemetry: Covers setting up, configuring, and utilizing the OpenTelemetry SDK and Collector to gather and manage log data, and more. Read to learn how to monitor and troubleshoot distributed systems through integrated logging and tracing.
SQL
🎓Tutorial | Snake draft sorting in SQL Server, part 4: Focuses on optimizing job management when dealing with asynchronous, parallel tasks. Read to learn how to manage job dependencies in SQL Server, ensuring efficient execution sequences.
Ruby
💼Case Study | The design decisions and evolution of a method definition: Covers argument specifications in method definitions, highlighting the evolution from basic syntax to complex features. Read to gain an understanding of Ruby's methodological evolution.
Swift
🎓Tutorial | The Declarative Domain Paradigm in Swift: Demonstrates how to utilize Domain Specific Languages (DSLs) to code declaratively. Read to learn how to enhance code clarity and maintainability through TDD and BDD.
Kotlin
🎓Tutorial | Kotlin Builder Inference Explained: Presents a structured approach for handling UI events in Jetpack Compose, advocating for a cleaner and more maintainable method. Read to learn how to implement a robust event-handling architecture in Jetpack Compose.
🌟Best Practices and Advice🚀
Using a Body With an HTTP Get Method Is Still a Bad Idea: While the HTTP/1.1 specification does not explicitly forbid this practice, it notes that a GET request body has no defined semantics. Read to learn about recommended alternatives.
How cognitive fatigue impacts developer productivity: Fatigue is a crucial factor in productivity, often exacerbated by unnecessary context switching and inefficient feedback cycles. Read to understand the importance of structured work processes that account for mental load and the biological limits of cognitive functions.
Using Generative AI in Software Project Management to Bridge Domains and Accelerate Productivity: Emphasizes the benefits of using generative AI to bridge knowledge gaps between different domains and enhancing productivity. Read to learn about practical ways to integrate AI into software project management.
Take the Survey, Get a Packt Credit!
🧠 Expert Insight 📚
Here’s an excerpt from “Chapter 6: SOLID Principles, from Code to Systems” in the book, Enterprise Architecture with .NET by Jean-Philippe Gouigoux.
Open/closed principle
The open/closed principle starts with a paradox in its very expression, which makes it strange at first sight: how can a module be open and closed at the same time? The comprehension of this principle is very important to create systems that will evolve because it states what should remain closed and what should be open to
change for this evolution to work as smoothly as possible.
When applied to object-oriented programming, the open/closed principle states that a class should be open to extension, but closed to modification. Encapsulation and private members are used to prevent any instance in the program from modifying directly the state of another instance; otherwise, it would be very difficult to follow what happens when executing the program. Even debugging would be complicated if there is no way to track what class modifies the state of another one. This is why a class keeps its members private and only opens some public functions to allow only some changes in its state, in a way that is controlled by its own code, following its own rules. This is the closed part of the principle.
But a class, in general, is not marked as final to let another class inherit from it and specialize the functions that are marked as virtual. The inheriting class can also add some data members, in addition to accessing the one from the inherited class that is marked as protected (or, of course, public). Again, the class controls what can be overridden and what cannot, but at least it is open to an extension of its behavior by another class. This is the open part of the principle.
Applying this principle to information systems does not imply a big change in reflection, as the services replace the classes, and the techniques to extend or protect only vary from the practical point of view. If we continue with examples where services are REST APIs, we can draw a parallel between the members of a class and the data that is persisted by the implementation of an API contract: nothing but the service can modify this data, as only the implementation has access to the persistence used (a database or anything else). Of course, some API methods may allow some specific modifications to be carried from the API clients, but the API implementation controls this and applies business rules to ensure the modification is carried as it wants (or maybe rejected, by the way). This is the closed part of the principle applied to a module of information systems, and it is quite obvious in its resemblance to the application in a class.
The implementation of the open part of the principle on an API is trickier, as the behavior of an API can be extended in many ways:
One of the ways to do so is to create an API that will extend the initial API contract. Mechanisms exist in the OpenAPI grammar to implement polymorphism and it is also possible to aggregate types in such a way that the new one contains the initial type and all its content.
Another way is to create an API that replaces the exposition of the old implementation, but still relies on it for all the standard data, and then provides its own data in addition. If done carefully, the extended API may even be fully compatible with the initial API contract, since it only adds new data (and if it just passes the initial data without changing any behavior, it even complies with the Liskov substitution principle, which we will see shortly).
A third option is to use an API gateway to expose the updated contract and implement the mixing of data coming from the original API and the additional data coming from another service dedicated to its storing and manipulation. This approach is a bit closer to the principle of inheritance.
These three approaches are schematized as follows:
Figure 6.1 – Open/closed approaches to APIs
Enterprise Architecture with .NET by Jean-Philippe Gouigoux was published in May 2024. You can buy the book here! Packt library subscribers can continue reading the entire book for free here.
🛠️ Useful Tools ⚒️
Unity Catalog: An open-source governance catalog for managing structured and unstructured data, machine learning models, and other assets across major cloud platforms, designed to simplify data governance and enhance interoperability.
pypreql: An open-source extension of SQL that simplifies SQL by replacing traditional tables and joins with a semantic binding layer, enhancing reusability and maintainability while preserving SQL's power and broad compatibility.
Cloud Troubleshooting Labs: An interactive platform that provides on-demand environments for engineers to practice troubleshooting real-world scenarios across AWS, GCP, Azure, and Kubernetes using Pulumi.
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, or leave a comment below.