Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds

ProgrammingPro

35 Articles
Divya Anne Selvaraj
29 Aug 2024
Save for later

ProgrammingPro #71: Nullable Reference Types in C#, Prompty for VS Code, Python Packaging Tools

Divya Anne Selvaraj
29 Aug 2024
Bite-sized actionable content, practical tutorials, and resources for programmers#71:Nullable Reference Types in C#, Prompty for VS Code, Python Packaging Tools, and Rust Error HandlingHi ,Welcome to this week’s edition of ProgrammingPro!In today’sExpert Insight, we bring you an excerpt from the recently published book, Functional Programming with C#, which discusses the implementation of Nullable Reference Types (NRTs) in C#, as a tool for developers to handle null references more safely and transparentlyNews Highlights: OSI releases latest draft of Open Source AI Definition; Microsoft releases Prompty, a new VS Code extension for integrating LLMs into .NET development; JetBrains Workspaces offers monorepo benefits exclusively in IntelliJ IDEA; and Survey shows game engines like Godot gaining traction in non-game projects.My top 5 picks from today’s learning resources:What's the deal with setuptools, setup.py, pyproject.toml, and wheels?🛠️Supercharge your testing experience with MSTest.Analyzers⚡The definitive guide to error handling in Rust🛡️Simplicity, Speed, and Re-Use. Shipping Threads in 5 Months🚀Best practices for event logging and threat detection🛑But there’s more, so dive right in.Stay Awesome!Divya Anne SelvarajEditor-in-ChiefPS:We have finished covering all requests made by you so far through the August survey. We did receive some specific and comprehensive requests around Java and are therefore planning to take out a Collector's Edition on Java sometime next month. If you have any more Java specific requests you would like covered in the special issue, reply to this email and let me know.Sign Up|Advertise🗞️News and Analysis🔎OSI releases latest draft of Open Source AI Definition: The draft clarifies that all components of an AI system must meet open source standards, excludes training data from classification, and updates key terminologies.Kotlin update shines on garbage collector:The update also includes bug fixes, support for newer Gradle versions, and improvements in Kotlin Multiplatform development.The slow evolution of enterprise tech: argues that despite the rapid hype cycles around technologies like cloud computing and gen AI, enterprise tech evolves slowly, with core programming languages and databases remaining largely unchanged over the past decade.JDK 24 preps for restrictions on JNI use: This feature will introduce warnings to prepare for future restrictions, aligning JNI usage with the Foreign Function and Memory (FFM) API.Microsoft Releases Prompty - New VS Code Extension for Integrating LLMs into .NET DevelopmentLike: This free tool simplifies adding AI-driven capabilities to applications, such as generating content or creating chatbots, directly within the development environment.JetBrains Workspaces aims for benefits of monorepos without the downside – but only in IntelliJ IDEA: The plugin addresses issues like monorepo fragility and performance problems by keeping projects independent.Survey finds game engines used equally by non-game projects, rise of interest in open source Godot: The survey also noted the increasing use of JetBrains Rider and VS Code, and challenges in collaboration due to the handling of large files in game development.🎓Tutorials and Learning Resources💡PythonWhat's the deal with setuptools, setup.py, pyproject.toml, and wheels?:Provides a detailed explanation of Python packaging tools and practices, offering insights and recommendations for how to approach packaging in modern projects.Debugging and Profiling in Python: Discusses debugging and profiling tools for Python, highlighting key libraries like pdb, faulthandler, cProfile, and tracemalloc.For more Python resources, go to PythonProC# and .NET🎓Tutorial | Introducing the Pinecone .NET SDK: Provides a step-by-step guide on setting up the SDK, creating an index, adding records, and querying data.Supercharge your testing experience with MSTest.Analyzers: Showcases specific examples of how MSTest.Analyzers help catch common mistakes, and provides recommendations for best practices in test writing.The C# type system: Explains built-in and custom types, the common type system (CTS), and how types influence memory allocation, type safety, and program behavior.C and C++C++ unwind exception metadata - A hidden reverse engineering bonanza: Discusses how C++ unwind exception metadata can aid reverse engineering by revealing hidden details about data structures in C++ programs, particularly those using MSVC/x64 targets.An Overview of C++26 - Core Language: Highlights key features such as reflection, which enhances compile-time programming, and contracts, which allow precise and checkable interface specifications.How to run valgrind on a CGI program in C: Explains how to use Valgrind to debug a memory corruption issue in a CGI program that only manifests during a POST request.Java🎓Tutorial | Better than reflection: Using method handles and variable handles in Java: Discusses replacing Java reflection with MethodHandle and VarHandle for accessing methods and fields programmatically.🎓Tutorial | Method overloading in the JVM: Focuses on techniques like widening, boxing, and varargs. Read to learn about the advantages of method overloading for cleaner code and common pitfalls to avoid.WebAssembly, the Safer Alternative to Integrating Native Code in Java: Highlights the use of Chicory, a pure JVM Wasm runtime, to integrate Wasm-compiled code, such as SQLite, into Java applications, providing strong security guarantees.JavaScript and TypeScriptCompilation of JavaScript to Wasm, Part 2 - Ahead-of-Time vs. JIT: Discusses the challenges of compiling JavaScript due to its dynamic typing and the limitations of traditional JIT (just-in-time) compilation in Wasm-first platforms.Frontend Strategies - Frameworks or Pure JavaScript?: Clarifies when to use frameworks versus pure JavaScript, along with the advantages of modular code, reusable components, and integration with modern development tools.Announcing TypeScript 5.6 RC: Details new features like disallowed nullish and truthy checks, iterator helper methods, and improved built-in iterator checks.GoC# (.NET) vs. Go (Golang): Performance Benchmark in Kubernetes: Focuses on metrics like CPU and memory usage, request handling capacity, and end-user latency. Read to learn how Golang generally performed better.The 4-chan Go programmer: Humorously explores the complexities of using channels in Go by demonstrating a convoluted example of sending channels over channels, inspired by the concept of "4-star programmers" from C.Rust💼Case Study | MiniJinja - Learnings from Building a Template Engine in Rust: Discusses the author's experience and technical challenges in creating MiniJinja, a Jinja2-compatible template engine in Rust.🎓Tutorial | The definitive guide to error handling in Rust: Covers the use of Result, dynamic errors like Box<dyn Error>, and structured errors. Read to also learn about downcasting errors, using the anyhowcrate.SwiftSwift Macros at scale: Introduces Tuist, a tool for managing Xcode projects, which supports caching for Swift Macros, improving build times for developers.Designing Apps: 5 Methods to improve your workflow: Highlights techniques such as using the Golden Ratio, proper spacing for visual hierarchy, designing directly with SwiftUI, gradually enhancing app visuals from basic to vibrant, and more.PHP🎓Tutorial | How to build a game engine in a CMS, in PHP:While acknowledging that it's not an ideal approach, the author details creating a rendering system, implementing game logic, handling collisions, adding animations, and more.SQLEfficient Data Cleanup in Partitioned PostgreSQL Tables using Common Table Expressions: Demonstrates using CTEs to identify deletable data, optimizing the deletion process through batch processing, and maintaining database consistency.Scala and Spark"Domain Modeling" in the Scala 3 - Book: Covers the tools available in Scala, such as classes, traits, and enums, to build models. Read to learn how to effectively represent attributes and behaviors within each paradigm.Spark — debugging a slow Application: Outlines common reasons why Apache Spark applications may run slowly, highlighting issues such as input/source inefficiencies, uneven or excessive partitioning, and slow transformations.[Solution] Spark — debugging a slow Application: Covers techniques such as partitioning, bucketing, and file compaction, and advises on managing partition sizes, leveraging adaptive query execution, avoiding slow transformations, and more.KotlinKotlin's Type System is (Also) Unsound: Presents a proof that Kotlin's type system can allow operations that should not be permissible at runtime. Read to learn about the specific language features involved, and potential solutions.🌟Best Practices and Advice🚀Podcast: Misconceptions around Agile in an AI world: Featuring insights from David Ross, Agile evangelist for Miro, highlights how Agile practices have evolved, moving away from rigid frameworks towards more adaptive and pragmatic approaches.Simplicity, Speed, and Re-Use. Shipping Threads in 5 Months: Describes how despite technical debt and challenges, such as scaling issues on launch day, the team prioritized simplicity and leveraged a battle-tested codebase to meet tight deadlines.Best practices for event logging and threat detection: Developed by the Australian Cyber Security Centre in collaboration with international cybersecurity agencies, this document emphasizes creating an enterprise-approved logging policy, ensuring log quality, centralizing log collection, and implementing secure storage.The Terralith: Monolithic Architecture of Terraform & Infrastructure as Code: Argues for breaking down monolithic structures into smaller, more manageable modules to enhance scalability, maintainability, and reduce risk.🧠Expert Insight📚Here’s an excerpt from “Chapter 4: Honest Functions, Null, and Option” in the book, Functional Programming with C# by Alex Yagur, published in July 2024.Embracing honesty with nullable reference typesHandling null in C# has alwaysbeen quite a challenge. Many software developers (me included) advocate doing a check for NullReferenceExceptions as a mandatory task in a code review checklist. In most cases, it is really easy to check for possible null values just by looking at the pull request, even without an IDE. Recently, we received help when Microsoft introduced nullable reference types. So, now, the compiler will join us in the search of possible disasters causedby null.What are nullable reference types?In the simplest terms,Nullable Reference Types(orNRTsfor short) are a feature in C# that allows developers to clearly indicate whether a reference type can be null or not. With this, C# gives us a tool to make our intentions clear right from the start. Think of it as a signpost, guiding other developers (and even our future selves) about what to expect fromour code.Without NRTs, every reference type in C# could potentially benull. This would create a guessing game. Is this variable going to have a value or is it going to benull? Now, with NRTs, we don’t have to guess anymore. The code itself tellsthe story.Let’s look at a basic example to graspthe concept:string notNullable = "Hello, World!";string? nullable = null;In the preceding snippet, thenotNullablevariable is a regular string that can’t be assignednull(if you try, the compiler will warn you). On the other hand, since C# 8.0, nullable is explicitly marked with?, indicating that it canbenull.In some cases, you might want to assignnullto a variable that is not marked as nullable. In this case, to suppress warnings, you can use the! sign to let the compiler know that you are aware of what you are doing and everything is going according to plan:string notNullable = "Hello, World!";notNullable = null!;One of the biggest advantages of NRTs is that the C# compiler will warn you if you’re potentially doing something risky with null values. It’s like having a friendly guide always looking over your shoulder, ensuring you don’t fall into the common traps ofnull misuse.For instance, if you try to access properties or methods on a nullable reference without checking fornull, the compiler will give you a heads-up.Transitioning to NRTsFor those with existing C# projects, you might be wondering:Will my project be littered with warnings if I enable NRTs?The answer is no. By default, NRTs are turned off. You can opt into this feature, file by file, allowing for asmooth transition.NRTs are a good answer to the long-standing challenge posed by null references. By making the potential presence of null explicit in our code, we take a giant leap toward clarity, safety, and functional honesty. In the end, embracing NRTs not only makes ourcode more resilient but also ensures that our intentions, as developers,are transparent.Enabling nullable reference typesTo enable NRTs, we need to tell the C# compiler that we’re ready for its guidance. This is done using a simple directive:#nullable enable.Place this at the start of your.csfile:#nullable enableFrom this point onward in the file, the compiler creates a specific nullable context and assumes that all reference types are non-nullable by default. If you want a type to be nullable, you’ll have to mark it explicitlywith?.With NRTs enabled, the C# compiler becomes your safety net, pointing out potential issues with nulls in your code. Whenever you try to assign null to a reference type without the?marker or when you attempt to access a potentially null variable without checking it, the compiler willwarn you.Here’san example:string name = null; // This will trigger a warningstring? maybeName = null; // This is okayDisabling nullable reference typesWhile transitioning a project to use NRTs, there may be sections of your code where you’d prefer to delay the transition. You can turn off NRTs for those specific sections using the #nullable disabledirective:#nullable disableThis tells the compiler to revert to the old behavior, treating all reference types aspotentially nullable.You might wonder why C# chose to use directives for this feature. The reason is flexibility. By using directives, developers can gradually introduce NRTs into their projects, one file or even one section of code at a time. This phased approach makes it easier to adaptexisting projects.Warnings and annotations optionsSpeaking of a phased approach, there are two more options to set our nullable contexts:warningsandannotations. You can use them by writingthe following:#nullable enable warningsOr, you canwrite this:#nullable enable annotationsThe main purpose of these options is to ease the migration of your existing code from a fully disabled null context to a fully enabled one. In short, we want to start with thewarningsoption in order to get dereference warnings. When all warnings are fixed, we can switch toannotations. This option will not give us any warnings, but it will start to treat our variables as non-nullable unless declared with the?mark.To get more information about these options and nullable context in generated files, and to find out more about three nullabilities – oblivious, nullable, and non-nullable, I recommend you read the article "Nullable reference types". You might also want to read the article “Update a codebase with nullable reference types to improve null diagnostic warnings”.Functional Programming with C# was published in July 2024. Packt library subscribers can continue readingthe entire book for free or you can buy the bookhere!Get the eBook for $38.99$26.99🛠️Useful Tools⚒️teable: a no-code database platform that combines the ease of a spreadsheet interface with the performance of a database, enabling users to create and manage applications without coding.RealtimeSanitizer (a.k.a. RTSan): a real-time safety testing tool for C and C++ projects that detects and raises errors when non-deterministic functions are called within real-time contexts.Rspack 1.0: a Rust-based JavaScript bundler, fully compatible with the webpack API, offering much faster performance than webpack while supporting modern web standards and improving build efficiency.awesome-decentralized-autonomous-organizations: a curated list of resources and projects for decentralized autonomous organizations (DAOs) to help users start and participate in their own DAOs.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 usefulhere. Complete ProgrammingPro archives can be foundhere. Complete PythonPro archives arehere.If your company is interested in reaching an audience of developers, software engineers, and tech decision makers, you may want toadvertise with us.If you have any comments or feedback, just respond to this email.*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{color:inherit!important;text-decoration:inherit!important}#MessageViewBody a{color:inherit;text-decoration:none}p{line-height:inherit}.desktop_hide,.desktop_hide table{mso-hide:all;display:none;max-height:0;overflow:hidden}.image_block img+div{display:none}sub,sup{line-height:0;font-size:75%}#converted-body .list_block ol,#converted-body .list_block ul,.body [class~=x_list_block] ol,.body [class~=x_list_block] ul,u+.body .list_block ol,u+.body .list_block ul{padding-left:20px} @media (max-width: 100%;display:block}.mobile_hide{min-height:0;max-height:0;max-width: 100%;overflow:hidden;font-size:0}.desktop_hide,.desktop_hide table{display:table!important;max-height:none!important}.reverse{display:table;width: 100%;
Read more
  • 0
  • 0
  • 14016

Divya Anne Selvaraj
28 Nov 2024
Save for later

ProgrammingPro #84: TypeScript 5.7's Never-Initialized Checks, Angular v19's Server Performance, and Cython 3.1's No-GIL Builds

Divya Anne Selvaraj
28 Nov 2024
Bite-sized actionable content, practical tutorials, and resources for programmers#84TypeScript 5.7's Never-Initialized Checks, Angular v19's Server Performance, and Cython 3.1's 'No-GIL' BuildsHi ,Welcome to this week’s edition of ProgrammingPro andHappy Thanksgiving if you celebrate! We're grateful for your continued support and passion for learning.In today’sExpert Insight, we bring you an excerpt from the recently published book, Mastering Angular Test-Driven Development, which explains the concept of code smells in Angular applications—indicators of potential issues in code that hinder maintainability and scalability.News Highlights: TypeScript 5.7 adds never-initialized checks and ECMAScript 2024 support; Vite 6.0 debuts with modern Sass API and asset updates; Cython 3.1 supports Python's "no-GIL" builds for better parallelism; and USPTO petitioned to cancel Oracle's JavaScript trademark over alleged abandonment.My top 5 picks from today’s learning resources:Top 65+ Data Science Projects with Source Code📊Replaying Kafka messages: Practical guide with sample code🔄Concepts in C++20💡Architectural Intelligence – The Next AI🏛️The top 25 weaknesses in software in 2024🚨But there’s more, so dive right in.Stay Awesome!Divya Anne SelvarajEditor-in-ChiefP.S.:Thank you all who participated in this month's survey. With this issue, we have fulfilled all content requests made this month.Sign Up|Advertise🗞️News and Analysis🔎Announcing TypeScript 5.7: The version introduces new features like checks for never-initialized variables, path rewriting for relative imports, support for ECMAScript 2024, and validated JSON imports in Node.js.Release Vite 6.0: Updates include an Experimental Environment API for improved development-production parity, enhanced JSON handling, expanded HTML asset referencing, and modern Sass API as default.Uno Platform Launches Hot Design, a Cross-Platform Visual Designer for .NET Apps: The suite also includesHot Reloadfor code updates andDesign-to-Code, a Figma plugin generating XAML and C# from prototypes.Java News Roundup: OpenJDK and Jakarta EE 11 Updates, Payara Platform, Vert.x, Log4j, JobRunr: Updates also includeMicronaut 4.7.1,JobRunr 7.3.2, and Gradle 8.11.1 maintenance releases.Python to C: What’s new in Cython 3.1: The version introduces significant updates, including experimental support for Python's free-threaded "no-GIL" builds in Python 3.13, enhancing parallelism for CPU-bound threads.USPTO petitioned to cancel Oracle’s JavaScript trademark: Deno Land has petitioned the USPTO to cancel Oracle's ownership of the JavaScript trademark, accusing Oracle of abandonment and fraud, citing no active role since 2009.Kotlin to lose scripting features: JetBrains plans to phase out certain scripting features in Kotlin, including REPL functionality, Java Specification Request 223 support, the KotlinScriptMojo Maven plugin, and kotlin-scripting-ide-services.🎓Tutorials and Learning Resources💡Python💡Top 65+ Data Science Projects with Source Code: Covers diverse areas like machine learning, NLP, deep learning, web scraping, and data visualization with real-world datasets and practical challenges.🎓Tutorial | Speed Up Your Python Program With Concurrency: Explains threading, asynchronous tasks, and multiprocessing, demonstrating how to optimize I/O-bound and CPU-bound tasks for improved performance.For more Python resources, go to PythonProNoSQL and Spark🎓Tutorial | Evolving a NoSQL Database Schema: Covers creating a single-table design, optimizing queries with keys and indexes, handling sharding for scalability, and enabling efficient cross-partition querying.💡Spark structured streaming — Checkpointing: Explains how Checkpointing aids in fault tolerance by maintaining stream state and offsets along with implementation details and surprising behaviors when configuring parameters.C# and .NET🎓Tutorial | Master Cache in C#: Covers IMemoryCache,IDistributedCache, andHybridCache and discusses when to use caching, its benefits, challenges, and patterns, including cache invalidation and metrics.🎓Tutorial | My process for creating API clients: Outlines a structured process for creating API clients in C# using Flurl, balancing automation and control between tools like HttpClient, Refit, and Kiota.💡C# puzzles: Presents two C# puzzles focusing on unconventional behavior: making modifications to StringBuilderobjects through aSecretSaucefunction without unsafe operations or external interference.C and C++🎓Tutorial | Concepts in C++20:Explains how C++20 concepts simplify template constraints, replacing SFINAE with readable, expressive syntax and highlights four ways to apply concepts for enhanced error clarity.🎥💡How Designing Carbon C++ Interop Taught me About C++ Variadics & Bound Members - Chandler Carruth: Introduces Carbon's type-checked variadic functions, enabling safer and more reliable templates.🎓Tutorial | Bubble Sort Implementation Using a Single for Loop in C: Presents an alternative implementation of Bubble Sort in C using a single forloop instead of nested loops.Java🎓Tutorial | Replaying Kafka messages: Practical guide with sample code: Covers three approaches: offset-based replay, mirror topics, and custom replay services and explains use cases with sample Java code.💡How Fast Does Java Compile?: Examines the speed of Java compilation, revealing that the Java compiler (javac)can process over100,000 lines of code per second on a single core when warmed up.Reactive Real-Time Notifications with SSE, Spring Boot, and Redis Pub/Sub: Highlights the advantages of a reactive approach, such as improved scalability and resource utilization, along with practical integration guidance.JavaScript and TypeScriptDevelop AI apps with JavaScript: Includes quickstart guides, libraries, templates, and training for tasks like text generation, image analysis, and NLP, focusing on Azure OpenAI Service and other Azure AI services.🎓Tutorial | JavaScript Sets and Maps: Beyond Arrays and Objects: Discusses Sets and Maps' advantages over arrays and objects, when to use them, and their ability to handle unique values and maintain key types.🎓Tutorial | Almost Perfect tsconfig.json Options for Your Angular Projects: Provides a step-by-step guide to optimizing the tsconfig.json file for Angular 18 projects, covering configurations for TypeScript compiler options.Go🎓Tutorial | Go Production Performance Gotcha - GOMAXPROCS: Discusses a performance issue in a Go-based workload caused by not explicitly setting the GOMAXPROCS parameter, leading to high CPU usage.💼Case Study | Are Golang Generics Simple or Incomplete? A Design Study: Explores the simplicity versus incompleteness of Go's generics by presenting a case study involving Map,MutableMap, andIndextypes in a version-controlled SQL database.Rust🎓Tutorial | Rust for AWS Lambda, the Docker Way: Walks you through using Cargo Lambda for simplified Rust Lambda development and presents two Dockerfile configurations including one supporting cross-compilation.💼Case Study | Making Rust a first-class citizen for Xen: Discusses Vates' efforts to integrate Rust into the Xen Project by developing pure-Rust alternatives to C-based libraries, creating safer, more efficient tools.Swift🎓Tutorial | Calling Hidden Swift Functions: Delves into techniques for calling hidden Swift functions, specifically those within Apple's frameworks, which are not directly accessible due to access level restrictions.🎓Tutorial | Mock Your Remote Config🧑‍💻: Provides a step-by-step guide on using protocols, dependency injection, and mock implementations.PHP🎓Tutorial | Step-by-Step Guide to Installing PHP 8.4 on Ubuntu 24.04 with Nginx & MySQL: Covers system updates, adding the Ondřej PHP repository, installing PHP with necessary extensions and configuring PHP-FPM with Nginx.SQL📜Towards Optimizing SQL Generation via LLM Routing: This paper introduces the first LLM routing approach for Text-to-SQL, dynamically selecting cost-effective LLMs for accurate SQL generation based on query complexity.Ruby💡10 Costly Ruby on Rails Upgrade Mistakes to Avoid in 2025: Identifies common pitfalls and provides actionable strategies to ensure a secure, performant, and seamless transition, reducing costs and enhancing stability.Powershell💡Attacking PowerShell CLIXML Deserialization: Explores vulnerabilities which can lead to remote code execution through untrusted data and recommends including patching systems, limiting third-party PowerShell modules, and more.Kotlin🎓Tutorial | Kotlin for Java developers: Concurrency with coroutines: Covers Kotlin's concurrency model using coroutines, demonstrating key features like scopes, dispatchers, contexts, channels, and flows.🌟Best Practices and Advice🚀Architectural Intelligence – The Next AI: Advocates for using traditional trade-off analysis to evaluate the appropriateness of AI for specific scenarios, distinguishing between suitable, questionable, and inappropriate use cases.What if AI eventually makes programmers smarter, not dumber: Argues that AI, particularly through LLMs, is transforming programming by reducing the time spent on repetitive coding tasks and enabling you to focus on problem-solving.How McDonald Sells Millions of Burgers Per Day With Event-Driven Architecture:Discusses how the architecture facilitates asynchronous operations, transactional processing, and real-time event handling.State of Software Architecture Report — 2024: Discovered widespread use of diagramming tools (96%) and collaborative wikis (79%) for documenting architecture, with microservices (67%) and event-driven patterns (62%) being the most common.The top 25 weaknesses in software in 2024: This year’s list, based on 31,779 CVEs, emphasizes classic weaknesses alongside notable changes, including upward movements for Cross-Site Request Forgery (CSRF) and Code Injection.🧠Expert Insight📚Here’s an excerpt from “Chapter 11: Refactoring and Improving Angular Code through TDD" in the book, Mastering Angular Test-Driven Development by Ezéchiel Amen AGBLA, published in October 2024.Identifying code smells and areas for improvement in Angular applicationsWhile your Angular application might seem functional on the surface, there could be underlying issues waiting to erupt. These issues, known as code smells, don’t necessarily causeimmediate problems but indicate areas in your codebase that could benefit from refactoring. Just like a cluttered room can be stressful and unproductive, smelly code can make it difficult to maintain, understand, and extend your application. This section delves into the world of code smells in Angular applications. We’ll explore what they are, why they matter, and how to identify them proactively. By understanding these code smells, you’ll be equipped to prioritize refactoring efforts using TDD, ultimately leading to a cleaner, more maintainable, and robust code base.What are code smells?Imagine walking into a kitchen where dirty dishes are piled up high in the sink, spices are scattered across the counter, and expired food lingers in the fridge. This unpleasant scene might not prevent you from cooking a basic meal, but it certainly wouldn’t be an enjoyable or efficient experience. Code smells are analogous to this messy kitchen in the softwaredevelopment world.Coined by Martin Fowler in his book,Refactoring: Improving the Design of Existing Code, code smells are indicators of potential problems within your code base. They don’t necessarily represent functional bugs that cause the application to crash. Instead, they signify areas that could be improved for better readability, maintainability, and long-term health ofyour code.Code smells are not bugs, but they can attract bugs in the future. They act like red flags, warning you of potential trouble spots that could become problematic as yourapplication evolves.Why should we care about code smells in Angular?Ignoring a messy kitchen might lead to unpleasant odors, fruit flies, and frustration when you need to cook a meal. Similarly, neglecting code smells in your Angular application can have severalnegative consequences:Decreased maintainability: Smelly code becomes difficult to understand and modify over time. As your application grows and features are added, the complexity of tangled code can make changes cumbersome anderror prone.Increased debugging time: When bugs arise in smelly code, it can be challenging to pinpoint the root cause. The lack of clear structure and organization makes it like searching for a needle in a haystack, wasting valuabledeveloper time.Reduced team productivity: Working with smelly code can be frustrating and demotivating for developers. The cognitive overhead of deciphering tangled logic slows down development andhinders collaboration.Technical debt: Unattended code smells accumulate over time, creating a technical debt that needs to be addressed eventually. This debt can become a significant burden, requiring dedicated resources and potentially delaying newfeature development.By proactively identifying and refactoring code smells, you can dothe following:Improve code readability: Clean and well-structured code is easier to understand for both you and other developers working on the project. This reduces onboarding time for new team members and fostersbetter collaboration.Enhance maintainability: Refactored code is easier to modify and adapt as your application’s requirements evolve. This allows you to introduce new features and bug fixesmore efficiently.Reduce debugging time: Cleaner code with a clear separation of concerns makes it easier to isolate and fix problems whenbugs arise.Boost team productivity: Working with well-structured code improves developer experience and satisfaction. This leads to higher productivity and a more positivedevelopment environment.Minimize technical debt: By addressing code smells early on, you prevent them from accumulating and becoming a significant burden inthe future.In essence, prioritizing code smell refactoring is an investment in the long-term health and maintainability of yourAngular application.Identifying the most common code smells in Angular applicationsNow that we understand the importance of identifying code smells, let’s take a look at some of the most common offenses you might encounter in yourAngular application:The long and winding method: Imagine a method in your service that stretches across dozens of lines, handling various tasks. This is a prime example of a long method, a code smell suggesting a lack of modularity. These methods can be difficult to understand, test, and modify. Refactoring involves breaking down such behemoths into smaller, well-defined functions, each focusing on a specific task. This enhances code readabilityand maintainability.The god component: Have you encountered a component overloaded with responsibilities? This is a “god component,” handling everything from data fetching to complex UI logic. Such components become maintenance nightmares as changes in one area can ripple through the entire component, causing unintended consequences. Refactoring can involvethe following:Creating dedicated services: Extract functionalities related to data access, business logic, or calculations into separate services. These services can be reused by multiple components, promotingbetter organization.Splitting the component: Break down the god component into smaller, more focused components, each handling a specific aspect of the UIor functionality.The code duplication monster: Seeing the same block of code copy-pasted across different parts of your application? This code duplication not only wastes space but also makes maintenance a challenge. Any bug fix in one instance needs to be replicated across all copies. Refactoring involves identifying these repetitive code snippets and creatingthe following:Reusable components: If the duplicated code deals with UI elements, consider creating a reusable component that can be used inmultiple places.Services or utility functions: For duplicated logic unrelated to the UI, extract them into services or utility functions that can be sharedacross components.The magic number mystery: Scattered numeric constants with no clear meaning throughout your code base are like magic tricks; they are confusing and difficult to maintain. Imagine having a constant10used for pagination but its purpose is unclear. Refactoring involves replacing these magic numbers with named variables or constants. For example, useITEMS_PER_PAGEinstead of10, making the code more self-documenting and easierto understand.The spaghetti code maze: Imagine code that winds and twists, lacking clear structure and organization. This is spaghetti code, making it a challenge to navigate, understand, and modify. TDD can be a powerful tool to combat spaghetti code. By writing tests first and then refactoring the code to meet those tests, you can introduce structure and improve the overall organization of yourcode base.Mastering Angular Test-Driven Developmentwas published in October 2024. Packt library subscribers can continue reading the entire book for free or you can buy the bookhere!Get the eBook for $30.99$20.98🛠️Useful Tools⚒️superflex-vscode: AI-driven VSCode tool turning Figma, images, and prompts into production-ready frontend code.jekyll-sqlite: A a plugin enabling SQLite as a data source for dynamic Jekyll sites using SQL queries.lovable: AI-driven full-stack assistant that rapidly converts ideas into production-ready apps, enabling fast prototyping, editing, and deployment.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 usefulhere.If your company is interested in reaching an audience of developers, software engineers, and tech decision makers, you may want toadvertise with us.If you have any suggestions or feedback, or would like us to find you a learning resource on a particular subject, just respond to this email!*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{color:inherit!important;text-decoration:inherit!important}#MessageViewBody a{color:inherit;text-decoration:none}p{line-height:inherit}.desktop_hide,.desktop_hide table{mso-hide:all;display:none;max-height:0;overflow:hidden}.image_block img+div{display:none}sub,sup{font-size:75%;line-height:0}#converted-body .list_block ol,#converted-body .list_block ul,.body [class~=x_list_block] ol,.body [class~=x_list_block] ul,u+.body .list_block ol,u+.body .list_block ul{padding-left:20px} @media (max-width: 100%;display:block}.mobile_hide{min-height:0;max-height:0;max-width: 100%;overflow:hidden;font-size:0}.desktop_hide,.desktop_hide table{display:table!important;max-height:none!important}}
Read more
  • 0
  • 0
  • 10342

Divya Anne Selvaraj
22 Nov 2024
Save for later

ProgrammingPro #83: Unreal Engine 5's AI Perception, Fil-C's Memory Safety for C++, and Go's AI Evolution

Divya Anne Selvaraj
22 Nov 2024
Bite-sized actionable content, practical tutorials, and resources for programmers#83Unreal Engine 5's AI Perception, Fil-C's Memory Safety for C++, Go's AI Evolution, and Python In-Memory ComputingScale your scrapers with Apify’s Black Friday Boost plan!Get a 30% prepaid usage bonus on Apify this Black Friday. Scrape data for app integrations, performance tracking, competitive research, or custom pipelines. Use pre-built scrapers, build your own from scratch, or use quick-start code templates.The Boost plan ends December 5 - grab it while you can!Claim your bonus now!Hi ,Welcome to this week’s edition of ProgrammingPro!In today’sExpert Insight, we bring you an excerpt from the recently published book, Artificial Intelligence in Unreal Engine 5, which introduces Unreal Engine 5's AI Perception System, detailing its components, predefined sense configurations, and how developers can use or customize it.News Highlights: Fil-C tackles memory safety in C/C++ without requiring a new language; Go advances for AI and hardware efficiency with improved garbage collection; Rust Foundation enhances C++ interoperability with better tools and collaboration; and F# 9 introduces nullable reference types, computation expressions, and library upgrades.My top 5 picks from today’s learning resources:Researchers develop Python code for in-memory computing — in-memory computation comes to Python code🧠Speeding up the Rust edit-build-run cycle⚡C# 13 and .NET 9: Personal Highlights🎯Clean Architecture: The Missing Chapter🏗️How I Used Event-Driven Architecture in the Wrong Way🔄But there’s more, so dive right in.Stay Awesome!Divya Anne SelvarajEditor-in-ChiefP.S.:This month'ssurvey is still live. Do take the opportunity to leave us your feedback, request a learning resource, and earn your one Packt credit for this month.Sign Up|Advertise🗞️News and Analysis🔎Java News Roundup: Spring Framework 6.2, OpenJDK JEPs, Micronaut 4.7, Gradle 8.11: Other highlights include Project Reactor 2024.0.0, with enhancements spanning dependency upgrades and other new features.Rust haters, unite! Fil-C aims to Make C Great Again: Fil-C, a memory-safe variant of C and C++ developed by Filip Pizlo aims to address memory safety vulnerabilities, without requiring developers to learn a new language.F# 9 adds nullable reference types: The version also introduces empty-bodied computation expressions, and standard library enhancements like random sampling and shuffling functions.Go language evolving for future hardware, AI workloads:The Go team is working on improving garbage collection, introducing hardware-efficient features, and integrating AI SDKs like LangChainGo.Rust Foundation moves forward on C++ and Rust interoperability: The initiative focuses on enhancing tools, building consensus for long-term solutions, and collaborating with the C++ community to address challenges.JetBrains releases IntelliJ IDEA 2024.3 and other IDEs, still struggles to convince devs of benefits of new UI: Updates have been made to PHPStorm, PyCharm, and GoLand. Improvements include Logical code structure view.Uno Hot Design aims to meet demand for a visual designer for modern .NET: Hot Design isa visual design tool in the Uno Platform Studio suite to address the lack of a designer for modern .NET development, including WinUI.🎓Tutorials and Learning Resources💡Python🗞️Researchers develop Python code for in-memory computing — in-memory computation comes to Python code:Technion researchers have developedPyPIM, a tool that translates Python code into machine code for in-memory computing, enabling programmers to use Python without adaptation.For more Python resources, go to PythonProC# and .NET🎓Tutorial | Events and Delegates in C#: Covers the definition, implementation, and practical use of events and delegates in C#, including their benefits, use cases, and challenges, with examples and best practices.💡C# 13 and .NET 9: Personal Highlights: Reviews highlights of C# 13 and .NET 9, including enhanced performance, AI integration, improved params collections, new thread synchronization tools, and implicit index access.🎓Tutorial | Mastering Divide and Conquer (D&C): A Fundamental Algorithmic Paradigm: Explains the paradigm, detailing its practical applications with examples like Merge Sort and curated LeetCode problems.C and C++💼Case Study | Retrofitting spatial safety to hundreds of millions of lines of C++: Outlines Google's efforts to enhance spatial memory safety in its vast C++ codebase by retrofitting hardened libc++ with bounds checking.🎓Tutorial | Non-allocating Circular Buffer in C++: Explains circular buffers in C++, highlighting their fixed capacity and ability to overwrite the oldest data when full.🎓Tutorial | You can use C-Reduce for any language: Demonstrates the versatility of C-Reduce, a tool initially designed to minimize C compiler bug reproducers, with an example involving RustPython.Java🎓Tutorial | A Basic Introduction to the Classfile API: Introduces the Classfile API, providing a basic guide to generating JVM bytecode by constructing class files programmatically.🎓Tutorial | The Ultimate Linked List Guide: Become a Hero with All Methods and Theory in Java (Part-2): Introduces methods for inserting nodes at the start, end, or a specific index in the list to maintain the structure.💼Case Study | Java Backend Observability with OpenTelemetry Traces and Minimal Code: Explores how the MY.GAMES team integrated OpenTelemetry into their Java backend for Rush Royale to improve system observability.JavaScript and TypeScript🎓Tutorial | Importing a frontend Javascript library without a build system: Covers the three main types of JavaScript files (classic, ES Modules, and CommonJS), their characteristics, and methods for importing them.🗞️Meet Angular v19: Key updates include incremental hydration for server-side rendering, event replay stabilization, route-level render modes, and experimental zoneless support.💼Case Study | Adopting Bazel for Web at Scale: details Airbnb's migration of its large-scale web monorepo to Bazel, highlighting challenges, custom solutions, and performance gains in CI processes and developer workflows.Go🎓Tutorial | Constraints in Go: Explores constraints as tools for enhancing type safety and functionality in generic programming by defining permissible operations for types through method sets, unions, and approximations.🎓Tutorial | Testing with Go and PostgreSQL: ephemeral DBs: Explains how to integrate ephemeral PostgreSQL instances into Go testing workflows, optimizing setup for convenience, resource efficiency, and reduced test times.Rust🎓Tutorial | Speeding up the Rust edit-build-run cycle: Showcases steps like using faster linkers (e.g., Mold), minimizing debug information, and creating non-position-independent executables.🎓Tutorial | Build your own SQLite, Part 3: SQL parsing 101: Introduces tokenization and parsing concepts, implements a tokenizer to process SQL strings, defines an AST structure for SQL statements, and more.Swift🎓Tutorial | Syntax Highlighting SwiftUI Code with Swift Syntax: Demonstrates how to implement native SwiftUI syntax highlighting in an app using the swift-syntax library.🎓Tutorial | MainActor usage in Swift explained to dispatch to the main thread: Explains the usage of @MainActor in Swift, a global actor introduced in Swift 5.5 to ensure tasks are executed on the main thread.PHP📜Fuzzing the PHP Interpreter via Dataflow Fusion: Presents FlowFusion, the first automated fuzzing framework, validated by PHP developers, tailored to detect memory errors in the PHP interpreter.🗞️PHP 8.4.0 Released!: The major update introduces property hooks for computed properties, asymmetric visibility for enhanced property access control, the #[\Deprecated] attribute for user-defined deprecation warnings, and more.SQL💼Case Study | Presto® Express: Speeding up Query Processing with Minimal Resources: Delves into Uber's Presto Express which optimizes short-running SQL queries and reduces end-to-end SLA.💡SQL Style Guide: Covers best practices for naming conventions, query syntax, and formatting, aiming to enhance code clarity and facilitate collaboration among developers.Ruby🗞️2024 Ruby on Rails Community Survey Results: Highlights include a growing focus on maintaining applications with the latest Ruby and Rails versions despite challenges like dependency management.💡Elixir-like pipes in Ruby (oh no not again): Explores an experimental implementation of an Elixir-style pipe operator in Ruby, leveraging abstract syntax tree (AST) transformations to enable pipeline-style coding.Kotlin🗞️State of Kotlin Scripting 2024: Highlights that while Kotlin scripting remains a vital part of the Kotlin ecosystem, its adoption has been limited.🎓Tutorial | Understanding Properties in Kotlin: Covers mutable and read-only properties, custom getters and setters, backing fields, compile-time constants, late-initialized properties, and delegated properties.🌟Best Practices and Advice🚀Transforming Legacy Healthcare Systems: A Journey to Cloud-Native Architecture: Examines the challenges of modernizing legacy healthcare systems into cloud-native architectures, using Livi's transformation of its MJog platform as an example.Clean Architecture: The Missing Chapter: Critiques traditional layer-based structures for scattering related components, advocating instead for organizing code by features or components.To Dare or Not to Dare: the MVA Dilemma: Explores the challenges of balancing business and technical risks when developing a Minimum Viable Product (MVP) and its supporting Minimum Viable Architecture (MVA).How I Used Event-Driven Architecture in the Wrong Way: Reflects on the challenges of implementing event-driven architecture, highlighting issues such as managing two-way communication and handling complex event chains.🧠Expert Insight📚Here’s an excerpt from “Chapter 10: Improving Agents with the Perception System" in the book, Artificial Intelligence in Unreal Engine 5 by Marco Secchi, published in October 2024.Presenting the Perception System...One of the key components when creating intelligent and reactive AI agents in Unreal Engine is the AI Perception System; this powerful system allows AI controllers – and, consequently, AI agents – to perceive and respond to different stimuli intheirvirtual environment.At the core of the AI Perception System aresensesandstimuli. A sense – such as sight or hearing – represents a way for an AI agent to perceive its surroundings and is configured to detect specific types of stimuli, which are sources of perception data emanating from other actors in thegame world.As an example,sight senseis preconfigured to detect any visible pawn actors, whiledamage sensetriggers when the associated AI controller’s pawn takes damage from anexternal source.NoteAs a developer, you can create custom senses tailored to your game’s specific needs by extending theAISense class, if you are working with C++, or the AISense_Blueprintclass, if you are workingwith Blueprints.Presenting the Perception SystemThe AI Perception System consists of the followingmain classes:AIPerceptionSystem: This is the core manager that keeps track of all AIstimuli sources.AIPerceptionComponent: This represents the AI agent’s mind and handles processing perceived stimuli. It needs to be attached to an AI controller toproperly work.AIPerceptionStimuliSourceComponent: This component is added to actors that can generate stimuli and is in charge of broadcasting perception data tolistening elements.AIPerceptionSenseConfig: This defines the properties of a specific sense, what actors can be perceived, and how perception decays over timeor distance.When an actor withAIPerceptionStimuliSourceComponentgenerates a stimulus, nearbyAIPerceptionComponentsdetect it through their configured senses. This perceived data is then processed by the AI controller to triggerdesired behaviors.Once you have addedAIPerceptionComponentto an AI controller, you will need to add one or moreAIPerceptionSenseConfigelements in order to give your AI agent dedicated senses.Figure 10.1shows an example where perception is basedon touch:Figure 10.1 – The touch sense configFrom the previous screenshot, you may have noticed aDominant Senseproperty; this property allows you to designate a specific sense that takes priority over others when determining the location of asensed actor.Let’s explore the available sense configs that, as mentioned earlier, define the properties of eachspecific sense:AIPerceptionSenseConfig typesUnreal Engine offers a range of predefinedAIPerceptionSenseConfigclasses that are highly likely to meet your specific requirements. Let’s take a look at theavailable options:AIDamage: Use this configuration if your AI agent needs to respond to damage events such asAny Damage,Point Damage, orRadial DamageAIHearing: Use this configuration if you need to detect sounds generated in thesurrounding environmentAIPrediction: Use this configuration when you need to predict the target actor location in the nextfew momentsAISight: Use this configuration when you want your AI agent to see things inthe levelAITeam: Use this configuration if you want to notify the AI agent that some allyis nearbyAITouch: Use this configuration when the AI agent touches some other actor or, vice versa, when something is touching theAI agentStimuli sourceTheAIPerceptionStimuliSourceComponentclass allows an actor to register itself as a source of stimuli for one or more senses. For instance, you can register an actor as a stimuli source for sight. This registration allows an AI agent to visually perceive the actor in thegame level.A stimuli source can be registered – or unregistered – for a sense, making it detectable – or undetectable – by thePerception System.Artificial Intelligence in Unreal Engine 5was published in October 2024. Packt library subscribers can continue reading the entire book for free or you can buy the bookhere!Get the eBook for $39.99$27.98🛠️Useful Tools⚒️fast-graphrag: Acost-efficient, dynamic, and interpretable framework for building scalable, agent-driven retrieval-augmented generation pipelines.pglite-fusion: A PostgreSQL extension that embeds SQLite databases into table columns, offering streamlined multitenancy and efficient data isolation.fireproof: An open-source live-update database enabling real-time collaboration, seamless integration with any stack, and deployment anywhere.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 usefulhere.If your company is interested in reaching an audience of developers, software engineers, and tech decision makers, you may want toadvertise with us.If you have any suggestions or feedback, or would like us to find you a learning resource on a particular subject, take the surveyor just respond to this email!*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{color:inherit!important;text-decoration:inherit!important}#MessageViewBody a{color:inherit;text-decoration:none}p{line-height:inherit}.desktop_hide,.desktop_hide table{mso-hide:all;display:none;max-height:0;overflow:hidden}.image_block img+div{display:none}sub,sup{font-size:75%;line-height:0}#converted-body .list_block ol,#converted-body .list_block ul,.body [class~=x_list_block] ol,.body [class~=x_list_block] ul,u+.body .list_block ol,u+.body .list_block ul{padding-left:20px} @media (max-width: 100%;display:block}.mobile_hide{min-height:0;max-height:0;max-width: 100%;overflow:hidden;font-size:0}.desktop_hide,.desktop_hide table{display:table!important;max-height:none!important}}
Read more
  • 0
  • 0
  • 10274
Subscribe to Packt _ProgrammingPro
A weekly Programming newsletter that helps to keep you up to date on industry trends and advance your skills as a developer or software engineer. ProgrammingPro combines original ideas and curated content, deep dives and tools, all in one place.

Divya Anne Selvaraj
18 Nov 2024
Save for later

Essential Guides to C# 13 and .NET 9, AI in Unreal Engine 5, and Angular TDD

Divya Anne Selvaraj
18 Nov 2024
Curated for software engineers, game developers, and frontend specialistsEssential Guides to C# 13 and .NET 9, AI in Unreal Engine 5, and Angular TDDHi ,This week, we’re bringing you three new books for developers working with today’s most in-demand tools. Master C# 13 and .NET 9 for cross-platform development, create smarter AI-driven games with Unreal Engine 5, or deliver high-quality code with test-driven development in Angular—each now at upto 30% off.Bundle up & save more!Buy 2 eBooks – save an additional 10%Buy 3 eBooks – save an additional 15%Buy 5 eBooks – save an additional 20%Here’s what’s on offer:C# 13 and .NET 9 – Modern Cross-Platform Development Fundamentals - Ninth Edition by Mark J. PriceStart building websites and services with ASP.NET Core 9, Blazor, and EF Core 9>Explore the newest additions to C# 13, the .NET 9 class libraries, and Entity Framework Core 9>Build professional websites and services with ASP.NET Core 9 and Blazor>Enhance your skills with step-by-step code examples and best practices tipsGet the eBook for $35.99$24.99Get the Print book for $44.99Artificial Intelligence in Unreal Engine 5 by Marco SecchiUnleash the power of AI for next-gen game development with UE5 by using Blueprints and C++>Adopt AI techniques for developing immersive gameplay experiences>Learn how to use the Unreal Engine gameplay framework system with C++ and Blueprints>Plan and develop AI behaviors carefully from start to finishGet the eBook for $39.99$27.98Get the Print book for $49.99Mastering Angular Test-Driven DevelopmentbyBuild high-quality Angular apps with step-by-step instructions and practical examples>Implement test-driven development practices in Angular using tools like Jasmine, Karma, and Cypress>Understand end-to-end testing through real-world scenarios and practical examples>Discover best practices for incorporating TDD into continuous integration and deployment (CI/CD) processesGet the eBook for $30.99$20.99Get the Print book for $37.99*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{color:inherit!important;text-decoration:inherit!important}#MessageViewBody a{color:inherit;text-decoration:none}p{line-height:inherit}.desktop_hide,.desktop_hide table{mso-hide:all;display:none;max-height:0;overflow:hidden}.image_block img+div{display:none}sub,sup{font-size:75%;line-height:0}#converted-body .list_block ol,#converted-body .list_block ul,.body [class~=x_list_block] ol,.body [class~=x_list_block] ul,u+.body .list_block ol,u+.body .list_block ul{padding-left:20px} @media (max-width: 100%;display:block}.mobile_hide{min-height:0;max-height:0;max-width: 100%;overflow:hidden;font-size:0}.desktop_hide,.desktop_hide table{display:table!important;max-height:none!important}}
Read more
  • 0
  • 0
  • 9876

Divya Anne Selvaraj
12 Dec 2024
Save for later

ProgrammingPro #86: Python Debugging Best Practices, Go’s API Surge, Google's Jules Coding Agent, and Netflix's Scalable Counters

Divya Anne Selvaraj
12 Dec 2024
Bite-sized actionable content, practical tutorials, and resources for programmers🎄#86🥂Python Debugging Best Practices, Go’s API Surge, Google's Jules Coding Agent, and Netflix's Scalable CountersHi ,"It's the Most Wonderful Time of the Year🌟...It's the hap-happiest season of all" 🎵 - Andy WilliamsWelcome to our very last issue, for the year 2024! We will be taking our usual year end break and return again on the 16th of January 2025. In the meanwhile, do keep any eye out. Packt x Santa🎅 are busy working on some unmissable deals for you to unwrap over the holidays! Now let's get down to business.In today’sExpert Insight, we bring you an excerpt from the recently published book, Learn Python Programming - Fourth Edition, which demonstrates best practices for creating custom debugging functions in Python.News Highlights:Python is set to win Tiobe's "Language of the Year" for its growth in AI and data mining; Go overtakes Node.js in API requests with a 40% rise; Google introduces Gemini 2.0 and AI coding agent Jules; and SQLite is re-implemented in Rust for async I/O and memory safety.My top 5 picks from today’s learning resources:Linear Regression in Python📈How AMD Is Taking Standard C/C++ Code To Run Directly On GPUs🚀Data structures as jigs for Go programmers🧩Inside Netflix’s Distributed Counter: Scalable, Accurate, and Real-Time Counting at Global Scale🌍How to Become a Principal Engineer🏗️But there’s more, so dive right in.Before signing off, I would like to say thank you to all readers who have been on this journey with me this year. A very Merry Christmas and Wonderful New Year 2025 to you all!Don't forget to Stay Awesome!Divya Anne SelvarajEditor-in-ChiefSign Up|Advertise🗞️News and Analysis🔎Python a shoo-in for Tiobe language of the year: Python is expected to win Tiobe’s "Programming Language of the Year" for 2024 due to a significant 10% increase in popularity ratings, driven by its dominance in AI, data mining, and ease of learning.Go eclipses Node.js in web API requests, Cloudflare reports: Go has overtaken Node.js as the leading language for automated API requests, accounting for 11.8% of traffic, with Go's share rising 40% and Node.js declining 30%.Ruby on Rails 8.0 Released, Introduces Kamal 2 for Improved Deployments: Key updates also include SQLite-based adapters, a new asset pipeline, enhanced authentication tools, and deprecated feature removals.Java News Roundup: JDK 24 in Rampdown, JDK 25 Expert Group, Jakarta EE 11 Core Profile, Spring Cloud: Other highlights include updates to frameworks like GlassFish, Open Liberty, Quarkus, Apache Camel, and others.Google announces Gemini 2.0 Flash and new coding agent: Jules, an AI-powered coding agent, is designed to assist with Python and JavaScript tasks, including debugging, modifying multiple files, and creating pull requests.SQLite re-implemented in Rust to achieve asynchronous I/O and other changes: Turso is re-implementing SQLite in Rust as "Limbo" to enable asynchronous I/O, memory safety, and modern architecture while ensuring compatibility with SQLite.OpenSilver 3.1 adds new drag-and-drop XAML designer for VS Code: The designer comes with over 100 controls, cross-platform compatibility, a modern UI theme, expanded WPF feature support, and full .NET 9 compatibility.React 19 is stable, team directs devs towards frameworks – especially Next.js: React 19 is now stable, introducing server components to the main channel, improved pre-rendering APIs, and enhanced suspense features.🎓Tutorials and Learning Resources💡Python🎓Tutorial |Linear Regression in Python:Demonstrates implementing simple, multiple, and polynomial regression in Python using libraries like scikit-learn and statsmodels, covering key concepts such as underfitting and overfitting.For more Python resources, go to PythonProC# and .NET🎓Tutorial | Using vectorization in C# to boost performance: Explains how vectorization in C# was used to optimize the Sum method in .NET 8, leveraging SIMD principles and advanced techniques like loop unrolling.🎓Tutorial | Building a Multi-Tenant Configuration Management System with .NET Core, Redis, and Dependency Injection: Combines local disk caching for quick access, Redis for distributed caching, and a Pub/Sub model.🎓Tutorial | Central Package Management (CPM) in .NET — Simplify NuGet Dependencies: Explains how CPM achieves simplification by centralizing package version control in a single Directory.Packages.props file.C and C++💼Case Study | How AMD Is Taking Standard C/C++ Code To Run Directly On GPUs: AMD is working on porting LLVM's C/C++ run-times to GPUs, bypassing the need for GPU-specific languages like OpenMP or OpenACC.🎓Tutorial | Learning to read C++ compiler errors: Nonsensical errors from a function declaration: Explains how conflicting macros in C++ projects can lead to compiler errors, using the case of a macro named ErrorMessage .🎓Tutorial | Refactoring in C++: Top Techniques and Best Practices: Covers methods such as renaming variables, extracting functions, simplifying conditionals, and reducing duplication, along with best practices.Java💼Case Study | QCon SF 2024: Refactoring Large, Stubborn Codebases: Stripe engineers share strategies for refactoring large, stubborn codebases leveraging centralized teams, tools like Sorbet for Ruby, and more.🗞️Malicious Maven Package Impersonating 'XZ for Java' Library Introduces Backdoor Allowing Remote Code Execution: Socket researchers have uncovered a malicious Maven package, io.github.xz-java:xz-java, impersonating the legitimate XZ for Java library (org.tukaani:xz).🎓Tutorial | Peering through the peephole: build a peephole optimiser using the new Java Class-File API: Demonstrates building an optimizer that removes redundant instructions (e.g., unnecessary zero addition) and more.JavaScript and TypeScript💡What is TypeScript? Strongly typed JavaScript: Introduces TypeScript as a strongly typed superset of JavaScript, highlighting its enterprise-level features, compatibility, and advantages for large-scale application development.💡Everything AboutBarrel ExportsInJavaScript: Examines the benefits, challenges, and best practices of using barrel exports to simplify imports, improve code organization, and balance performance and maintainability.🗞️Malicious npm Package Typosquats Popular TypeScript ESLint Plugin, Exfiltrates Data and Enables Remote Exploitation: A secondary malicious package, @typescript_eslinter/prettier, remains live, escalating the risk.Go🎓Tutorial | Data structures as jigs for programmers: Discusses implementations including basic and dynamic arrays, multidimensional arrays, bitsets, binary heaps, and hash tables, with practical use cases and code examples.🗞️Coming in Go 1.24: testing/synctest experiment for time and concurrency testing: Introduces the experimental testing/synctest package in Go 1.24, designed to improve testing involving time and concurrency.Rust💼Case Study |I spent 2 years rebuilding my algorithmic trading platform in Rust. I have no regrets: Discusses the author's experience transitioning their algorithmic trading platform from Typescript to Rust.💡Thoughts on Rust hashing: Critiques Rust's hashing model, which separates Hash and Hasher traits for flexibility, highlighting inefficiencies in handling block-wise hashing, variable-length inputs, and more.Swift🎓Tutorial | Migrating XCTest to Swift Testing: Provides a migration guide using modern features of Swift Testing, such as concurrency and macros, its improved test setup, teardown processes, and flexible assertion macros.🎓Tutorial | SF Symbol: How to for Swift & SwiftUI: Explains how to use, customize, and animate Apple's SF Symbols in Swift and SwiftUI, leveraging the SF Symbols app for integration and design consistency in apps.PHP🎓Tutorial | Parsing HTML with PHP 8.4: Discusses the new HTML5 parser, CSS selector support, and updated DOM classes in PHP 8.4, which improve HTML parsing, DOM manipulation, and web development efficiency.🎓Tutorial | Implementing Dependency Inversion Principle (DIP) using Laravel: Demonstrates implementing DIP by decoupling UserService from specific repository dependencies through a RepositoryManagerInterface .SQL💡Some useful SQL(ite) tips I've learned: Includes tips such as splitting data into buckets, advanced ordering without additional columns, JSON querying with shorthand operators, string concatenation, and default values for NULLs.🎓Tutorial | A Beginner’s Guide to Procedural Programming Beyond SQL with Toad for Oracle: Covers the fundamentals of PL/SQL, its advantages for database programming, and practical tips for efficient PL/SQL development.Ruby🎓Tutorial | Mastering Ruby Debugging: From puts to Professional Tools: Provides a comprehensive guide to debugging in Ruby, covering basic techniques like puts statements, interactive consoles, and advanced tools.💡Advent of Criminally Bad Ruby Code: Humorously chronicles the author's exploration of unconventional and experimental Ruby coding practices, showcasing creative abuses of Ruby features.Kotlin💡When to Use Retrofit and When to Use Ktor: A Guide for Android Developers: Compares two popular HTTP clients for Android, detailing their strengths and scenarios for use.🎓Tutorial | 5 steps to implement MVI architecture with Jetpack Compose: Covers setting up dependencies, defining the Model, ViewState, and Intent layers, managing the state and events in a ViewModel, and creating a reactive UI layer following MVI principles.🌟Best Practices and Advice🚀Inside Netflix’s Distributed Counter: Scalable, Accurate, and Real-Time Counting at Global Scale: Explains the system which balances performance, accuracy, and cost through configurable modes and event-driven architecture.Beat the Plan: Probabilistic Strategies for Successful Software Delivery at Scale: Advocates for adaptive systems over rigid plans, leveraging continuous processes, prioritization, constraints, and a culture of learning.How to Become a Principal Engineer: Discusses the required technical and leadership skills, strategies for career growth, and how companies can define and support the role for maximum impact.On over-engineering; Architecture Edition: Discusses balancing over-engineering and under-engineering in architectural decisions, using the author’s project, Collecto, as an example.🧠Expert Insight📚Here’s an excerpt from “Chapter 11: Debugging and Profiling" in the book, Learn Python Programming - Fourth Edition by Fabrizio Romano and Heinrich Kruger, published in November 2024.Debugging with a custom functionHaving a custom debugging function saved in a file somewhere that you can quickly grab and paste into the code can be particularly useful. If you are fast, you can also code one on the fly. The important thing is to write it in such away that it will not leave anything behind when you eventually remove the calls and their definitions. Therefore, it is important to code it in a way that is completely self-contained. Another good reason for this requirement is that it will avoid potential name clashes with the rest of the code.Let us see an example of such a function:# custom.pydef debug(*msg, print_separator=True): print(*msg) if print_separator: print("-" * 40)debug("Data is ...")debug("Different", "Strings", "Are not a problem")debug("After while loop", print_separator=False)$ python custom.pyData is ...----------------------------------------Different Strings Are not a problem----------------------------------------After while loopAs you can see, there is no separator after the last line.This is just one easy way to augment a simple call to theprint()function. Let us see how we can calculate a time difference between calls, using one of Python’s tricky features to our advantage:# custom_timestamp.pyfrom time import sleepdef debug(*msg, timestamp=[None]): from time import time # local import print(*msg) if timestamp[0] is None: timestamp[0] = time() # 1 else: now = time() print(f" Time elapsed: {now - timestamp[0]:.3f}s") timestamp[0] = now # 2debug("Entering buggy piece of code...")sleep(0.3)debug("First step done.")sleep(0.5)debug("Second step done.")This is a bit more complicated. First, notice that we used animportstatementinsidethedebug()function to import thetime()function from thetimemodule. This allows us to avoid having to add thatimportoutside the function and risk forgetting to remove it.Look at how we definedtimestamp. It is a function parameter with a list as its default value. InChapter 4,Functions, the Building Blocks of Code, we warned against using mutable defaults for parameters because the default value is initialized when Python parses the function, and the same object persists across different calls to the function. Most of the time, this is not the behavior you want. In this case, however, we are taking advantage of this feature to store a timestamp from the previous call to the function, without having to use an external global variable. We borrowed this trick from our studies onclosures, a technique that we encourage you to read about.After printing the message, we inspect the content of the only item intimestamp. If it isNone, we have no previous timestamp, so we set the value to the current time (#1). On the other hand, if we have a previous timestamp, we can calculate a difference (which we neatly format to three decimal digits), and finally, we put the current time intimestamp(#2).Running this code outputs the following:$ python custom_timestamp.pyEntering buggy piece of code...First step done.Time elapsed: 0.300sSecond step done.Time elapsed: 0.500sUsing a custom debug function solves some of the problems associated with just usingprint(). It reduces duplication of debugging code and makes it easier to remove all your debugging code when you no longer need it. However, it still requires modifying the code and running it in a console where you can inspect the output. Later in this chapter, we will see how we can overcome those difficulties by adding logging to our code.Learn Python Programming - Fourth Editionwas published in Novemver 2024. Packt library subscribers can continue reading the entire book for free or you can buy the book here!Get the eBook for $35.99$24.99🛠️Useful Tools⚒️Holos: A Go CLI tool using CUE to replace YAML templating in Kubernetes, streamlining Helm and Kustomize configurations with type-safe, unified management.cal.com: An open-source, self-hosted alternative to Calendly, offering complete control over scheduling, data, and workflows, with extensive customizability.sqlfluff: A highly configurable, dialect-flexible SQL linter and auto-formatter that supports templating systems like Jinja and dbt, ensuring error-free SQL code.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 usefulhere.If your company is interested in reaching an audience of developers, software engineers, and tech decision makers, you may want toadvertise with us.If you have any suggestions or feedback, or would like us to find you a learning resource on a particular subject, just respond to this email!*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{color:inherit!important;text-decoration:inherit!important}#MessageViewBody a{color:inherit;text-decoration:none}p{line-height:inherit}.desktop_hide,.desktop_hide table{mso-hide:all;display:none;max-height:0;overflow:hidden}.image_block img+div{display:none}sub,sup{font-size:75%;line-height:0}#converted-body .list_block ol,#converted-body .list_block ul,.body [class~=x_list_block] ol,.body [class~=x_list_block] ul,u+.body .list_block ol,u+.body .list_block ul{padding-left:20px} @media (max-width: 100%;display:block}.mobile_hide{min-height:0;max-height:0;max-width: 100%;overflow:hidden;font-size:0}.desktop_hide,.desktop_hide table{display:table!important;max-height:none!important}}
Read more
  • 0
  • 0
  • 9863

Divya Anne Selvaraj
05 Dec 2024
Save for later

ProgrammingPro #85: Blazor Routing in C#, Kotlin 2.1's when Expressions, GraalVM JIT for Java, and Python Speed Boosts with Cython

Divya Anne Selvaraj
05 Dec 2024
Bite-sized actionable content, practical tutorials, and resources for programmers#85Blazor Routing in C#, Kotlin 2.1's when Expressions, GraalVM JIT for Java, and Python Speed Boosts with CythonHi ,Welcome to this week’s edition of ProgrammingPro!In today’sExpert Insight, we bring you an excerpt from the recently published book, C# 13 and .NET 9 – Modern Cross-Platform Development Fundamentals - Ninth Edition, which demonstrates defining routable page components, passing route parameters, and navigating routes in Blazor.News Highlights:Kotlin 2.1.0 previews advanced when expressions; Rust 1.83 enhances Multiplatform and Gradle tools; AWS Q Developer adds AI-driven testing and modernization; and Oracle launches GraalVM JIT for its JDK only.My top 5 picks from today’s learning resources:Cython tutorial: How to speed up Python🐇Hans Wennborg: C++ switch statements under the hood in LLVM🔧Understanding JavaScript Hoisting: The Magic Behind Variable and Function Declarations🎩Reaching Your Automatic Testing Goals by Enhancing Your Test Architecture🤖Faster Features, Happier Customers: Introducing The Platform That Transformed Our Grocery App🚀But there’s more, so dive right in.Stay Awesome!Divya Anne SelvarajEditor-in-ChiefSign Up|Advertise🗞️News and Analysis🔎Kotlin previews guard conditions in when expressions: Kotlin 2.1.0 introduces guard conditions for more flexible when expressions, non-local breaks/continues, and multi-dollar string interpolation as preview features.Rust 1.83 expands const capabilities: The updates improve Kotlin Multiplatform library publishing, add Swift export, stabilize Gradle DSLs, and enhance K2 compiler checks.AWS enhances Q Developer: Test and review code, upgrade to modern .NET, migrate mainframe applications: Features include AI-driven unit testing, code reviews, operational troubleshooting, and migration tools.Microsoft fixed slow package restore in .NET 9.0, but with annoying early bugs: The SDK introduces a 15x faster package restore with NuGet 6.12, but bugs like downloading unused packages remain.Java News Roundup: Last of the JEPs Targeted to JDK 24, Quarkus 3.17, Maven 4.0-RC1, Kotlin 2.1: Updates also include Hibernate Search 7.2.2, Eclipse Vert.x 5.0, and the latest JDKUpdater version.Oracle Ships GraalVM Java JIT Compiler - but Only in Its Own JDK: The compiler offers better performance and maintainability than standard OpenJDK JIT compilers.New report finds signs of slowing supply chain security momentum, plateaued DevOps maturity: According to Snyk's State of Open Source report, organizations report reduced adoption of new tools and training due to security fatigue.JavaScript-based APIs have the lowest quality scores among all languages: The 2024 treblle Anatomy of an API report also notes explosive AI-driven API growth, rising complexity, and the critical need for better governance.🎓Tutorials and Learning Resources💡Python🎓Tutorial | Cython tutorial: How to speed up Python: Provides step-by-step guidance on optimizing Python functions, integrating Cython with Python libraries, compiling code, and profiling for speed improvements.💡Goodbye Make and Shell, Hello... Python?:Advocates using Python for build and project tooling over traditional Makefiles and shell scripts, emphasizing its benefits for maintainability, debuggability, and flexibility.For more Python resources, go to PythonProC# and .NET🎓Tutorial | How to use ref structs in C# 13: Covers the implementation, benefits, limitations, and extended capabilities of ref structs in C# 13 for high-performance, stack-only memory management.🎓Tutorial | File Operations C# .NET: Part 01 — File and Directory Handling: Covers path manipulation, copying, moving, deleting, exception handling, and best practices, using .NET 8, C# 12, and Visual Studio 2022.🎓Tutorial | Deep Dive into .NET Hosted Services: Delves into the BackgroundService class, its lifecycle methods (StartAsync, StopAsync), and integration with the Host class for managing long-running tasks.C and C++🎥Hans Wennborg: C++ switch statements under the hood in LLVM: Explains how LLVM uses clustering, jump tables, bit masking, and binary search trees for efficient code generation and addresses edge cases.💡Legacy Safety: The Wrocław C++ Meeting: Discusses the challenges of improving C++ memory safety focusing on the tension between two approaches: Profiles, incremental safety rules for existing code, and Safe C++, a borrow-checking approach.🎓Tutorial | Build Your Own In-Memory Data Store with C: A Step-by-Step Guide (Part 2): Provides guidance for creating the table, inserting, retrieving, deleting, and cleaning up data, basic test setup, and compiling with CMake.Java🗞️Oracle's Java price hikes push CIOs to brew new licensing strategies: Many are exploring open-source Java alternatives, which could cut costs by 50%, but the transition requires top-level involvement to assess risks.🎓Tutorial | Spring Security Guide:Part 1: Provides an overview of how security works in Spring-based web applications, focusing on middleware for authentication (identifying users) and authorization (checking permissions).🎓Tutorial | Linked List Complexity: Delves into the efficiency of linked list operation for insertions and deletions compared to array-based structures, and provides examples of using Java's LinkedList class and more.JavaScript and TypeScript🎓Tutorial | Understanding JavaScript Hoisting: The Magic Behind Variable and Function Declarations: Explains thedifferences between var, let, const , function declarations, and function expressions.🎓Tutorial | React file nesting design pattern: Introduces thedesign pattern using the VSCode extension File Nesting Explorer, enabling a hierarchical folder structure that mirrors the UI/UX tree of the application.💼Case Study | A leap in the evolution of Airtable’s codebase: Scaling TypeScript to thousands of projects: Discusses how Airtable scaled its codebase from 50 to nearly 3000 projects, reducing typechecking time by 65%.Go🎓Tutorial | Building a distributed log using S3 (under 150 lines of Go): Demonstrates how to build a durable, distributed log, covering its design for appending, reading, checksums, crash recovery, and failover handling.💡Dependency management fatigue, or why I forever ditched React for Go+HTMX+Templ: Focuses on how the Go+HTMX+Templ stack allows developers to focus on feature development and minimize maintenance.Rust💼Case Study | Optimization adventures: making a parallel Rust workload 10x faster with (or without) Rayon: Dicusses optimization by replacing Rayon with a custom thread pool and work-stealing implementation.📖Open Access Book | Writing NES Emulator in Rust: Covers essential topics such as emulating the NES CPU, memory management, picture processing unit (PPU), audio processing unit (APU), and input handling.Swift🎓Tutorial | Native Swift on Android, Part 2: Your First Swift Android App: Demonstrating how to build a "Hello Swift" app that integrates native Swift functionality and Kotlin/Jetpack Compose via bridging.🎓Tutorial | Enum explained in-depth with code examples in Swift: Covers definitions, raw values, associated values, CaseIterable protocol, Equatable conformance, advanced usage with if/guard case, and more.PHP🎓Tutorial | Exploring PHP Lazy Objects: A Practical Implementation: Introduces PHP Lazy Objects, a new feature in PHP 8.4 that optimizes object initialization using two strategies: Ghost Objects and Virtual Proxies.🎓Tutorial | Graceful Error Handling with Laravel’s rescue Function: Delves into Laravel’s rescue function which offers a concise and readable way to handle exceptions without disrupting application flow.SQL🎓Tutorial | Writing Composable SQL using Knex and Pipelines: Explains how to write composable SQL queries using Knex, a Node.js query builder, and pipelines for a functional programming approach.🗞️AWS announces Aurora DSQL, a new distributed SQL database that promises virtually unlimited scalability: This serverless distributed SQL database offers 99.999% availability, strong consistency, and PostgreSQL compatibility.Ruby🎓Tutorial | Speeding up Ruby by rewriting C… in Ruby: Explores the challenges and progress in optimizing Ruby's performance, especially through rewriting C-based methods in Ruby to leverage Yet Another Ruby JIT.🎓Tutorial | Calculating the largest known prime in Ruby: Explains how Ruby 3.4 introduces support for calculating large numbers like the largest known prime, which previously returned infinity.Kotlin🎓Tutorial | Kotlin Flows Animated (Scan, Fold, Reduce): Delves into Kotlin Flows' state accumulation operators, explaining their use cases with examples.🎓Tutorial | Deploy Kotlin Mutliplatform WasmJS to Github Pages: Demonstrates using a GitHub Actions workflow to automate building and deploying a Kotlin/wasmJs project from a structured directory.🌟Best Practices and Advice🚀How to Use Programming Rules and Guidelines: Discusses the proper use of programming rules and guidelines, emphasizing their impact on code consistency and readability.Navigating Responsible AI in the FinTech Landscape: Discusses the EU AI Act, balancing transparency and efficiency, cross-functional collaboration, and risk management, highlighting FinTech’s potential to lead in ethical AI adoption.Reaching Your Automatic Testing Goals by Enhancing Your Test Architecture: Discusses integrating technical tools and human collaboration, focusing on trends over individual failures, using ML for auto-triaging, and more.Faster Features, Happier Customers: Introducing The Platform That Transformed Our Grocery App: Discusses how Picnic transformed its app by adopting React Native, enabling faster feature delivery through cross-platform development, modular architecture, and real-time rule evaluation.🧠Expert Insight📚Here’s an excerpt from “Chapter 14: Building Interactive Web Components Using Blazor" in the book, C# 13 and .NET 9 – Modern Cross-Platform Development Fundamentals - Ninth Edition by Mark J. Price, published in November 2024.How to define a routable page componentTo create a routable page component, add the@pagedirective to the top of a component’s.razorfile, as shown in the following markup:@page "/customers"The preceding code is the equivalent of a mapped endpoint inProgram.cs, as shown in the following code:app.MapGet("/customers", () => ...);TheRoutercomponent scans the assembly specifically in itsAppAssemblyparameter for Blazor components with the@pagedirective, registering their URL paths as endpoints.At runtime, a page component is merged with any specific layout that you have specified in theRoutes.razorfile<RouteView>component. By default, the Blazor Web App project template definesMainLayout.razoras the layout for page components.Pro Tip: Good Practice: By convention, put routable page Blazor components in theComponents\Pagesfolder.How to navigate routes and pass route parametersMicrosoft provides a dependency service namedNavigationManagerthat understands Blazor routing and theNavLinkcomponent. TheNavigateTomethod is used to go to the specified URL.Blazor routes can include case-insensitive named parameters, and your code can most easily access the values passed by binding the parameter to a property in the code block, using the[Parameter]attribute, as shown in the following markup:@page "/customers/{country}"<div>Country parameter as the value: @Country</div>@code { [Parameter] public string Country { get; set; }}The recommended way to handle a parameter that should have a default value when it is missing is to suffix the parameter with?and use the null-coalescing operator in theOnParametersSetmethod, as shown in the following markup:@page "/customers/{country?}"<div>Country parameter as the value: @Country</div>@code { [Parameter] public string Country { get; set; } protected override void OnParametersSet() { // If the automatically set property is null, then // set its value to USA. Country = Country ?? "USA"; }}C# 13 and .NET 9 – Modern Cross-Platform Development Fundamentals - Ninth Editionwas published in Novemver 2024. Packt library subscribers can continue reading the entire book for free or you can buy the book*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{color:inherit!important;text-decoration:inherit!important}#MessageViewBody a{color:inherit;text-decoration:none}p{line-height:inherit}.desktop_hide,.desktop_hide table{mso-hide:all;display:none;max-height:0;overflow:hidden}.image_block img+div{display:none}sub,sup{font-size:75%;line-height:0}#converted-body .list_block ol,#converted-body .list_block ul,.body [class~=x_list_block] ol,.body [class~=x_list_block] ul,u+.body .list_block ol,u+.body .list_block ul{padding-left:20px} @media (max-width: 100%;display:block}.mobile_hide{min-height:0;max-height:0;max-width: 100%;overflow:hidden;font-size:0}.desktop_hide,.desktop_hide table{display:table!important;max-height:none!important}}
Read more
  • 0
  • 0
  • 9685

Divya Anne Selvaraj
14 Nov 2024
Save for later

ProgrammingPro #82: Domain-Driven Design for Micro Frontends, .NET 9's JSON Boost, and Python Automation Scripts

Divya Anne Selvaraj
14 Nov 2024
Bite-sized actionable content, practical tutorials, and resources for programmers#82Domain-Driven Design for Micro Frontends, .NET 9's JSON Boost, and Python Automation ScriptsHi ,Welcome to this week’s edition of ProgrammingPro!In today’sExpert Insight, we bring you an excerpt from the recently published book, The Art of Micro Frontends - Second Edition, which explains how Domain-Driven Design principles can help define and organize boundaries for micro frontends to ensure modular, isolated, and efficient architecture.News Highlights: .NET 9 launches with major performance boosts, including a 50% JSON processing gain; Java 24 targets memory savings with smaller object headers via Project Lilliput; the US urges developers to move from C and C++ for security; and GitHub Copilot chat adds prompt rewording guidance.My top 5 picks from today’s learning resources:20 Python scripts to automate common daily tasks⚙️Implementing the Repository Pattern with Multiple Databases in C# Clean Architecture🏗️Optimize Database Performance in Ruby on Rails and ActiveRecord🚄Top 50 System Design Terminologies You Must Know📚Netflix’s Distributed Counter Abstraction📊But there’s more, so dive right in.Stay Awesome!Divya Anne SelvarajEditor-in-ChiefP.S.:This month'ssurveyis now live. Do take the opportunity to leave us your feedback, request a learning resource, and earn your one Packt credit for this month.Sign Up|Advertise🗞️News and Analysis🔎.NET 9 is now available with several performance improvements:The version introduces a 15% increase in requests per second, optimized Server GC, faster LINQ operations, and a 50% boost in System.Text.Jsonprocessing.Java 24 to Reduce Object Header Size and Save Memory: This optimization is part of Project Lilliput and aims to improve memory density, reduce garbage collection pressure, and benefit workloads with small object sizes.Go language rises in Tiobe popularity index: The Google-developed Go language has reached its highest rank, seventh, in November 2024. Go aims to overtake JavaScript (ranked sixth) within three years.OpenJDK News Roundup: Instance Main Methods, Flexible Constructor Bodies, Module Import Declarations: With 19 JEPs targeted so far, JDK 24 is set for release in March 2025, featuring a robust set of updates aimed at performance, security, and language flexibility.The US government wants developers to stop using C and C++: While CISA mandates roadmaps for migration by 2026, widespread adoption is unlikely in the near future due to resistance, cost, and existing industry priorities.GitHub Copilot chat now provides guidance on rewording prompts: The updated chat suggests more specific prompts when a query lacks context, available in Visual Studio 2022 17.12 Preview 3 and aboveCloudflare Advocates for Broader Adoption of security.txt Standard for Vulnerability Reporting: Cloudflare has introduced a dashboard to create and manage security.txt files for vulnerability reporting, aligning with the RFC9116.🎓Tutorials and Learning Resources💡Python💡20 Python scripts to automate common daily tasks:Lists scripts for tasks such as sending emails, scraping news, downloading stock prices, backing up files, posting to social media, fetching weather updates, and resizing images.For more Python resources, go to PythonProC# and .NET🎓Tutorial | Pushed Authorization Requests (PAR) in ASP.NET Core 9: Explains how the new support for PAR enhances security in OAuth and OpenID Connect by moving sensitive data to secure back-channel requests.💡You Probably Don’t Need Those Interfaces: Challenges the common practice of using interfaces for every dependency, arguing that interfaces may be unnecessary for unit testing (due to modern mocking frameworks).🎓Tutorial | Implementing the Repository Pattern with Multiple Databases in C# Clean Architecture: Demonstrates using separate DbContext instances for different data types and a RepositoryFactory .C and C++🗞️A new chapter, and thoughts on a pivotal year for C++: Herb Sutter, the ISO C++ committee chair, has joined Citadel Securities, where he will lead C++ training and strategy while continuing his C++ standards work.🎓Tutorial | Around the World in C++: Exploring Time Zones with std::chrono: Explores time zone handling using C++20’s <chrono> library, demonstrating how to identify unusual time zones with non-hour UTC offsets.🧾The Design of a Self-Compiling C Transpiler Targeting POSIX Shell: Presents pnut, a C-to-POSIX shell transpiler designed to counteract software supply chain risks by enabling reproducible builds without relying on precompiled binaries.Java📖Open Access Book | Modern Java by Ethan McCue: Provides a structured introduction to Java, covering basics like data types, control flow, and methods, then progressing to complex topics such as classes and data structures.🎓Tutorial | How to Handle Errors Cleanly in Java: Principles for Scalable, Maintainable Code: Covers using custom exceptions, avoiding generic catch-all blocks, leveraging checked exceptions, and utilizing Optional to handle nulls.🎓Tutorial | Creating GenAI Apps in Java with SD4J (Stable Diffusion for Java) and the ONNX Runtime — Part 1: Details the setup of prerequisites such as JDK, ONNX Runtime, and Hugging Face tools, followed by step-by-step instructions to generate custom images from text prompts.JavaScript and TypeScript🎓Tutorial | JavaScript's ??= Operator: Default Values Made Simple: Explains the operator'sfunctionality, benefits over previous methods, and practical use cases for retaining meaningful falsy values.🎓Tutorial | Generating Random Mazes with JavaScript: Walks you through building a random maze generator in JavaScript using a three-step process with tips on handling blocked paths and using helper functions to manage grid cells.🎓Tutorial | Exploring Effect in TypeScript: Simplifying Async and Error Handling: Showcases how Effect can replace multiple libraries like Zod and Lodash, improving code readability and robustness in complex applications.Go🎓Tutorial | Functional programming in Go: Focuses on using functions as the primary control structures, enabling operations likemap,filter, andreduceto simplify and streamline data processing tasks.🎓Tutorial | ML in Go with a Python sidecar: Explores using ML in Go applications, focusing on techniques to integrate Python-based ML models, from cloud-based APIs to local sidecar servers.Rust💼Case Study | Why I love Rust for tokenising and parsing: Covers the author’s development experience using Rust to buildsqleibniz , a static analysis tool for SQLite, focusing on Rust’s macro system, testing frameworks, and more.🎓Tutorial | How to rewrite a C++ codebase successfully: Provides a structured guide for incrementally rewriting a legacy C++ codebase in Rust, focusing on real-world challenges such as cross-platform compatibility.Swift🎓Tutorial | Migrating to Swift 6: Provides a comprehensive framework for migration, including strategies for enabling concurrency checking, resolving common compiler errors, and incrementally adopting concurrency features.💡Problematic Swift Concurrency Patterns: Highlights common pitfalls and patterns to avoid when using Swift’s concurrency features, addressing issues like split isolation, excessive reliance on Task.detached , and more.PHP💡New error messages in PHP 8.4: Key updates include stricter handling of nullable parameters, limitations on unsetting hooked properties, and clearer messaging on invalid operations.SQL🎓Tutorial | 8 Steps in Writing Analytical SQL Queries: Steps covered include defining goals in plain language, inspecting and confirming basic data, incrementally adding joins without calculations, and using CTEs for summations.Ruby🎓Tutorial | Optimize Database Performance in Ruby on Rails and ActiveRecord: Covers best practices in ActiveRecord query optimization, indexing, reducing N+1 queries, batching, and caching techniques.💼Case Study | How we made a Ruby method 200x faster: Details how the team at Campsite identified and resolved a specific performance issue in their codebase, providing insights into their debugging process.Kotlin🎓Tutorial | Modeling ViewModel State in Android: A Guide to Clean, Scalable Patterns: Critiques using plain data classes with multiple Boolean flags, as this approach can lead to conflicting states and increased boilerplate.🌟Best Practices and Advice🚀Efficient Resource Management with Small Language Models (SLMs) in Edge Computing: Covers model optimization, latency reduction, and memory efficiency to support AI capabilities on limited hardware.Netflix’s Distributed Counter Abstraction: Delves into Netflix's Distributed Counter Abstraction, a system that enables high-throughput, low-latency counting within distributed applications.Top 50 System Design Terminologies You Must Know: Outlines essential system design terms covering key concepts like scalability, microservices, CAP theorem, sharding, and more.📖Open Access Book | Architectural Metapatterns by Denys Poltorak: Delves into over a hundred architectural patterns and structures, such as monoliths, layers, services, proxies, orchestrators, and more.🧠Expert Insight📚Here’s an excerpt from “Chapter 4: Domain Decomposition" in the book, The Art of Micro Frontends - Second EditionbyFlorian Rappl, published in October 2024.Principles of DDDThe idea of DDD was first popularized by Eric Evans. In his book, he describes the basic pillars that form DDD, according to his vision. While the book certainly has a lot of truth to it, the entire army of ideas was probably rarely—if ever—realized in real-world projects. Let’s try to distill the most importantideas for our use inmicro frontends.When we refer to DDD in the context of micro frontends, we will not include parts such as value objects or the need for a ubiquitous language. Instead, we almost exclusively take DDD as a blueprint to help us with the followingtwo things:Defining micro frontends withclear boundariesComing up with a strategy to establishthese boundariesWhile DDD uses the wordmodules, which was back then an alias forpackages, we will refer to this unit as amicro frontend. The other thing that DDD introduces is a so-called bounded context. Finally, DDD defines a context map to make sense of it. But let’s back off and look at eacharea separately.ModulesAmoduleserves as a container for a specific set of functionalities in your application. For a web application, this could relate to a full page or parts of a page. For instance, a module dealing with the order process could be responsible for showing a cart symbol on the pages of a web shop, such as the product catalog orproduct details.As mentioned, a module in DDD is usually what we will bring to the table in the form of a micro frontend. Nevertheless, keeping to a general notation here makes sense; after all, this helps us to see that good architectures rarely have anything to do with specific implementations but actually would work in multiple variants. In micro frontends, the functionality will be mostly designedaround components.A module is, however, a part of the full problem domain, focused on a specific area (or subdomain). The general design principles for modules are low coupling and high cohesion. As such, a micro frontend should represent a single unit to solve one problem without relying on any other microfrontend directly.In reality, we will be tempted to rely on other micro frontends to simplify the code. The one strong advice here is to avoid doing that, as the immediate simplification will usually backfire in a more complicated and less flexible solution later. When we start looking at the different architectural patterns later inChapter 7onward, we’ll see how to decouple themicro frontends.To help us figure out what could be part of a module, DDD introduces the theoretical concept of abounded context.Bounded contextAbounded contextis used to define the boundaries of the functionality of a subdomain. This is an area where only the functionality from a certain domainmakes sense.While this may initially seem similar to a module, it is actually quite different. Multiple modules live within the same bounded context. The bounded context is an umbrella connecting them and has nothing to do withruntime considerations.Bounded contexts are also broader than modules as they contain both unrelated concepts and shared concepts. Naturally, this will result in some overlap and duplication between differentbounded contexts.The following diagram illustrates the relationship of two bounded contexts within an exampleproblem domain:Figure 4.1 – Relation of two bounded contexts in an example problem domainHow we split a bounded context into modules is up to us. In the end, however, a more critical question is,what are the bounded contexts in our problem domain?There is no blueprint here, but a nice way to visualize and think about contexts generally is in the form of acontext map.Context mapAcontext mapis a useful tool to illustrate the involved contexts of a system, including their connections. Instead of reusing objects from other contexts, a transformation defined by the context map should be used to always createdomain-specific objects.For our design decisions, a context map can be helpful to see where sharing occurs and how to still produce isolated micro frontends. To do this, we need to first identify these self-contained domains. This is where two principal ways come into play: strategic domain design and—as an alternative—tactical design. Let’s lookat both.Strategic domain design versus tactical designWhile strategic domain design helps us to extend knowledge of a problem domain and come up with useful guidelines, tactical design tries to come up with design patterns and building blocks that form a system. In other words, strategic domain design identifies the different domains and the communication between them, while tactical design is all about structuringthese domains.In our micro frontend space, we have the choice of leaving the tactical design to the implementers of the micro frontends, giving them some guidance, or predefining a structure that needs to be followed already. We will see later on how these architectural boundaries can actuallybe decided.In contrast, strategic domain design is helpful for decomposing a full problem domain into smaller (sub) domains. Starting with a full problem domain, we derive the individual subdomains and extract their bounded contexts. The relationship between the contexts is then captured in a context map. The following diagram shows thistheoretical process:Figure 4.2 – The idealized process of deriving a full domain decomposition from a given problem domain, including a working context mapThe Art of Micro Frontends - Second Edition was published in October 2024. Packt library subscribers can continue reading the entire book for free or you can buy the bookhere!Get the eBook for $29.99$20.98🛠️Useful Tools⚒️Aide: An open-source, AI-native IDE that proactively supports developers with context-aware code edits, error fixes, and easy rollbacks.Arch: An open-source prompt gateway that helps build scalable, secure AI apps with prompt safeguards, API triggers, and built-in monitoring.Sulie: An open-source platform for advanced time series forecasting with the Mimosa foundation model, offering zero-shot and fine-tuned predictions.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 usefulhere.If your company is interested in reaching an audience of developers, software engineers, and tech decision makers, you may want toadvertise with us.If you have any suggestions or feedback, or would like us to find you a learning resource on a particular subject, take the surveyor just respond to this email!*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{color:inherit!important;text-decoration:inherit!important}#MessageViewBody a{color:inherit;text-decoration:none}p{line-height:inherit}.desktop_hide,.desktop_hide table{mso-hide:all;display:none;max-height:0;overflow:hidden}.image_block img+div{display:none}sub,sup{font-size:75%;line-height:0}#converted-body .list_block ol,#converted-body .list_block ul,.body [class~=x_list_block] ol,.body [class~=x_list_block] ul,u+.body .list_block ol,u+.body .list_block ul{padding-left:20px} @media (max-width: 100%;display:block}.mobile_hide{min-height:0;max-height:0;max-width: 100%;overflow:hidden;font-size:0}.desktop_hide,.desktop_hide table{display:table!important;max-height:none!important}}
Read more
  • 0
  • 0
  • 9262

Divya Anne Selvaraj
14 Oct 2024
Save for later

Your 2024 Guide to Mastering IoT and AI Development

Divya Anne Selvaraj
14 Oct 2024
Curated for IoT developers, AI engineers, and embedded systems specialistsYour 2024 Guide to Mastering IoT and AI DevelopmentHi ,This week, we’ve curated six exceptional books that offer practical, real-world guidance to mastering IoT, AI, and embedded systems, all published in 2024.Whether you're building intelligent robots with AI-driven decision-making, crafting custom IoT solutions from scratch, accelerating development with ChatGPT, or even creating secure automotive IoT applications, this collection equips you to design, build, and deploy cutting-edge systems with ESP32, Arduino, cloud computing, and AWS.Each of these 6 eBooks and Print books is available -- for a limited time -- at 30% or more off!Bundle up & save more!Buy 2 – save an additional 10%Buy 3 – save an additional 15%Buy 5 – save an additional 20%Print discounts end October 18th.Here’s what’s on offer:Internet of Things from Scratch byRenaldi GondosubrotoBuild IoT solutions for Industry 4.0 with ESP32, Raspberry Pi, and AWS>Build industry-grade IoT solutions.>Master wireless sensor networks, cloud integration, and security best practices.>Explore generative AI for IoT to future-proof your projects.Get the eBook for $31.99$21.99Get the Print book for $39.99 $27.98Artificial Intelligence for Robotics - Second Edition byFrancis X. Govers IIIBuild intelligent robots using ROS 2, Python, OpenCV, and AI/ML techniques for real-world tasks>Build intelligent robots using AI/ML techniques with Python and ROS 2.>Implement object recognition, reinforcement learning, and natural language processing.>Design robots that navigate autonomously and interact with real-world environments.Get the eBook for $35.99$24.99Get the Print book for $44.99 $30.99Accelerating IoT Development with ChatGPT byJun WenA practical guide to building your first IoT project using AI-assisted coding and cloud integration>Use ChatGPT to generate code for IoT projects on ESP32 and AWS.>Build 10 practical projects, from flame detection to air quality monitoring.>Master the integration of AI-assisted coding with cloud infrastructure.Get the eBook for $31.99$21.99Get the Print book for $39.99 $27.98Internet of Things Programming Projects - Second Edition byColin DowBuild exciting IoT projects using Raspberry Pi 5, Raspberry Pi Pico, and Python>Develop advanced IoT applications using Raspberry Pi 5, Pico, and Python.>Implement MQTT, LoRa, and ROS for long-range and autonomous systems.>Build projects like smart robot cars, weather indicators, and security systems.Get the eBook for $35.99$24.99Get the Print book for $44.99 $30.99Hands-on ESP32 with Arduino IDE by AsimZulfiqarUnleash the power of IoT with ESP32 and build exciting projects with this practical guide>Interface ESP32 with sensors, cameras, and displays for IoT projects.>Master Arduino IDE 2.0 for simplified IoT development.>Build automation projects, data loggers, and smart connected devices.Get the eBook for $23.99$15.99Get the Print book for $29.99 $20.98Building Secure Automotive IoT Applications byDr. Dennis Kengo Oka, Sharanukumar Nadahalli, Jeff Yost, and Ram Prasad BojankiDevelop robust IoT solutions for next-gen automotive software>Explore modern vehicle architectures and IoT use cases in automotive software.>Learn cybersecurity practices for developing secure automotive applications.>Master cloud integration, diagnostics, and functional safety processes.Get the eBook for $35.99$24.99Get the Print book for $44.99 $30.99All books are minimum 30% off, and print discounts end in 5 days on October 18th.*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{color:inherit!important;text-decoration:inherit!important}#MessageViewBody a{color:inherit;text-decoration:none}p{line-height:inherit}.desktop_hide,.desktop_hide table{mso-hide:all;display:none;max-height:0;overflow:hidden}.image_block img+div{display:none}sub,sup{line-height:0;font-size:75%}#converted-body .list_block ol,#converted-body .list_block ul,.body [class~=x_list_block] ol,.body [class~=x_list_block] ul,u+.body .list_block ol,u+.body .list_block ul{padding-left:20px} @media (max-width: 100%;display:block}.mobile_hide{min-height:0;max-height:0;max-width: 100%;overflow:hidden;font-size:0}.desktop_hide,.desktop_hide table{display:table!important;max-height:none!important}}
Read more
  • 0
  • 0
  • 8739

Divya Anne Selvaraj
07 Oct 2024
Save for later

Python Must-Reads from September 2024

Divya Anne Selvaraj
07 Oct 2024
Curated for cybersecurity experts, data scientists, web developers, and NLP enthusiasts.Python Must-Reads from September 2024Hi ,This week, we’ve handpicked five standout Python titles for you, all published in September 2024.Whether you're securing networks with Python automation, cleaning and preparing data for analysis, streamlining workflows with Apache Arrow, building web apps, or diving into the power of natural language processing, these new releases offer the guidance you need.Each of these 5 eBook's and Print books is available -- for a limited time -- at 30% or more off!Bundle up & save more!Buy 2 – save an additional 10%Buy 3 – save an additional 15%Buy 5 – save an additional 20%Print discounts end October 11th.Here’s what’s on offer:Offensive Security Using Python by Rejah Rehim and Manindar MohanA hands-on guide to offensive tactics and threat mitigation using practical strategies>Defend. Attack. Automate.>Dive deep into cybersecurity tactics with Python, exploit vulnerabilities, and code securely.>A go-to guide for staying ahead in digital defence.Get the eBook for $39.99$27.98Get the Print book for $49.99 $34.98Python Natural Language Processing Cookbook - Second Edition byZhenya Antić and Saurabh ChakravartyOver 60 recipes for building powerful NLP solutions using Python and LLM libraries>Unlock NLP’s full power.>Recipes packed with practical insights, from text analysis to working with the latest LLMs like GPT-4 and OpenAI.>Real-world NLP mastery awaits.Get the eBook for $35.99$17.99Get the Print book for $44.99 $30.99Python Data Cleaning and Preparation Best Practices byMaria ZervouA practical guide to organizing and handling data from various sources and formats using Python>Turn raw data into gold.Learn to clean, validate, and prepare both structured and unstructured data.>Transform your pipelines and make your data truly actionable.Get the eBook for $35.99$24.99Get the Print book for $44.99 $30.99In-Memory Analytics with Apache Arrow - Second Edition byMatthew TopolAccelerate data analytics for efficient processing of flat and hierarchical data structures>Boost your analytics.>Discover how Apache Arrow makes data processing lightning-fast.>Perfect for data engineers and analysts seeking seamless integration and peak performance.Get the eBook for $39.99$27.98Get the Print book for $49.99 $34.98Django 5 for the Impatient - Second Edition byDaniel Correa and Greg LimLearn the core concepts of Django to develop Python web applications>Build fast. Launch faster.>Create responsive web apps with Django 5 and deploy them effortlessly.>The fast lane to full-stack web development starts here.Get the eBook for $27.99$18.99Get the Print book for $34.99 $23.99All books are minimum 30% off, and print discounts end in 5 days on October 11th.*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{color:inherit!important;text-decoration:inherit!important}#MessageViewBody a{color:inherit;text-decoration:none}p{line-height:inherit}.desktop_hide,.desktop_hide table{mso-hide:all;display:none;max-height:0;overflow:hidden}.image_block img+div{display:none}sub,sup{line-height:0;font-size:75%}#converted-body .list_block ol,#converted-body .list_block ul,.body [class~=x_list_block] ol,.body [class~=x_list_block] ul,u+.body .list_block ol,u+.body .list_block ul{padding-left:20px} @media (max-width: 100%;display:block}.mobile_hide{min-height:0;max-height:0;max-width: 100%;overflow:hidden;font-size:0}.desktop_hide,.desktop_hide table{display:table!important;max-height:none!important}}
Read more
  • 0
  • 0
  • 6559

Divya Anne Selvaraj
10 Oct 2024
Save for later

ProgrammingPro #77: Python 3.13 Finally Debuts, Rspack 1.0, and Importing Arrow Data with Python

Divya Anne Selvaraj
10 Oct 2024
Bite-sized actionable content, practical tutorials, and resources for programmers#77Secure and Simplify: Salesforce Data Protection with RubrikWhat if your Salesforce data was suddenly lost or corrupted? Human errors, accidental deletions, misconfigurations can all contribute to data loss.1 of 2 SaaS users who did not implement SaaS data protection, experienced data loss or corruption in the last 12 months.Check out this exclusive webinar where we reveal Rubrik's new integration with Salesforce, designed to tackle this exact issue.Watch On-DemandHi ,Welcome to this week’s edition of ProgrammingPro!In today’sExpert Insight, we bring you an excerpt from the recently published book, In-Memory Analytics with Apache Arrow - Second Edition, which shows you how to import Arrow data with Python using the C Data API via the pyarrow and cffi modules.News Highlights: Python 3.13 finally debuts with GIL disabling and JIT compiler; Rust firm at 13th in Tiobe, Mojo enters top 50; Rspack 1.0 is 23x faster than Webpack; and Julia 1.11 introduces a faster, lower-overhead Memory type.My top 5 picks from today’s learning resources:10 Jupyter Notebook Features You Didn’t Know Exist📓Reflection in C++26: Metafunctions for Enums and Classes💻The #1 Mistake Developers Make with Redux and How to Fix It🚧Confusing or misunderstood topics in systems programming: Part 0🧩Brutalist Programming Manifesto🛠️But there’s more, so dive right in.Stay Awesome!Divya Anne SelvarajEditor-in-ChiefPS:The October survey is still live. Do take the opportunity to leave us your feedback, request a learning resource, and earn your one Packt credit for this month.Sign Up|Advertise🗞️News and Analysis🔎Breaking Down Python 3.13’s Latest Features:Released finally on the 7th of October, the version includes a revamped interactive interpreter with multi-line editing, experimental disabling of the GIL, and a JIT compiler.Rust resumes rise in popularity: Rust has returned to 13th place in the October 2024 Tiobe index and maintained 10th in the Pypl index. Mojo has also entered Tiobe's top 50. Read to learn more about current rankings.Rspack 1.0 Released, 23x Faster than Webpack, Compatible with Top 50 Webpack Plugins: Rspack 1.0, a JavaScript bundler written in Rust from ByteDance, is compatible with over 80% of the top 50 Webpack plugins.Julia language adds lower-overhead Memory type: Julia 1.11 introduces a new Memory type as a lower-overhead alternative to Array, offering significant speed improvements and more maintainable code.Apollo Connectors enables developers to turn REST APIs into GraphQL endpoints: Apollo Connectors simplifies API integration, reduces complexity, and enables a unified API strategy.UNO Platform 5.4 Improves App Performance: The version introduces over 290 new features and enhancements focused on improving app performance, including a 15% reduction in memory allocations.ChatGPT Canvas offers a new visual interface for working with ChatGPT in a more collaborative way: The new offering, currently rolling out to select users, enhances collaboration on writing and coding projects.🎓Tutorials and Learning Resources💡Python10 Jupyter Notebook Features You Didn’t Know Exist:Discusses features including magic commands, interactive widgets, auto-reload for modules, in-notebook documentation, and collapsible headings.For more Python resources, go to PythonProSeptember Python Releases from Packt at 30% offon both eBook and Print BooksGet for $39.99 $27.98!Get for $35.99 $24.99!Get for $27.99 $18.99!Get for $35.99 $17.98!Print discounts end tomorrow on the 11th of October!C# and .NETMicrosoft previews unified .NET API for AI, and delivers .NET 9 Release Candidate with go-live license: The AI extension library aims to standardize interactions with AI services, allowing developers to work with a common API.🎓Tutorial | How to Use StateContainers in .NET MAUI to Manage State in Applications: Explains how to implement StateContainers with code examples and a demo for handling user authentication.🎓Tutorial | Dispose or Finalize in C#? Discover which to use: Provides real-world examples, such as file handling, database connections, and graphics processing, to demonstrate when to use each method.C and C++🎓Tutorial | Reflection in C++26: Metafunctions for Enums and Classes: Demonstrates how developers can use reflection to iterate through enum members and retrieve class members by index or name.Iterating through matched characters in modern C++: Explores using approaches like find_first_of, std::ranges from C++20, and coroutines from C++23.Privileges relinquishing order in C: Explains the correct order for relinquishing privileges in C programs, specifically for setUID and setGID operations, to prevent security vulnerabilities.JavaOracle touts ‘tip and tail’ release model for Java library development: The model, aimed at improving the developer experience allows faster innovation for new development while maintaining stability for long-term projects.🎓Tutorial | Event-driven architecture (EDA) on the modern stack of Java technologies: Explores the implementation of an EDA focusing on Transactional outbox, Inbox, and Saga patterns in microservices.Java 23 New Features With Examples: Covers improvements like primitive type support in patterns, instanceof, and switch statements, the introduction of Markdown documentation comments, and enhancements to concurrency.JavaScript and TypeScript🎓Tutorial | The #1 Mistake Developers Make with Redux and How to Fix It: Discusses the common mistake of overusing Redux, explains the difference between client and server state, and shows you the benefits of React Query.Behind the Scenes at the JavaScript Registry (JSR): Discusses JSR, a modern open-source package repository for JavaScript and TypeScript that offers features like type declaration files, secure publishing, and more.Announcing TypeScript 5.7 Beta: New features include checks for never-initialized variables, path rewriting for relative paths, support for ES2024, faster project ownership checks, JSON import validation, and improved performance.Go🎓Tutorial | Securing gRPC Services with JWT Authentication in Go: Explains how to secure gRPC services using JSON Web Tokens (JWT) authentication in Go, focusing on interceptors, metadata, and JWT handling.The Go libraries that never failed us: 22 libraries you need to know: Lists libraries for routing, middleware, database management, OpenAPI, gRPC, testing, and more, while offering anti-pattern warnings and practical tips.Rust💼Case Study | Rust is rolling off the Volvo assembly line: Discusses how Volvo successfully integrated Rust into the development of their low-power processor ECU, improving code quality and reliability in their vehicles.🎓Tutorial | Understanding Rust's Trait Objects: Vtables, Dynamic Dispatch, and Memory Deallocation: Explains how vtables store method pointers for trait objects, how TCO optimizes performance, and more.Swift🎥Swift & Interoperability - Tony Parker & Ben Cohen: Introduces the new direction for Swift's Foundation, including a major refactor of Foundation for Swift 6, enabling open-source contributions, and transitioning from C to Swift.🎓Tutorial | Writing Cleaner Swift Code: Early Returns & Aligning the Happy Path Left: Explains how handling edge cases upfront and reducing nesting, results in cleaner, more maintainable code with reduced cognitive load.PHP👨‍🏫Open Access Course | Laravel API Course: Covers topics like optimizing a Laravel project for API-first development, data modeling, API design, authentication, rate limiting, versioning, pagination, error handling, and more.SQL🎓Tutorial | Advanced SQL for 10x Data Analysts - Part 1: Explores advanced SQL techniques, focusing on joins, nested data, analytical functions, and efficient query writing.RubyRuby on Rails 8.0 first beta release: A big bet on SQLite in production: The release promotes using SQLite in production environments for various features, including caching, queuing, and as the primary database.Ruby 3.4.0 preview2 Released: The version introduces features like switching to the Prism parser, language changes, core class updates, and C API improvements.Kotlin🎓Tutorial | How Functional Programming Can Help You Write Efficient, Elegant Web Applications: Includes code examples and practical guidance on topics like pure functions, function composition, and functional DI.🌟Best Practices and Advice🚀Proactive Approaches to Securing Linux Systems and Engineering Applications: Key approaches discussed include dynamic vulnerability confirmation, regular security audits, and comprehensive patch management.Brutalist Programming Manifesto: Advocates for simplicity, self-reliance, solving real problems, avoiding unnecessary complexity, and encouraging independent, practical thinking in software development.Confusing or misunderstood topics in systems programming: Part 0: Explains complex systems programming concepts like processes, context switching, and the kernel in a clear, beginner-friendly way.🎥Tacit Talk Episode 5: Combinatory Programming with Zach Smith: Explores how functional programming concepts such as combinatory and tacit programming, can simplify code and improve readability.🧠Expert Insight📚Here’s an excerpt from “Chapter 4: Crossing the Language Barrier with the Arrow C Data API” in the book, In-Memory Analytics with Apache Arrow - Second Edition by Matthew Topol, published in September 2024.Importing Arrow data with PythonThe common terminology for runtimes providing an interface for calling an API of another runtime or language is an FFI. In Python, we’re going to use a library called cffi , which is used by the pyarrow module to implement the Cdata API. Make sure that you’re running the script we’re about to write in the same directory as the libsample.solibrary file that we created in theprevious exercise:First, the imports – the following highlighted line represents the essential case that we’re importing the already compiledffilibrary that is part of thepyarrow module:import pyarrow as pafrom pyarrow.cffi import ffiThere are a few different ways to integrate the FFI module, but for the purposes of this exercise, we’re going to use dynamic loading of the library with the defined interface through thecdeffunction. Then, we’ll load our shared object librarywithdlopen:ffi.cdef("void export_int32_data( struct ArrowArray*);")lib = ffi.dlopen("./libsample.so")Note that this matches ourextern "C"declarationfrom before.Now, we can create anArrowArraystruct and call the function we exported topopulate it:c_arr = ffi.new("struct ArrowArray*")c_ptr = int(ffi.cast("uintptr_t", c_arr))lib.export_int32_data(c_arr)Then, we use thepyarrowmodule to import data. Remember that since we’re passing around pointers, there’s no copying of the data buffers. So, it doesn’t matter whether this array has 1,000 elements or 1 million elements; we’re not copying the data here. Importing the data is just hooking everything up to point to the right areasin memory:arrnew = pa.Array._import_from_c(c_ptr, pa.int32())# do stuff with the arraydel arrnew # will call the release callback # once it is garbage collectedYou can add aprintstatement in there if you like, to confirm that it is actually working as intended. That’s it. The library we created could create that array of data in any way we want, but as long as it properly populates the C struct, we’re able to pass the data around in the Arrow format without having tocopy it.What if we wanted to work in the other direction? We can read in our data with Python and then hand it off to something faster for processing, similar to how Spark used JPype to communicate the data from Python to Java without copying. How would we go aboutdoing that?Memory Analytics with Apache Arrow - Second Editionwas published in September 2024. Packt library subscribers can continue reading the entire book for free or you can buy the bookhere!Get the eBook for $39.99$27.98Get the Print book for $49.99 $34.98🛠️Useful Tools⚒️Drasi: Microsoft's open-source system for real-time change detection and automated reactions in dynamic systems.One:a React framework on Vite, streamlining web and native app development with universal routing and seamless data management.agents: a real-time AI framework for processing text, audio, images, and video, with OpenAI Realtime API support and plugins for popular LLMs.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 usefulhere.If your company is interested in reaching an audience of developers, software engineers, and tech decision makers, you may want toadvertise with us.*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{color:inherit!important;text-decoration:inherit!important}#MessageViewBody a{color:inherit;text-decoration:none}p{line-height:inherit}.desktop_hide,.desktop_hide table{mso-hide:all;display:none;max-height:0;overflow:hidden}.image_block img+div{display:none}sub,sup{line-height:0;font-size:75%}#converted-body .list_block ol,#converted-body .list_block ul,.body [class~=x_list_block] ol,.body [class~=x_list_block] ul,u+.body .list_block ol,u+.body .list_block ul{padding-left:20px} @media (max-width: 100%;display:block}.mobile_hide{min-height:0;max-height:0;max-width: 100%;overflow:hidden;font-size:0}.desktop_hide,.desktop_hide table{display:table!important;max-height:none!important}}
Read more
  • 0
  • 0
  • 6546
Divya Anne Selvaraj
07 Nov 2024
Save for later

ProgrammingPro #81: Debugging Linux Scripts, Tabnine's Code Review Agent, and Zed Editor's SSH Remoting

Divya Anne Selvaraj
07 Nov 2024
Bite-sized actionable content, practical tutorials, and resources for programmers#81Debugging Linux Scripts, Tabnine's Code Review Agent, and Zed Editor's SSH RemotingHi ,Welcome to this week’s edition of ProgrammingPro!In today’sExpert Insight, we bring you an excerpt from the recently published book, The Ultimate Linux Shell Scripting Guide, which explains how to use -u and set -u in shell scripts to identify uninitialized variables and prevent related errors during debugging.News Highlights:Zed editor adds SSH remoting for faster remote workflows; IBM’s AI agents automate GitHub issue resolution; Java’s JEP 491 boosts concurrency with virtual thread improvements; and Tabnine’s Code Review Agent enforces custom coding standards.My top 5 picks from today’s learning resources:Hidden Python Libraries That Will Blow Your Mind✨The magic of keeping one level of abstraction per function🎩Writing secure Go code🐹Being a Responsible Developer in the Age of AI Hype⚖️Using certifications to level up your development career🏆But there’s more, so dive right in.Stay Awesome!Divya Anne SelvarajEditor-in-Chief🚀Join this 3-hour AI Workshop (worth $399) - FREE for ProgrammingPro readers to learn AI strategies & hacks to 10X work output and grow your business.🗓️ Tomorrow | ⏱️ 10 AM ESTClick here to register (FREE for the First 100 people only)!Sign Up|Advertise🗞️News and Analysis🔎Rust-based Zed editor preview adds direct SSH remoting, a key feature for potential VS Code switchers: Zed emphasizes speed, performance, and real-time collaboration, appealing to developers seeking a faster, lighter alternative.Tabnine’s new Code Review Agent validates code based on a dev team’s unique best practices and standards: The agent is an AI tool that validates code, flags issues during code reviews, and offers fixes.IBM releases open AI agents for resolving GitHub issues: IBM’s SWE-Agent 1.0, a set of AI-powered open agents, automates GitHub issue resolution, helping developers by localizing, suggesting fixes, and executing tests.Java Evolves to Tackle Virtual Threads Pinning with JEP 491: The change would improve scalability and performance in highly concurrent applications by allowing threads to unmount from platform threads during synchronization.Apache Tomcat 11.0 Delivers Support for Virtual Threads and Jakarta EE 11: The update enhances concurrency, scalability, and security for modern web applications, with upgrades in WebSocket and Servlet performance.Microsoft Introduces Modern Web App Pattern for .NET: Accelerating App Modernization to the Cloud: The pattern guides developers in transforming monolithic applications to cloud-native architectures with a focus on scalability.Amazon Q Developer is not just for coding and not just for AWS, claims cloud giant:It includes features like multi-file edits, unit testing, and security scanning, and plans to add support for Eclipse IDE.🎓Tutorials and Learning Resources💡PythonHidden Python Libraries That Will Blow Your Mind:Introduces six powerful yet lesser-known Python libraries including Streamlit for quick app-building, PyWhatKit for task automation, and Typer for simplified CLIs.For more Python resources, go to PythonProC# and .NET🎓Tutorial | Unlocking the Power of GitHub Models in .NET with Semantic Kernel: Explains how to set up necessary packages, configure access with GitHub tokens, establish a Semantic Kernel client, and run a chat-based application.🎓Tutorial | eShop infused with AI – a comprehensive intelligent app sample: Demonstrates how to integrate AI functionalities like semantic search, summarization, classification, and sentiment analysis into business applications.🎓Tutorial | How to prevent XSS Attacks in ASP.NET Core Web API: Covers essential practices such as input validation, output encoding, and advanced measures like Content Security Policy (CSP) and secure cookies.C and C++🎓Tutorial | Deep Threads Diving Into The Core Of Concurrent Programming With C: Covers core concepts like threads vs. processes, key functions in POSIX threads (pthreads), and synchronization techniques.📖Open Access Book | Is Parallel Programming Hard, And, If So, What Can You Do About It?: Serves as a guide for programming shared-memory parallel systems, offering foundational techniques to prevent common pitfalls.C++, Complexity, and Compiler Bugs: Explores challenges such as temporary lifetime extension, differences in designated initializers between C++ and C, and inconsistent handling of template disambiguation across compilers.JavaJava-Based No-Code and Low-Code Application Bootstrapping Tools: Reviews four Java-based no-code and low-code platforms: Appsmith, Wavemaker, Openkoda, and JHipster.🎓Tutorial | Building thread-safe abstractions in Java versus Go: Through examples, the author compares Java's synchronized keyword for mutual exclusion with Go’s sync.Mutex and channels, showcasing adaptations needed.🎓Tutorial | Server-Side Rendering with Spring Boot: Explains how to use WebJars for managing client-side dependencies via Maven and Thymeleaf for server-side rendering in Spring Boot.JavaScript and TypeScript🎓Tutorial | The magic of keeping one level of abstraction per function: Advocates for breaking down complex tasks into focused, smaller functions, to achieve cleaner code that is easier to update, reuse, and understand.Summary of the AJAX frameworks comparison: Compares Vue.js, Alpine.js, HTMX, and Vaadin—across frontend skills required, team integration, setup ease, and styling flexibility.20 TypeScript Tips for Cleaner, More Efficient Code in 2024: Tips include NonNullable, Partial, Readonly, Mapped Types, Union Exhaustiveness, and Generics, with practical examples demonstrating each.Go🎓Tutorial | Writing secure Go code: Covers tools like go vet, staticcheck, golangci-lint, govulncheck, and gosec which support code analysis and vulnerability detection, and fuzz testing which helps find security flaws.🎓Tutorial | Ranging over functions in Go 1.23: Introduces Go 1.23’s new feature allowing for-range iteration over functions, enhancing custom container iteration without exposing internal data structures.RustRust's Most Subtle Syntax: Explores how Rust’s pattern-matching rules with constants can introduce subtle bugs, especially if naming conventions aren’t followed consistently.Bringing faster exceptions to Rust: Explores speeding up Rust’s panic handling by optimizing the unwinding mechanism, resulting in a 4.3x speed improvement without changing the Rust compiler or system unwinder.Swift🎓Tutorial | swift-format GitHub Action: Covers setting up swift-format as a GitHub Action to automate linting and formatting for Swift projects, including configuration tips and integration with Xcode 16.🎓Tutorial | How to Use URLSession with Async/Await for Network Requests in Swift: Covers GET and POST methods, adding parameters, and decoding JSON responses into Swift structs.PHP🎥🎓Tutorial | Laravel for Beginners:This video series offers a step-by-step introduction to Laravel, covering essentials like setting up, routing, views, Blade directives, layouts, components, and CSS integration with Tailwind.SQL🎓Tutorial | Advanced SQL for Data Professionals: Covers common table expressions (CTEs) for recursive queries, methods to remove duplicates, ways to identify new records, strategies for filling gaps in data, and more.Ruby🎓Tutorial | Understanding Ruby 3.3 Concurrency: A Comprehensive Guide: Covers Threads, Fibers, and Ractors, explaining each's distinct use cases, performance trade-offs, and resource utilization.Kotlin🎓Tutorial | Serializing SQL: Building Serializable Data Classes in Kotlin: Describes building a system in Kotlin to serialize SQL queries into data classes using JSON, enabling dynamic SQL functions like SUM, and COUNT.🌟Best Practices and Advice🚀Cell-Based Architecture Adoption Guidelines: Outlines guidelines for adopting cell-based architecture, a strategy that enhances system resilience by isolating failures, ideal for high-availability systems.Being a Responsible Developer in the Age of AI Hype: Discusses recognizing that AI models like LLMs generate plausible text rather than true reasoning, questioning claims of AI’s capabilities, and addressing biases and ethical risks.A deep look into our new massive multitenant architecture: Explores the the architectural overhaul undertaken by Glauber Costa's team at Turso, focusing on adopting Deterministic Simulation Testing (DST).Using certifications to level up your development career: Explains how obtaining relevant, vendor-neutral certifications can boost developers' careers by validating their skills, improving job prospects, and potentially increasing pay.🧠Expert Insight📚Here’s an excerpt from “Chapter 21: Debugging Shell Scripts" in the book, The Ultimate Linux Shell Scripting Guide byDonald A. Tevault, published in October 2024.Checking for Undefined VariablesAs I said at the beginning of this chapter, in theUnderstanding Common Scripting Errors section, it’s sometimes desirable to define a variable in a script without assigning an initial value to it. But, sometimes it isn’t. You can track down uninitialized variables by appending a -uto the end of your shebang line.In bashfor example, you can use#!/bin/bash -u, which will turn this feature on for the entire script. Or, you can place aset -u command any place in the script where you’d like to start checking. For example, let’s look at the unassigned_var1.sh script, which has variable checking turned off:#!/bin/bashecho "The uninitialized myvar, without setting -u, looks like this : " $myvarechomyvar=Donnieecho "I've just initialized myvar."echo "The value of myvar is: " $myvarHere’s the output:donnie@fedora:~$ ./unassigned_var1.shThe uninitialized myvar, without setting -u, looks like this :I've just initialized myvar.The value of myvar is: Donniedonnie@fedora:~$As you see, without the-usetting, the script runs to completion. It’s just that trying to echo the value of the uninitializedmyvarjust shows us a blank space. Next, let’s turn on variable checking by adding the-u option, as you see in the unassigned_var2.sh script:#!/bin/bash -uecho "The uninitialized myvar, without setting -u, looks like this : " $myvarechomyvar=Donnieecho "I've just initialized myvar."echo "The value of myvar is: " $myvarLet’s see what this does:donnie@fedora:~$ ./unassigned_var2.sh./unassigned_var2.sh: line 2: myvar: unbound variabledonnie@fedora:~$This time the script failed as soon as it saw the uninitialized variable.You can set the-uoption anywhere in the script you like, by usingset -u, as you see here in theunassigned_var3.shscript:#!/bin/bashecho "The uninitialized myvar, without setting -u, looks like this : " $myvarechoecho "I'm now setting -u."set -umyvar=Donnieecho "I've just initialized myvar."echo "The value of myvar is: " $myvarechoecho "Let's now try another uninitialized variable."echo "Here's the uninitialized " $myvar2So now, I have one uninitialized variable at the top, on line 2. (Let’s just say that for whatever reason, I want this particular variable to be uninitialized.) I then turn on variable checking on line 5. Let’s see how this runs:donnie@fedora:~$ ./unassigned_var3.shThe uninitialized myvar, without setting -u, looks like this :I'm now setting -u.I've just initialized myvar.The value of myvar is: DonnieLet's now try another uninitialized variable../unassigned_var3.sh: line 11: myvar2: unbound variabledonnie@fedora:~$Before I turn on variable checking, the uninitializedmyvarjust shows us a blank space. After I turn on variable checking, I initializedmyvarwith a value ofDonnie, and it prints out normally. But, the uninitializedmyvar2at the end crashes the script.NOTE:If you search the web for shell scripting security tutorials, you’ll find several that tell you to make either -uorset -ua permanent part of your scripts. The authors of these tutorials say that it enhances the security of your scripts, without giving any convincing explanation of why or how. Using-uorset -uis great for debugging, but it should only be used for just that—debugging! So, when you’re through debugging your scripts, be sure to remove the-uor theset -ubefore you place the script into production. Otherwise, your scripts could give you some rather unpredictable results.Also, be aware that using-ucan also help you detect typos in your scripts. For example, if you define a variable asmynum=1, but accidentally call back the value with$mymum, the-uwill detect thatmymumis an unset variable.The Ultimate Linux Shell Scripting Guidewas published in October 2024. Packt library subscribers can continue reading the entire book for free or you can buy the bookhere!Get the eBook for $43.99$29.99🛠️Useful Tools⚒️PipelineDP4j: Google’s open-source JVM library for differential privacy in Java, Kotlin, and Scala, supporting Apache Beam.Whirlwind: A high-performance, asynchronous sharded HashMap in Rust for thread-safe, concurrent data access.Modus: An open-source, serverless framework for fast APIs and AI functions using WebAssembly, with support for AssemblyScript and Go.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 usefulhere.If your company is interested in reaching an audience of developers, software engineers, and tech decision makers, you may want toadvertise with us.*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{color:inherit!important;text-decoration:inherit!important}#MessageViewBody a{color:inherit;text-decoration:none}p{line-height:inherit}.desktop_hide,.desktop_hide table{mso-hide:all;display:none;max-height:0;overflow:hidden}.image_block img+div{display:none}sub,sup{font-size:75%;line-height:0}#converted-body .list_block ol,#converted-body .list_block ul,.body [class~=x_list_block] ol,.body [class~=x_list_block] ul,u+.body .list_block ol,u+.body .list_block ul{padding-left:20px} @media (max-width: 100%;display:block}.mobile_hide{min-height:0;max-height:0;max-width: 100%;overflow:hidden;font-size:0}.desktop_hide,.desktop_hide table{display:table!important;max-height:none!important}}
Read more
  • 0
  • 0
  • 6123

Divya Anne Selvaraj
06 Mar 2025
Save for later

ProgrammingPro #92: ByteDance's Trae AI Code Editor, Malicious Go Packages, Building AI Agents, and GPU Architecture

Divya Anne Selvaraj
06 Mar 2025
Bite-sized actionable content, practical tutorials, and resources for programmers#92:ByteDance's Trae AI Code Editor, Malicious Go Packages, Building AI Agents, and GPU ArchitectureHi ,Welcome to a brand new issue of ProgrammingPro.In today’sExpert Insight, we bring you an excerpt from the recently published book, TypeScript 5 Design Patterns and Best Practices, Second Edition, which discusses how developers transitioning from Java or Go often bring non-idiomatic patterns—such as Java’s verbose POJOs or Go’s explicit error-checking—both of which TypeScript simplifies with interfaces, factory functions, and exception handling.News Highlights: ByteDance launches Trae, an AI-powered code editor with free DeepSeek R1 and Claude 3.7 Sonnet access; GitHub expands Advanced Security tools to Team subscribers; major AI updates include OpenAI's GPT-4.5 preview and Claude Code; and seven malicious Go packages deploy malware on Linux and macOS.My top 5 picks from today’s learning resources:How to boost Python program performance with Zig⚡The correct way to do type punning in C++🔀Michigan TypeScript Founder Successfully Runs Doom Inside TypeScript's Type System🎮Roadmap: Understanding GPU Architecture🖥️Building AI Agents from Scratch | Full Course🧠But there’s more, so dive right in.Stay Awesome!Divya Anne SelvarajEditor-in-ChiefSign Up|Advertise🗞️News and Analysis🔎ByteDance Launches New AI Coding Tool Trae with DeepSeek R1 and Claude 3.7 Sonnet Free For All Users: Traesupports Visual Studio Code plugins, and provides Builder and Chat modes for generating applications and assisting with code.GitHub unbundling its GitHub Advanced Security offering starting in April: Previously available only to GitHub Enterprise customers, these tools will now be accessible to GitHub Team subscribers, expanding security options for organizations of all sizes.Feb 28, 2025: 10 AI updates from the past week: Updates include OpenAI's GPT-4.5 preview, Anthropic's Claude 3.7 Sonnet and Claude Code, Google’s Gemini 2.0 Flash-Lite and free Gemini Code Assist, and Microsoft’s Phi-4 models.Seven Malicious Go Packages Found Deploying Malware on Linux and macOS Systems: Although still available on the official package repository, most corresponding GitHub repositories have been taken down.OpenSSF Publishes Security Baseline for Open-Source Projects: The Open Source Project Security Baseline (OSPS) isa tiered security framework designed to help open-source maintainers improve project security by aligning with international cybersecurity standards.TypeScript 5.8 reaches general availability: The version introduces granular checks for branches in return expressions, performance optimizations, and improved ECMAScript module support.C++ creator calls for help to defend programming language from 'serious attacks': As cybersecurity experts advocate for languages with inherent memory safety features, Stroustrup has proposed the Profiles memory safety framework to enhance C++'s safety without a complete overhaul.🎓Tutorials and Learning Resources💡Legend:🎓 Tutorial/Course | 💼 Case Study | 💡 Insight/Analysis | 📜 Academic Paper |📖 Open Source BookPython💡The Secret Life of __init__.py : Why This Tiny File Holds the Key to Python’s Magic: Explains the purpose and functionality of the __init__.py file in Python, highlighting its crucial role in treating directories as packages and organizing modules efficiently within a Python project.🎓How to boost Python program performance with Zig: Covers both C-style shared libraries and native Python extensions, while highlighting tools like Pydust for easier development.For more Python resources, go to PythonProC# and .NET🎓Building Local AI Agents: Semantic Kernel and Ollama in C#: Details setting up the environment, creating a simple non-agentic agent, and running it to handle basic interactions, focusing on integrating Small Language Models.💡Unlock new possibilities for AI Evaluations for .NET: Introduces the Microsoft.Extensions.AI.Evaluations library, now open source, designed to integrate AI evaluation processes into .NET applications.🎓Poisson Regression Using C#: Demonstrates a technique useful for predicting counts in data approximating a Poisson distribution, such as call volumes and explains how to set up a model, train it with synthetic data, and interpret results.C++ and C💡C++26: no more UB in lexing: Discusses the resolution of undefined behaviors in C++ lexing through Corentin Jabot's proposal, P2621R3, which has been accepted to amend issues dating back to C++98.🎓The correct way to do type punning in C++: Explains the proper use of std::bit_cast in C++20 for safe type punning, replacing older methods that risk undefined behavior, in this informative tutorial.🎓Abusing C to implement JSON Parsing with Struct Methods: Covers parsing various JSON components such as atoms, arrays, and objects, and includes tips on managing memory and debugging.Java💡Microbenchmarks: Java Locks vs Atomic: Compares Java concurrency tools—synchronized, ReentrantLock, and AtomicLong—in microbenchmarks, finding that AtomicLong is the fastest.🎓SQL Injection in JDBC: A Technical Deep Dive: Using technical examples, the article explains that PreparedStatement separates SQL commands from data inputs, avoiding direct concatenation that leaves room for injection.💡How Java’s try-finally Blocks Work Without catch: Explains how Java's try-finally blocks ensure cleanup tasks are completed regardless of exceptions, using examples to demonstrate this fundamental behaviorJavaScript and TypeScript💡JavaScript Fatigue StrikesBack: Discusses the evolving JavaScript ecosystem, highlighting the complexity of choosing the right framework amidst rapid developments and new features like server-side rendering.🎓Preventing race conditions: My experience with LockManager in JavaScript: Describes using the LockManager API in JavaScript to effectively prevent race conditions across multiple browser tabs by ensuring exclusive function execution.💡Michigan TypeScript Founder Successfully Runs Doom Inside TypeScript's Type System: Mitropoulos achieved the remarkable feat by using an extensive and optimized codebase that processed 177 terabytes of TypeScript types to render the game.Go💡The cost of Go’s panic and recover: Explains how using Go's panic and recover for control flow is non-idiomatic and can degrade performance due to heavy computational demands and the mechanisms' tendency to prevent compiler optimizations.🎓Tips to debug hanging Go programs: Takes you through a detailed example involving the gokrazy/rsync tool and covers using SIGQUIT to print stack traces, attaching the Delve debugger for deeper analysis, and more.Rust🎓Demystifying monads in Rust through property-based testing: Explores monadic patterns in depth, offering practical Rust code examples and demonstrating how these patterns can significantly slow down the shrinking process.🎓Socrates is a state machine: Explores using Rust's async/await syntax, which de-sugars into a state machine, to write state machines for sans I/O network protocol APIs, demonstrating the process with the 9p protocol example.Swift💡What is Structured Concurrency?: Explains the paradigm's benefits for simplifying asynchronous programming by improving code readability, maintainability, and error handling, contrasting it with previous methods that used closures and Grand Central Dispatch.💡Clean Architecture + Swift 6: Discusses integrating Swift 6 features into an existing Clean Architecture setup for SwiftUI, detailing the transition to async/await for better asynchronous handling, and more.PHP💡The problem with indirections: Discusses the problematic overuse of indirections in programming, such as unnecessary variables, methods, and interfaces that complicate code and reduce maintainability.🎓Selenium in PHP for Web Scraping: A Step-by-Step Guide!: Covers setup, code examples, and best practices for effectively extracting data from dynamic JavaScript-heavy websites.SQL📜Debunking the Myth of Join Ordering: Toward Robust SQL Analytics: Introduces Robust Predicate Transfer (RPT), a new approach to SQL join order optimization that ensures robustness against varying join orders in acyclic queries.💡This Is Probably the Most Perfect Programming for Solving SQL Data Analysis Pain Points: Introduces esProc SPL as a superior alternative to SQL for complex data analysis tasks, highlighting its ability to process local file data directly without a database, and its simpler, procedural syntax.Ruby📖Open Source Book | I Love Ruby: A a comprehensive guide to learning Ruby covering installation, tools, basic to advanced programming concepts, and real-world examples and exercises.💡What's The Deal With Ractors?: Delves into the functionality and practicality of Ractors in Ruby, emphasizing their design for in-process parallelism without fully eliminating the Global VM Lock (GVL).Kotlin💼Kotlin Multiplatform (KMP) Scalability Challenges on a Large Project: Delves into the challenges and benefits of migrating a product feature from native development to KMP, and offers insights into KMP's performance and integration into existing systems.🎓Kotlininlinereifiedto Solve Type Erasure, and a Practical Guide onnoinline,crossinline , and More: Covers inline and reified keywords, explains their combined usage through practical examples, and discusses performance benefits and limitations.🌟Advanced Concepts🚀🎓Roadmap: Understanding GPU Architecture: Aims to explain the key architectural features of GPUs, how they compare to CPUs, and the implications for programming General-Purpose computing on GPUs (GPGPU).🎓Building AI Agents from Scratch | Full Course: Compiles four lessons on agentic design patterns into a single course, covering reflection, tool use, planning (React), and multi-agent patterns. Each pattern is implemented from scratch using Python and Groq as the LLM provider.💼Adopting Arm at Scale: Transitioning to a Multi-Architecture Environment: Details Uber's strategic scale-up from implementing Arm-based hosts in a primarily x86 infrastructure to a multi-architecture system involving thousands of services.💼Implementing a virtual rail architecture: Explains how IBM adapted traditional leaf/spine networking with virtual rail redundancy to balance network performance and reliability, addressing issues like unbalanced queue-pairs, Ethernet port utilization, and redundancy failures.💡Architectures of modern Front-end applications: Compares classical, modular, and Feature Sliced Design (FSD) architectures in modern front-end development, explaining their structures, benefits, and trade-offs.🧠Expert Insight📚Here’s an excerpt from “Chapter 10: Anti-Patterns and Workarounds" in the book, TypeScript 5 Design Patterns and Best Practices, Second Edition, by Theofanis Despoudis, published in February 2025.Using idiomatic code from other languagesWhen developers transition to TypeScript from other languages, they often bring coding patterns and idioms that may not be ideal in TypeScript. Although many programming concepts are shared between many languages,such as control loops, classes, and functions, there are many other concepts particular to one language that cannot be used in adifferent language.In the next subsections, we show some obvious cases where using some idiomatic constructs from other languages will not work well with TypeScript, starting first with theJava language.From the Java languageJava developers often usePlain Old Java Objects(POJOs) orJavaBeans. Let’s look at how this pattern might be inappropriately applied in TypeScript and then how toimprove it.POJO is a naming convention for creating a class that follows some rules, especially in the context of Java EE where object serialization is crucial for some operations. The more standardized version of POJOs is the JavaBean naming convention. When following this convention, you will need to adhere to thefollowing rules:Access levels: We mark all properties asprivateand we only allowgetterandsettermethods for accessor modification.Method names: When defininggetters, you will need to prefix the method withget– for example,getName()orgetEmail(). When definingsetters, you will need to prefix the method withset– for example,setName()orsetEmail().Default constructor: You need to use a constructor with no arguments and it mustbepublic.Serializable: The class needs to implement theSerializableinterface.To understand why using POJOs in TypeScript is not ideal, we’ll show an example class in TypeScript for a typicalEmployeemodel:Idiomatic-code.tsclass Employee { constructor(private id: string, private name: string) {} getName(): string { return this.name } setName(name: string) { this.name = name } getId(): string { return this.id } setId(id: string) { this.id = id }}If you attempt to declare more than one constructor in TypeScript, then you will find that it’s not allowed, so you cannot provide both a no-argument constructor and another one with arguments. Additionally, TypeScript will complain if you provide a no-argument constructor as the property’snameandIDmay have notbeen initialized.You will see thefollowing errors:Figure 10.1 – TypeScript compiler message when it complains when you use a no-argument constructorThe concept of serialization applies to Java only, so it’s not relevant to TypeScript. However, you can serialize plain TypeScript objects using theJSON.stringifymethodas follows:console.log(JSON.stringify(new Employee("Theo", "1")));//{"id":"Theo","name":"1"}You will find that this works only for basic cases and does not handle polymorphism, object identity, or when containing native JavaScript types such asMap,Set, orBigInt. However, in most cases, you can implement a custom object mapper or use a Factory Method to convert an object to JSON andvice versa.The use ofget/setmethods is overly verbose and not needed most of the time. If you want to provide encapsulation, you can only havegettermethods and if you want to modify an existingEmployeeclass method, you just create a newEmployeeinstance with the updated fieldname instead:const theo = new Employee("Theo", "1");new Employee(theo.getName(), "2");Finally, you may opt out of using classes altogether as you can work with types, type assignments, and object de-structuring,as follows:Idiomatic-code.tsinterface Employee { readonly id: string; readonly name: string; readonly department: string;}function createEmployee(id: string, name: string, department: string): Employee { return { id, name, department };}function updateEmployee(employee: Employee, updates: Partial<Employee>): Employee { return { ...employee, ...updates };}const emp = createEmployee('1', 'John Doe', 'IT');console.log(emp.name); // John Doeconst updatedEmp = updateEmployee(emp, { department: 'HR' });console.log(updatedEmp.department); // HRThis approach uses an interface instead of a class for simple data structures and provides factory functions for creation and updates, promoting immutability. This form is more idiomatic TypeScript and is the preferred way to workwith types.Now let’s look at some of the idiomatic constructs from theGo language.TypeScript 5 Design Patterns and Best Practices, Second Edition was published in February 2025. Packt library subscribers can continue reading the entire book for free or you can buy the book here!Get the eBook for $31.99$27.99🛠️Useful Tools⚒️onyx: An open-source Gen-AI and enterprise search platform that integrates with any LLM, connects to 40+ enterprise apps, and enables secure, scalable AI-powered research, chat, and custom agents.globstar: An open-source static analysis tool that lets developers write and run custom checkers using tree-sitter queries or Go in a single binary, integrating easily into CI/CD pipelines.drawdb: A free, browser-based database schema editor and SQL generator that lets you create, customize, and export diagrams effortlessly without an account.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 usefulhere.If your company is interested in reaching an audience of developers, software engineers, and tech decision makers, you may want toadvertise with us.If you have any suggestions or feedback, or would like us to find you a learning resource on a particular subject, just respond to this email!*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{color:inherit!important;text-decoration:inherit!important}#MessageViewBody a{color:inherit;text-decoration:none}p{line-height:inherit}.desktop_hide,.desktop_hide table{mso-hide:all;display:none;max-height:0;overflow:hidden}.image_block img+div{display:none}sub,sup{font-size:75%;line-height:0}#converted-body .list_block ol,#converted-body .list_block ul,.body [class~=x_list_block] ol,.body [class~=x_list_block] ul,u+.body .list_block ol,u+.body .list_block ul{padding-left:20px} @media (max-width: 100%;display:block}.mobile_hide{min-height:0;max-height:0;max-width: 100%;overflow:hidden;font-size:0}.desktop_hide,.desktop_hide table{display:table!important;max-height:none!important}}
Read more
  • 0
  • 0
  • 5998

Divya Anne Selvaraj
28 Oct 2024
Save for later

Essential 2024 Guides for Cyber Defence and Development

Divya Anne Selvaraj
28 Oct 2024
Curated for cybersecurity engineers, DevOps pros, IT administrators, and developersEssential 2024 Guides for Cyber Defence and DevelopmentHi ,This week, we’ve handpicked six essential titles to bolster your skills across every layer of digital defence. From offensive Python techniques and API pentesting to continuous testing for DevOps, these books offer actionable strategies to stay ahead of evolving threats. Learn to build resilient defence programs, ace cybersecurity interviews, and secure Office 365 environments—all at 30% off.Bundle up & save more!Buy 2 eBooks – save an additional 10%Buy 3 eBooks – save an additional 15%Buy 5 eBooks – save an additional 20%Here’s what’s on offer:Continuous Testing, Quality, Security, and Feedback byMarc HornbeekEssential strategies and secure practices for DevOps, DevSecOps, and SRE transformations>Embed continuous testing, security, and feedback in DevOps and SRE practices.>Leverage AI/ML to drive quality improvements, illustrated with real-world cases.>Map digital transformation goals with frameworks for gap assessment and best practices.Get the eBook for $35.99$24.99Get the Print book for $44.99 $30.99Offensive Security Using Python byRejah Rehim, Manindar Mohan, and Grant OngersA hands-on guide to offensive tactics and threat mitigation using practical strategies>Automate offensive security tasks with practical Python scripts and custom tools.>Design security tools with secure coding practices to tackle real-world vulnerabilities.>Defend against advanced cyber threats through Python-powered techniques.Get the eBook for $39.99$27.98Get the Print book for $49.99 $34.98Pentesting APIs byMaurício HarleyA practical guide to discovering, fingerprinting, and exploiting APIs>Identify and exploit API vulnerabilities in RESTful and GraphQL environments.>Set up a dedicated API pentesting lab for comprehensive reconnaissance and testing.>Secure APIs with expert recommendations and practical skills to minimize attack surfaces.Get the eBook for $35.99$24.99Get the Print book for $44.99 $30.99Hack the Cybersecurity Interview - Second Edition by Christophe Foulon, Ken Underhill, and Tia Hopkins Navigate Cybersecurity Interviews with Confidence, from Entry-level to Expert roles>Master techniques to handle technical and behavioural questions across cybersecurity roles.>Discover industry trends, salary expectations, and key certifications to stay competitive.>Showcase your expertise effectively, whether entering the field or advancing your career.Get the eBook for $35.99$24.99Get the Print book for $44.99 $30.99Resilient Cybersecurity byMark DunkerleyReconstruct your defense strategy in an evolving cyber world>Build an adaptable cybersecurity program with zero trust and regulatory compliance.>Integrate governance, risk, and compliance seamlessly into daily operations.>Explore essential strategies for identity management, architecture, and threat resilience.Get the eBook for $39.99$27.98Get the Print book for $49.99 $34.98Mastering Microsoft Defender for Office 365 bySamuel SotoStreamline Office 365 security with expert tips for setup, automation, and advanced threat hunting>Learn step-by-step configuration to combat phishing, malware, and advanced threats.>Automate security tasks to boost efficiency and streamline threat responses.>Build a robust defence strategy tailored for Office 365 environments.Get the eBook for $35.99$24.99Get the Print book for $44.99*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{color:inherit!important;text-decoration:inherit!important}#MessageViewBody a{color:inherit;text-decoration:none}p{line-height:inherit}.desktop_hide,.desktop_hide table{mso-hide:all;display:none;max-height:0;overflow:hidden}.image_block img+div{display:none}sub,sup{font-size:75%;line-height:0}#converted-body .list_block ol,#converted-body .list_block ul,.body [class~=x_list_block] ol,.body [class~=x_list_block] ul,u+.body .list_block ol,u+.body .list_block ul{padding-left:20px} @media (max-width: 100%;display:block}.mobile_hide{min-height:0;max-height:0;max-width: 100%;overflow:hidden;font-size:0}.desktop_hide,.desktop_hide table{display:table!important;max-height:none!important}}
Read more
  • 0
  • 0
  • 5794
Divya Anne Selvaraj
04 Nov 2024
Save for later

Master Python for AI, Forecasting, and Data Engineering

Divya Anne Selvaraj
04 Nov 2024
Curated for data scientists, AI engineers, and Python developersMaster Python for AI, Forecasting, and Data EngineeringHi ,This week, we’ve handpicked five essential titles, all newly published in October 2024, to advance your Python skills across AI, data science, and machine learning. From time series forecasting and pandas data manipulation to mastering Apache Airflow workflows, building large language models, and creating AI applications with OpenAI APIs, these books are designed for practical, real-world application—each now at upto 30% off.Bundle up & save more!Buy 2 eBooks – save an additional 10%Buy 3 eBooks – save an additional 15%Buy 5 eBooks – save an additional 20%Here’s what’s on offer:Modern Time Series Forecasting with Python - Second Edition by Manu Joseph and Jeffrey TackesIndustry-ready machine learning and deep learning time series analysis with PyTorch and pandas>Apply cutting-edge ML and deep learning models to boost forecasting accuracy.>Explore probabilistic forecasting methods for handling real-world uncertainties.>Master techniques for deploying robust time series models with PyTorch and pandas.Get the eBook for $46.99$31.99Get the Print book for $57.99Pandas Cookbook - Third Edition byWilliam Ayd and Matthew HarrisonPractical recipes for scientific computing, time series, and exploratory data analysis using Python>Unlock practical recipes for data manipulation, time series analysis, and data exploration.>Master the latest in pandas 2.x for streamlined data workflows.>Solve real-world data challenges with clear, structured solutions and advanced techniques.Get the eBook for $39.99$27.98Get the Print book for $49.99Apache Airflow Best Practices byDylan Intorf, Dylan Storey, and Kendrick van DoornA practical guide to orchestrating data workflow with Apache Airflow>Build resilient data workflows and pipelines using real-world Apache Airflow use cases.>Optimize workflow orchestration to scale data operations effectively.>Implement best practices for Airflow 2.x, from DAG authoring to cloud deployment.Get the eBook for $35.99$24.99Get the Print book for $44.99LLM Engineer's Handbook byPaul Iusztin, Maxime Labonne, Julien Chaumond, and Hamza TahirMaster the art of engineering large language models from concept to production>Learn how to design, deploy, and optimize LLMs for production use.>Implement data pipelines, fine-tune models, and manage deployment with MLOps techniques.>Master advanced LLM operations, including preference alignment and inference optimization.Get the eBook for$47.99Get the Print book for $59.99 $53.98Building AI Applications with OpenAI APIs - Second Edition byMartin YanevLeverage ChatGPT, Whisper, and DALL-E APIs to build 10 innovative AI projects>Develop AI-powered projects with ChatGPT, Whisper, and DALL-E APIs across 10 innovative projects.>Integrate AI seamlessly into web and desktop applications, from NLP to speech recognition.>Monetize your creations by adding payment systems and using fine-tuning for specific applications.Get the eBook for $31.99$21.99Get the Print book for $39.99*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{color:inherit!important;text-decoration:inherit!important}#MessageViewBody a{color:inherit;text-decoration:none}p{line-height:inherit}.desktop_hide,.desktop_hide table{mso-hide:all;display:none;max-height:0;overflow:hidden}.image_block img+div{display:none}sub,sup{font-size:75%;line-height:0}#converted-body .list_block ol,#converted-body .list_block ul,.body [class~=x_list_block] ol,.body [class~=x_list_block] ul,u+.body .list_block ol,u+.body .list_block ul{padding-left:20px} @media (max-width: 100%;display:block}.mobile_hide{min-height:0;max-height:0;max-width: 100%;overflow:hidden;font-size:0}.desktop_hide,.desktop_hide table{display:table!important;max-height:none!important}}
Read more
  • 0
  • 0
  • 5770

Divya Anne Selvaraj
17 Oct 2024
Save for later

ProgrammingPro #78: API-First Development Trends, Google’s New LLM Algorithm, and AI-Powered PHP

Divya Anne Selvaraj
17 Oct 2024
Bite-sized actionable content, practical tutorials, and resources for programmers#78Notion for StartupsThousands of startups use Notion as a connected workspace to create and share docs, take notes, manage projects, and organize knowledge—all in one place.We’re offering 6 months of new Plus plans, including unlimited Notion AI, so you can try it all for free!To redeem the Notion for Startups offer:1. Submit an application using our custom link: https://ntn.so/packtand selectPackton the partner list.2. Include our partner key:STARTUP4110P19151Get your Free 6-month Notion Plus Access!Hi ,Welcome to this week’s edition of ProgrammingPro!In today’sExpert Insight, we bring you an excerpt from the recently published book, Bare-Metal Embedded C Programming, which briefly compares UART, SPI, and I2C communication protocols in embedded systems.News Highlights: Postman's 2024 survey shows 74% of developers adopting an API-first approach; Google unveils an LLM self-correction algorithm; StackBlitz's Bolt.new allows Node.js projects in the browser via AI prompts; and Google’s Code Assist Enterprise now trains on internal code with GitHub and GitLab.My top 5 picks from today’s learning resources:Python 3.12 vs Python 3.13 – performance testing🐍How to use Java generics to avoid ClassCastExceptions🔄Unlocking AI Magic: 10 Ways to Supercharge Your PHP Apps with OpenAI✨The imperative of artifact management in modern software development📦Building a Global Caching System at Netflix: a Deep Dive into Global Replication🌍But there’s more, so dive right in.Stay Awesome!Divya Anne SelvarajEditor-in-ChiefPS:The October survey is still live. Do take the opportunity to leave us your feedback, request a learning resource, and earn your one Packt credit for this month.Sign Up|Advertise🗞️News and Analysis🔎Report: Developers are increasingly adopting an API-first approach: Postman’s 2024 survey reveals 74% of respondents adopted this method, citing faster production and recovery times.Ephemeral IDs: Cloudflare's Latest Tool for Fraud Detection: Cloudflare's new fraud detection feature tracks client behavior instead of IP addresses to detect fraudulent activities.Google Publishes LLM Self-Correction Algorithm Self-Correction via Reinforcement Learning (SCoRe): Google's new algorithm is designed to improve LLMs' ability to self-correct math and coding problems.Ktor 3.0 switches to kotlinx.io library: The Kotlin-based framework for building asynchronous applications, now uses the multiplatform kotlinx.io library for handling data sources, improving byte transformation efficiency.TypeScript 5.7 improves error reporting: The version, now in beta, improves error reporting by detecting never-initialized variables, addressing gaps in the type system's checks.StackBlitz Bolt.new blurs boundaries between web development and skilled use of AI prompts: Bolt.new allows developers to create projects using Node.js directly in the browser, guided by precise AI prompts.Google’s Code Assist Enterprise can be trained on internal source code, is focused on Google services: Announced at the Google Cloud Summit, Gemini Code Assist Enterprise, supports integrations with GitHub and GitLab.🎓Tutorials and Learning Resources💡PythonPython 3.12 vs Python 3.13 – performance testing:Tests on AMD Ryzen 7000 and Intel 13th-gen processors show Python 3.13 generally performs faster, especially in asynchronous tasks, but there are slowdowns in certain areas.🎓Tutorial | Get started with the free-threaded build of Python 3.13: Introduces Python 3.13’s new "no-GIL" or free-threaded build, allowing true parallelism by removing the GIL for better concurrency.For more Python resources, go to PythonProC# and .NETEngineering the Scalable Vector Extension in .NET: Covers the new SVE APIs, code generation techniques, and challenges like register handling and context switches.The Role of the Checked Keyword in Managing Overflow in C#: Covers how the checked keyword in C# helps manage arithmetic overflow and ensures reliable type conversions by throwing exceptions when overflow occurs.Func vs. Predicate vs. Expression in C# .Net: Helps you choose the correct delegate type for efficient method encapsulation, condition checking, and expression handling in C# programming.C and C++C++ String Conversion: Exploring std::from_chars in C++17 to C++26: Highlights how std::from_chars provides high-performance, low-level text-to-number conversions with features like non-throwing behavior, and more.Opaque Pointer Pattern in C++: Discusses the the pattern in C++ (also known as the Pimpl Idiom or Bridge Pattern), which helps hide implementation details from clients while maintaining a stable interface.Self-referential variable initialization in C: Highlights that in C, variables are in scope as soon as they are declared, allowing code like int x = x + 1; despite the variable being uninitialized at that point, which leads to undefined behavior.Java🎓Tutorial | How to use Java generics to avoid ClassCastExceptions: Covers upper bounds, wildcard usage, generic methods, type inference, and type erasure, highlighting how generics prevent runtime exceptions.🎥Continuations: The magic behind virtual threads in Java by Balkrishna Rawool: Explains how virtual threads differ from platform threads, and ithe continuation mechanism that pauses and resumes thread execution.🎥Practical LLM Inference in Modern Java by Alfonso² Peterssen, Alina Yurenko: Discusses implementing a fast LLM inference engine in pure Java using GraalVM.JavaScript and TypeScript🎓Tutorial | Time duration in JS: Explains how JavaScript's Temporal API, specifically Temporal.Duration, handles time durations, offering a modern solution to complexities like leap years, time zones, and Daylight Saving Time.The greatness and limitations of the js-framework-benchmark: Covers the benchmark's strengths in measuring JavaScript framework performance, and its limitations in areas like server-side rendering, hydration, and more.🎓Tutorial | TypeScript for Functional Programmers: Introduces TypeScript's type system to functional programmers familiar with Haskell or ML, highlighting its unique features and differences.Go🎓Tutorial | Practical guide for building a blockchain from scratch in Go: Covers the foundational concepts and practical steps to build a blockchain from scratch in Go using gRPC.Go's New Iterators Smell (A Little) Funny, but It's Probably OK: Discusses Go's new iterators, introduced in Go 1.23, and how they work, including potential issues with early loop exits causing panics.Rust💼Case Study | Challenges and Lessons Porting Code from C to Rust: Describes how engineers used c2rust to convert code step-by-step, addressing threading, memory safety, and performance optimizations.🎓Tutorial | Improve an algorithm's performance step by step: Covers profiling techniques, memory optimization, SIMD use, and iterating over different performance-enhancing approaches, including Rust-specific features and tools.SwiftSecurity-scoped bookmarks for URL access: Discusses how security-scoped bookmarks allow macOS apps to store and regain access to user-selected directories across sessions.🎓Tutorial | Write Swift Like Apple: Emphasizes using clear, descriptive naming for variables, methods, and protocols, favoring Apple's own style over other coding standards.PHP🎓Tutorial | Unlocking AI Magic: 10 Ways to Supercharge Your PHP Apps with OpenAI: Provides a step-by-step guide to integrating OpenAI's API with PHP applications, explaining how to leverage AI-powered features.SQL💼Case Study | Uber Completes Major MySQL Fleet Upgrade, Boosting Performance and Security: Details Uber's successful MySQL upgrade from version 5.7 to 8.0, involving over 2,100 clusters and a side-by-side process.RubyThe Hidden Power of Symbols in Ruby: When to Use Symbols Instead of Strings: Highlights their efficiency as immutable identifiers, particularly for hash keys and method references.Kotlin🎓Tutorial | Testing Coroutines — Simplified: Details the setup for testing coroutine functions, including the use of StandardTestDispatcher to manage coroutine execution and ensure proper assertions.🌟Best Practices and Advice🚀The imperative of artifact management in modern software development: Highlights how artifact management platforms streamline development, enhance security, and automate dependency management.Scaling Uber’s Batch Data Platform: a Journey to the Cloud with Data Mesh Principles: Details the migration which aims to enhance scalability, security, and operational efficiency while decentralizing data ownership.How Cell-Based Architecture Enhances Modern Distributed Systems: Explores how cell-based architectures improve scalability, fault isolation, and resiliency in modern distributed systems.Building a Global Caching System at Netflix: a Deep Dive into Global Replication: Explains how Netflix built a global caching system using EVCache to ensure data availability across multiple regions.🧠Expert Insight📚Here’s an excerpt from “Chapter 4: Crossing the Language Barrier with the Arrow C Data API” in the book, Bare-Metal Embedded C Programming, byIsrael Gbati, published in September 2024.Comparing UART, SPI, and I2CLet’s startwith UART.UARTHere are some key featuresof UART:Asynchronous communication: UART doesn’t require a clock signal. Instead, it uses start and stop bits to synchronizedata transmission.Full-duplex: UART can send and receive data simultaneously, which is ideal for many applications requiringreal-time communication.Simple and cost-effective: With minimal hardware requirements, UART is easy to implementand cost-effective.The following are some ofits advantages:Ease of use: Setting up UART communication is straightforward, making it a popular choice for beginners andsimple applicationsWide support: UART is universally supported by most microcontrollers andperipheral devicesLow overhead: The lack of a clock signal means fewer pins are used,reducing complexityHowever, it also hassome disadvantages:Speed limitations: UART is generally slower compared to SPI and I2C, making it less suitable for high-speeddata transferLimited distance: Susceptibility to noise over long distances can limit the range ofreliable communicationPoint-to-point only: UART is designed for direct, point-to-point communication, which can be a limitation if multiple devices needto communicateNext, wehave SPI.SPIHere are some key featuresof SPI:Synchronous communication: SPI uses a clock signal along with data lines, ensuring synchronizeddata transferFull-duplex: It allows data to be sent andreceived simultaneouslyMaster-slave architecture: One master device controls multiple slave devices, with dedicated linesfor eachThe following are some ofits advantages:High speed: SPI supports high-speed data transfer, making it ideal for applications requiringfast communicationVersatility: SPI can connect multiple devices with different configurations, providing flexibilityin designHowever, it also hassome disadvantages:More pins required: Each slave device needs a separate select line, which can increase the pincount significantlyNo standardized acknowledgment: Unlike I2C, SPI does not have a built-in acknowledgment mechanism, which can make error detectionmore challengingLimited multi-master capability: SPI is not designed for multi-master systems, which can be a limitation insome scenariosThe final common communication protocol we’ll coveris I2C.I2CHere are some key featuresof I2C:Synchronous communication: I2C uses a clock signal for synchronizeddata transferMulti-master capability: Multiple master devices can share the same bus, which is useful in morecomplex systemsTwo-wire interface: I2C requires only two lines (SDA and SCL) for communication, minimizing thepin countThe following are some ofits advantages:Simplicity in wiring: The two-wire interface reduces the complexity and number ofpins requiredMulti-device support: I2C easily connects multiple devices on the same bus, each with aunique addressBuilt-in addressing: I2C has a built-in addressing mechanism, making communication with multipledevices straightforwardHowever, it does havesome disadvantages:Slower speed: I2C is generally slower than SPI, which can be a limitation forhigh-speed applicationsComplex protocol: The protocol is more complex than UART and SPI, requiring more sophisticated handling of data transfersand addressingSusceptible to noise: Like UART, I2C can be susceptible to noise over longer distances, potentially affectingcommunication reliabilityChoosing the right communication protocol depends on your specific application needs. If you need simple, straightforward communication and can tolerate slower speeds,UARTis a great choice. For high-speed applications with a need for full-duplex communication,SPIis ideal, especially if you can manage the higher pin count. When you need to connect multiple devices with minimal wiring and have a complex communication setup,I2Cis your go-to protocol. To help you better understand when to choose which protocol, let’s explore some commonuse cases.Bare-Metal Embedded C Programmingwas published in September 2024. Packt library subscribers can continue reading the entire book for free or you can buy the bookhere!Get the eBook for $33.99$22.99🛠️Useful Tools⚒️pan: A privacy-focused PHP analytics library for tracking events like impressions, hovers, and clicks in Laravel without collecting personal data.Parsek: A modular back-end platform that boosts development efficiency with reusable plugins while optimizing speed and performance.arch: A Layer 7 gateway for LLM applications that optimizes prompt handling, API interactions, and security.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 usefulhere.If your company is interested in reaching an audience of developers, software engineers, and tech decision makers, you may want toadvertise with us.*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{color:inherit!important;text-decoration:inherit!important}#MessageViewBody a{color:inherit;text-decoration:none}p{line-height:inherit}.desktop_hide,.desktop_hide table{mso-hide:all;display:none;max-height:0;overflow:hidden}.image_block img+div{display:none}sub,sup{line-height:0;font-size:75%}#converted-body .list_block ol,#converted-body .list_block ul,.body [class~=x_list_block] ol,.body [class~=x_list_block] ul,u+.body .list_block ol,u+.body .list_block ul{padding-left:20px} @media (max-width: 100%;display:block}.mobile_hide{min-height:0;max-height:0;max-width: 100%;overflow:hidden;font-size:0}.desktop_hide,.desktop_hide table{display:table!important;max-height:none!important}}
Read more
  • 0
  • 0
  • 5762
Success Subscribed successfully to !
You’ll receive email updates to every time we publish our newsletters.