Learn Bosque Programming
eBook - ePub

Learn Bosque Programming

Boost your productivity and software reliability with Microsoft's new open-source programming language

  1. 336 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Learn Bosque Programming

Boost your productivity and software reliability with Microsoft's new open-source programming language

About this book

Discover the benefits of regularized programming by implementing Bosque to build a variety of reliable apps

Key Features

  • Get up and running with the Bosque programming language and use it to build better software
  • Streamline your app development and improve productivity using Bosque programming
  • Eliminate sources of complexity such as loops, recursion, and invariants to develop quality products

Book Description

Bosque is a new high-level programming language inspired by the impact of structured programming in the 1970s. It adopts the TypeScript syntax and ML semantics and is designed for writing code that is easy to reason about for humans and machines. With this book, you'll understand how Bosque supports high productivity and cloud-first development by removing sources of accidental complexity and introducing novel features.

This short book covers all the language features that you need to know to work with Bosque programming. You'll learn about basic data types, variables, functions, operators, statements, and expressions in Bosque and become familiar with advanced features such as typed strings, bulk algebraic data operations, namespace declarations, and concept and entity declarations. This Bosque book provides a complete language reference for learning to program with Bosque and understanding the regularized programming paradigm. You'll also explore real-world examples that will help you to reinforce the knowledge you've acquired. Additionally, you'll discover more advanced topics such as the Bosque project structure and contributing to the project.

By the end of this book, you'll have learned how to configure the Bosque environment and build better and reliable software with this exciting new open-source language.

What you will learn

  • Find out what the Bosque project is
  • Identify accidental complexity in code and how to overcome it with Bosque
  • Understand the principles of the regularized programming paradigm
  • Install and configure the Bosque environment
  • Get hands-on experience using the Bosque language and its key features
  • Recognize the advantages of explicit code intermediate representation design

Who this book is for

This book is for experienced developers and early adopters who are interested in learning a new, mindset-changing programming language. You'll also find this book useful if you know TypeScript or JavaScript programming and want to understand the advantages of Bosque compared to other programming languages. Experience with any programming language and knowledge of various programming paradigms such as structured programming and functional programming are required to get started with this book.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, weโ€™ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere โ€” even offline. Perfect for commutes or when youโ€™re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Learn Bosque Programming by Sebastian Kaczmarek,Joel Ibaceta in PDF and/or ePUB format, as well as other popular books in Informatik & Microsoft-Programmierung. We have over one million books available in our catalogue for you to explore.

Information

Section 1: Introduction

In this part, we introduce the Bosque project. After reading this section, you will understand its key concepts and how to start experimenting with it.
This section comprises the following chapters:
  • Chapter 1, Exploring Bosque
  • Chapter 2, Configuring the Bosque Environment
  • Chapter 3, Bosque Key Features

Chapter 1: Exploring Bosque

The Bosque project was born from Mark Marron's work, where he questioned the accidental complexity that exists in programming languages nowadays. He proposed a new programming language design that eliminated the factors of this complexity in terms of loops, recursion, mutable state, and reference equality, among others, thus resulting in a new paradigm called Regularized Programming.
Bosque has a syntax inspired by TypeScript and adopts semantics from ML and JavaScript, giving rise to a programming language that is easy to write and read.
The simplicity of Bosque allows programmers who decide to adopt Bosque to focus on the core of the problem without worrying about the errors that are caused by the language's accidental complexity. Consequently, they will build more reliable, robust, and predictable programs that have been prepared, by design, to support new trends.
In this chapter, we will cover the basics of what the Bosque project is, as well as some of the theory and motivation behind this project. We will also learn the basics of code intermediate representations (IR). We will learn what they are, why we need them, and what the Bosque approach is. We will also review the problem of accidental complexity and present the concept of regularized programming. Eventually, we will mention where Bosque can be applied.
We will cover the following topics:
  • Identifying the need for another language
  • Learning what intermediate representation is
  • Discovering regularized programming
  • Understanding accidental complexity
  • How the experiment is going so far
  • Bosque applications
By the end of this chapter, you will have knowledge about what Bosque really is and how it works.

Identifying the need for another language

Some of the most frequent questions programmers ask during their early learning years are "Why are there so many programming languages?," "Why don't we just use the same language for everything?," and "Why do we keep creating more programming languages?". A useful analogy to explain the diversity of the programming languages that exist today is to imagine programming languages as musical instruments. We have string, wind, and percussion instruments based on different physical principles; in the same way, programming languages are designed based on different architectures and paradigms. However, instruments or programming languages are often used to generate structured and ordered compositions.
We cannot objectively say that a guitar is not appropriate to play the fifth symphony by Beethoven, since we could only give an appreciation for this based on our personal tastes. In the same way, choosing a programming language might not represent preferring syntax or specific expertise.
But it is also true that interpreting some compositions without the appropriate instrument could be an arduous task, and it could mean sacrificing a big part of the piece due to the physical limitations of the instrument's design. A similar scenario unfolds when we're trying to use programming languages to do things that they were not designed to. Often, this could mean putting in a tremendous technical effort, or having to sacrifice performance, productivity, or stability.
In summary, The Four Seasons by Vivaldi can be beautifully played with a violin and maybe not with a drum; similarly, R rather than Lua could be much more suitable and efficient for statistically analyzing information, while Lua is better for extending Nginx servers instead of Ruby. Although we can use the same tools for everything, they will not always be the most appropriate.
Now that we have a better idea about the diversity of programming languages and their suitability for solving some specific types of problems, the following question arises: "Why was Bosque created?"
When it comes to developing high-level programming languages, one of the main objectives has always been to try to simplify the process of writing code so that it's as close to human language as possible. This allows us to simplify the process of giving instructions to machines using the potential of human reasoning.
But generally, each continuously evolving process implies an increase in complexity, and this complexity may cause mistakes, in the same way that programming languages have been acquiring characteristics that make them complex and prone to causing hard-to-identify errors. By learning from the past and questioning the actual complexity of programming languages, Bosque was born. To solve this and to learn from the past, as inspired by the impact generated by Structural Programming in its day, Bosque was born as a new programming language that eliminates accidental complexity.
As a result, we have a coding process that's more straightforward, predictable, and readable. This allows programmers to focus on the most important stuff or the main program logic, thus improving productivity and making software more reliable.
In the words of Bosque's creator (Mark Marron):
"The Bosque language demonstrates the feasibility of eliminating sources of accidental complexity while retaining the expressivity and performance needs for a practical language, as well as hinting at the opportunity for improved developer productivity and software quality."
Now that we understand why Bosque exists, lets learn how it builds an executable program from high-level source code.

Learning what Intermediate Representation is

Nowadays, it's not unusual to find high-level programming languages that use one or more intermediate representations when they're translating source code into binary code or machine code. By doing this, the compilation process can be simplified without us losing the advantages of a high-level language. It opens the path to developing new programming languages and being friendlier with developers and closer to the process of human reasoning. Bosque is no exception.
Let's learn how intermediate representation works by looking at an example.
First, an abstract representation is usually modeled through a graph that describes the program we are compiling through a data structure. This can occur in different ways:
  • An abstract syntax tree (AST)
  • Lineal IR's three-way code or Postfix notation
Let's take a look at the following expression:
5 * a - b
This expression can be expressed using the following AST:
Figure 1.1 โ€“ AST graph representation
Figure 1.1 โ€“ AST graph representation
If we quickly inspect the graph, we can identify the code's intent through its structure. We could use this abstract repr...

Table of contents

  1. Learn Bosque Programming
  2. Contributors
  3. Preface
  4. Section 1: Introduction
  5. Chapter 1: Exploring Bosque
  6. Chapter 2: Configuring the Bosque Environment
  7. Chapter 3: Bosque Key Features
  8. Section 2: The Bosque Language Overview
  9. Chapter 4: Entrypoint Function
  10. Chapter 5: Types and Operators
  11. Chapter 6: Bosque Statements
  12. Chapter 7: Project: Bosque in the Cloud
  13. Section 3: Practicing Bosque
  14. Chapter 8: Expressions in Bosque
  15. Chapter 9: Collections
  16. Chapter 10: Iterative Processing and Recursion
  17. Chapter 11: Project: AI Classifier
  18. Section 4: Exploring Advanced Features
  19. Chapter 12: Namespaces, Concepts, and Entities
  20. Chapter 13: Testing in Bosque
  21. Chapter 14: Project: Path Optimizer
  22. Appendix A: Advanced Topics
  23. Appendix B: What's Next in Bosque?
  24. Other Books You May Enjoy