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
Learn Bosque Programming
Learn Bosque Programming

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

eBook
$26.98 $29.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Learn Bosque Programming

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 representation to generate an intermediate code representation that is more agnostic to the architecture or execution environment. This code is usually a sequential representation of the syntactic tree. Generally, from this abstract representation, an intermediate code representation could be generated. Even though this is more similar to final object code, this code is usually a sequential representation of the syntactic tree, agnostic to the architecture or execution environment.

Here, we can observe the representation in the intermediate code of the previous structure:

t1 = 5 * a 
t2 = b
t3 = t1 - t2

From this intermediate code, and by using a suitable compiler, a final executable binary can be generated, which would be the result of our source code's compilation. Let's look at a more complex example based on a C# snippet. This can be interpreted as follows:

while ( x > y ) {
    if ( x > 0 ) {
        x = x - y;
    }
}

The AST representation of the previous code is as follows:

Figure 1.2 – AST graph representation

Figure 1.2 – AST graph representation

During its interpretation, the C# source code is converted into an intermediate code called IL, representing the original code's intention. However, in this case, it is less understandable at first glance, as shown here:

.locals init ( 
    [0] int32 x, 
    [1] int32 y, 
    [2] bool, 
    [3] bool 
)
IL_0001: ldc.i4.0
IL_0002: stloc.0
IL_0003: ldc.i4.0
IL_0004: stloc.1
// sequence point: hidden
IL_0005: br.s IL_0017
// loop start (head: IL_0017)
    IL_0007: nop
    IL_0008: ldloc.0
    IL_0009: ldc.i4.0
    IL_000a: cgt
    IL_000c: stloc.2
    // sequence point: hidden
    IL_000d: ldloc.2
    IL_000e: brfalse.s IL_0016
    IL_0010: nop
    IL_0011: ldloc.0
...

Later, this intermediate code will be converted into low-level code so that it can be interpreted by the virtual machine that will build the final executable – in this case, .NET Framework. Some additional examples of known intermediate languages are as follows:

  • GNU RTL: This is an intermediate language that's used to support many of the programs in the programming languages found in the GNU Compiler Collection.
  • CIL: This an intermediate language that's used by Microsoft .NET Framework's high-level languages. The final binary code is generated from this representation.
  • C: Even though it wasn't designed as an intermediate language, it's often used as a layer of abstraction for the assembler language, which is why so many languages have adopted it as their intermediate representation.

The advantages of having an intermediate representation include being able to have an intermediate stage of interpretation from the high-level language. In this stage, we can optimize, analyze, or correct the code in the most appropriate way according to the language's design and objectives.

The process of transforming an intermediate representation into native code that results in an executable binary is also called ahead-of-time (AOT) compilation. This has many advantages over the just-in-time (JIT) compilation, generally resulting in a considerable reduction in execution time, resource savings, and shorter startup times.

This is why the Bosque compilation process uses a binary generation tool based on AOT compilation, called ExeGen, whose usage we will explore in more detail in the next chapter. Additionally, the Bosque project has an IR that's been explicitly designed to support the needs of the regularized programming paradigm. It explores how to build intermediate representations so that they include support for symbolic testing, enhanced fuzzing, GC compilation, and API auto-marshaling, among others.

Some of these characteristics that Bosque IR supports are part of the regularized programming paradigm, as we will see next.

Discovering regularized programming

One of the main paradigms that is used when stepping away from machine code and representing instructions in high-level expressions is structured programming, which is based on the theory proposed by Böhm-Jacopini during the 1960s, when it was proved that any computable function can be modeled using flow control structures, iteration, and subroutines. It was also asserted that the GO TO instruction could be exempted because its use could lead to the development of spaghetti code. One of the recognized promoters of this idea was E. Dijkstra, who covered it in his paper Go To Statement Considered Harmful.

Following this paradigm, we can design flow charts that represent our program's logic in a more readable fashion. This allows programs to be developed in a more efficient, trustworthy, and legible manner:

Figure 1.3 – Basic structures proposed by the structured programming paradigm

Figure 1.3 – Basic structures proposed by the structured programming paradigm

This paradigm was used by IBM investigator Harlan Mills to develop an indexation system for The New York Times investigation files. It was a great success and gave birth to other companies who had started to adopt the paradigm with enthusiasm.

A new age had arrived and code had become easier to write. The problems at hand could be reduced using a series of structures and diagrams.

Afterward, we saw the imminent arrival of structured design, modularity, and modular programming because of the use of structured programming in more complex settings, thus dividing the problem at hand into more straightforward, smaller problems, and these into other, simpler problems.

This happened in the middle of a golden age for programming that gave birth to more programming languages and more compilers, allowing us to abstract the complexity of the architecture where programs would be executed. IDEs and high-level tools were also that reduced the entry barriers for writing code, taking programs to the many industries that existed at the time.

In the next few years, we saw the uprising of new paradigms such as object-oriented programming (OOP), which represented programs as systems containing entities with properties, behaviors, and states. It intended to apply mental models to problem solving since it was easier to represent the problem in terms of their objects, properties, interactions, and the effects of these interactions.

With OOP, not only mathematical or automation problems could be shaped, but more complex systems could be represented through software, allowing us to reuse mental models or knowledge about the industry and transfer it to an application. However, because of this, we had to worry about remembering and following the state changes of all the objects that had been created during the application's entire life cycle. This implies that even though it's easier to model a real-life system through entities and their interactions, we also have to deal with the language's technical complexity and abstraction issues.

Many years have passed since those days, and we've witnessed the appearance of many other paradigms, the fall of some models, and the revindication of others that seemed like they'd never come back. Technology has also changed – nowadays, problems are more complex, and the internet has taken great relevance in software development. Today, we need to write code much faster to comply with the pace of the changes that are being made, but we also live with what we've inherited from the predecessors of the first designs, architectures, and models, even though we also have many open problems from more than 30 years ago.

Bosque proposed that we go a step further and, just like structured programming, presented a new way to simplify the code writing process through regularized programming. This enhanced the legibility, productivity, and code analysis process, and also helped simplify existing models. This starts with throwing out the source of the mistakes that come with accidental complexity, making it easier to implement formal reasoning models to code. Bosque proposes that we rethink the way in which we build programming languages from a perspective similar to structured programming, with the goal of simplifying the code writing process, thus enhancing its legibility, reliability, and productivity.

This simplicity is a consequence of eliminating the sources of accidental complexity, avoiding the unexpected behavior of our programs, and providing a deterministic perspective for writing code. This new design favors translating formal reasoning models into source code. As a result, we have a new paradigm called "regularized programming."

In the next section, we will understand the advantages of eliminating complexity in programming languages

Understanding accidental complexity

Speaking about complexity implies that it's difficult to understand something through simple reasoning. For example, it's hard to predict the result of a program's execution or piece of code that uses various recursion instances, because it's hard to figure out what the result will be without doing a more detailed analysis of the process.

Often, this complexity is inherent to the problem we're trying to solve, which we call essential complexity since we cannot dispense it. A recurrent exercise in mathematics and physics, which has allowed us to make significant advances, is to simplify complex models by eliminating sources of complexity that aren't inherent to the phenomenon we're trying to describe. The problem in software development is that this complexity is an essential part of the problem that's being solved, and it's not so easy to simplify the problem.

Although this complexity is not unique to software, it can be harder to show. For example, if we're constructing a building, which is a structure with plenty of complexity, it's easier to show what part of the structure isn't correctly aligned, a dimension that doesn't comply with the blueprints, or rather that the omissions are pretty obvious. The invisible nature of software means that we need to put in more effort to try and identify the cause of an error in a complex system.

One of the most critical advances in the software industry has been the development of high-level languages that simplify many of the possible causes of error due to complexity. This was achieved by encapsulating problems in abstract structures, hierarchies, and modules, thus allowing programmers to improve their productivity and the comprehension of their written code. This also enabled them to focus on solving the core of the problem and not deal with disk access, memory registers, and precise details surrounding the architecture or the hardware.

The models these languages have been built on carry some sources of complexity that Mark Marron identified in his work, and that Bosque pretends to avoid from the design stage of the new programming language.

Now, let's understand each of these sources of complexity and how Bosque avoids them in its design.

Immutability

Mutability can be more intuitive at a higher level but harder to comprehend in detail, besides making analysis tools harder because it affects the application's state. On the other hand, it implies having to compute logical frames. This could be an arduous task for developers as they must remember the state changes for each entity in their applications.

Mutability is an object trait that allows them to be changed. This concept could be intuitive at first glance because we are used to thinking about transforming things through processes, especially if we have spent a lot of time programming with OOP.

However, this adds an extra level of complexity since we must be aware of all the changes our objects will undergo during the entire execution process.

Additionally, if we consider that our code uses methods and functions that have been provided by external libraries or language helpers, which can change our objects or entities' states, then all the events that modify an object's state become arduous. Consequently, we have less predictable programs.

Let's look at an example to understand this better.

Let's say we have the following code in JavaScript, which describes an object – Charles, in this case:

let person = {
    name: "Charles"
}

Now, let's create a function that assigns a new value to save this person's age:

function setAgeToPerson(person, age) {
    person.age = age;
}

Now we are able to add the age property to person, calling to the function setAgeToPerson():

setAgeToPerson(person, 21);

So, if we query for the properties of person, we will have age and name.

However, let's imagine that a third-party library provides the setAgeToPerson() method. If we had previously assigned a value to age, we could incur an error that could be difficult to identify since we are changing a property with the same name from different places.

This can become a problem if we have many events throughout the code that alter the state or composition of an object, which is even more complex if we consider asynchronous executions or dynamic dispatching.

Due to this and the Bosque philosophy of eliminating sources of complexity, immutability is adopted for all the values throughout the language.

Contrary to mutability, immutability is the concept that objects cannot change state once they've been created. This concept may be familiar to you if you have had experience with functional languages.

Other than improving the predictability of the code and minimizing errors, immutability has many benefits when it's time to understand the code that's been written. The following are some other benefits of immutability:

  • Easy-to-test code
  • Thread-safe by design
  • No invalid states
  • Better encapsulation

In summary, immutability in Bosque allows our applications to be more predictable, secure, and stable, thus allowing us to clearly identify the state of our application through the code that's written. It doesn't let hidden code make unexpected changes.

Loop-free

Loops are part of many junior programmers' training, so it is common to think about them when we're solving problems. However, we may create errors when we use them, which could be avoided.

As we know, when we use loops, we must be careful and correctly use comparison operators such as <= instead of <. This is a frequent mistake, almost like forgetting the semicolon at the end of the line, so we also have to be careful when it comes to creating infinite loops.

On the other hand, loops usually involve an additional effort to try and understand their intent. This is because the programmer must do a mental process, similar to reverse engineering, to get a better idea of the result that will be obtained when they execute a piece of code that contains some nested loops.

Often, the primary intent in loops could be replaced by a higher-order function, which provides better clarity about its intent. Let's look at an example of this. Let's take an array of numbers using JavaScript:

const arrayOfNumbers = [17, -4, 3.2, 8.9, -1.3, 0, Math.PI];

To obtain the sum of all the values of the array in JavaScript, we could write something like this:

let sum = 0;
arrayOfNumbers.forEach((number) => {
  sum += number;
});
console.log(sum);

However, we could use the reduce function to avoid using loops and the need to use mutable data, whose final intention is easier to comprehend:

const sum = arrayOfNumbers.reduce((accumulator, number) => 
accumulator + number 
);
console.log(sum);

In summary, loops could imply that additional effort is needed to read written code and reduce its predictability.

Loop-free coding makes our code declarative instead of imperative, thus simplifying it so that we have a better understanding of its purpose. This also allows us to apply generalized reasoning and better integration to immutable data.

Bosque encourages us to write loop-free code by providing a series of useful methods for working with collections and arrays through algebraic bulk operations.

Indeterminate behaviors

Sometimes, when we compile a program, we don't think we'll encounter any problems. However, when we do execute the code, the result is different from what we had expected. This is called an indeterminate behavior.

Although some algorithms are non-deterministic by design, this implies that, by using the same input, we could expect different results. This could increase the complexity of controlling possible error scenarios.

Some examples of this include attempting to assign values in a matrix beyond the established limits, an unexpected resulting from a math operation due to type inference, or concurrent code execution.

Bosque proposes programs with unique results for the same incoming parameters in order to simplify how the written code is understood. It also helps us avoid errors due to unforeseen execution flows or unexpected behavior.

To achieve this goal, it is necessary to eliminate indeterminate behavior sources such as uninitialized variable support, mutable data, unstable enumeration order, and so on.

Additionally, Bosque proposes eliminating environmental sources of indeterminism such as I/O, random numbers, UUID generation transferring this responsibility to the runtime host, and decoupling it from the language core. Due to this, the host will be responsible for managing the environment's interaction.

That is why Bosque programmers will never see intermittent production failures and will always have more stable and reliable code.

Data invariant violations

The invariance concept guarantees that a property or condition will always comply with predefined conditions, so assumptions can be made without incurring errors. This allows for design-by-contract implementation.

Within a loop, the invariant is represented as the necessary instructions to bring the precondition's value toward the postcondition's fulfillment. For example, if we want to have the sum of numbers in an array, the invariant would be the instructions to accumulate each value's sum. Most programming languages provide operators with access and update elements in arrays/tuples/objects, which changes the state of an object through an imperative multi-step process, making it difficult to track all the changes as a range of mistakes can be made.

Bosque proposes that we use algebraic bulk data operators, which help us focus on the overall intent of the code through algebraic reasoning instead of using individual steps. Let's look at some examples of bulk operations that have been written in Bosque.

We can get the elements located at positions 0 and 2 with the following code:

(@[7 , 8 , 9 ] ) @[0 , 2 ] ;      // @[7, 9] 

Alternatively, we update the value of position 0 by 5 and assign position 3 the value of 1. Consequently, position 2 will be assigned none:

(@[7 , 8] <~(0=5, 3=1);          / @[5, 8, none, 1]

Then, we can add the value 5 at the end:

(@[7 , 8] <+(@[5]);              // @[7, 8, 5]

Don't worry if you don't fully understand the previous code. We'll learn how to build bulk functions in more detail in Chapter 3, Bosque Key features.

Aliasing

At execution time, the same memory position can typically be accessed through different symbolic names. So, when we modify this value through one of these names, the value is changed for all the other names. We call this situation aliasing, which can generate unexpected behaviors and errors that will be difficult to identify.

A practical situation occurs in a buffer overflow scenario, as we know some programming languages allow manual memory management, so if the amount of data in the reserved area (buffer) is not adequately controlled, this additional data will be written in the adjacent area, thus overwriting the original content, which will produce unexpected behavior or a segmentation fault.

The programming languages that we use today having implementations based on particular hardware architectures, for example, how the information is stored in memory through different names or how pointer aliases work, because they could be different in some languages.

On the other hand, using aliases requires that we maintain a specific program execution order to obtain the expected behavior. Write access must be carried out in the same order in which it was written. This implies a big challenge for reordering optimizations.

The immutable nature of values in Bosque means that we only need to use read-only pointers, so analyzing aliases is not necessary, thus simplifying our problem.

How the experiment is going so far

Bosque was born from an investigation paper based on the idea of questioning the causes of accidental complexity and proposing a solution that tries to eliminate this from the design of a new language. This paper exposed an interesting setting about how we could improve productivity, have clearer, more legible code, and, in turn, have a smaller margin for committing errors during the development process – all of which can be done by eliminating the causes of complexity.

Later, the language was published as an open source project on GitHub, ready to receive support and community contributions. During this stage, Bosque ceased to be a prototype or experimental language for starting a roadmap to complete its development. It did this by implementing many of the basic characteristics, which turned it into a language for developing applications. However, at the time of writing this book, version 1.0 has not been released yet.

In this process, elements such as commentaries, core libraries, and tools were added that simplify the curve of its adoption by new developers. A series of characteristics were also added for its possible applications. If we're ready to sacrifice things that haven't been implemented yet to adopt regularized programming and to start to change our ways of thinking and solving problems, Bosque is a good choice.

What next?

According to the imminent implementations roadmap that should pop up in the next few months, the following will be coming next:

  • Memoization and singleton pragmas
  • Module/package support
  • Improvements to the core collection libraries
  • Earlier microframeworks, to simplify the development and adoption process
  • N-API native modules so that we can use Bosque via Node.js
  • Integration with the Morphir Project
  • Multiple file compilation

Let's look at some cases where regularized programming and the Bosque approach might be more suitable than other languages.

Bosque applications

As we know, we can try to build a house with Lego, but this could be a much more difficult task than doing so with bricks, iron, and mortar. Although we can do something with different tools, some are more appropriate than others. That is why the following question always arises when we explore a new programming language: What are the applications where this language would be more appropriate over others that I already know about? We will try to answer this question by cover a few scenarios, although this does not imply that these are the only things we can do with Bosque.

Cloud-first development

One of the main challenges of new, trending technologies such as serverless applications, microservices architecture, and IoT is reaching interoperability with a minimum computational cost. Nowadays, we must deal with serializing and deserializing messages or the slow response times of cold services starting up.

Bosque includes features such as API types to simplify the development of APIs. Its initialization design allows a zero-cost load for cold startups, in addition to characteristics such as immutability and its deterministic nature, which will enable us to build high-performance and resilient applications for cloud environments.

Automatic verification

One of the advantages of a programming language that allows you to implement models based on formal reasoning is that this can be analyzed by tools that allow us to identify and eliminate errors through verification and validation processes. This improves the reliability of the execution's results. Some of the application settings could be as follows:

  • Cryptographical protocols
  • Implementation of finite state machines
  • A network's mathematical models

Synthesis programming

The deterministic nature of Bosque makes it an ideal candidate for the application of AI for code synthesis from formal specifications. This has been an existing challenge since the first days of AI as a study branch, so this synergy could be fascinating.

Summary

Bosque is a new high-level programming language based on a new paradigm called regularized programming, which proposes eliminating accidental complexity sources.

Accidental complexity occurs during the evolutionary process of programming languages as they adapt to new contexts and implement various paradigms.

Eliminating complexity sources allows us to simplify how we write code, allowing developers to focus on the problem's core. This also enables us to write programs that are more predictable, readable, and reliable.

A simple, deterministic, and readable language is suitable for solving the challenges that new technologies bring, such as IoT development, serverless applications, and cloud-first solutions. So, Bosque could be an exciting language for your next project if you consider yourself an early adopter.

Now that you've read this chapter, we understand what the Bosque project is and what the regularized programming paradigm proposes. As a result, you have a better idea of the accidental complexity problem in the programming languages that are available today and are ready to consider Bosque as a new alternative for future projects.

In the next chapter, we will prepare our development environment so that we can start writing programs in Bosque.

Questions

  1. What is the Bosque project?
  2. What is the regularized programming paradigm?
  3. What is accidental complexity?
  4. Why should you choose Bosque for your next project?

Further reading

Here are some additional reference materials that you may wish to refer to regarding what was covered in this chapter:

  • Dijkstra, E. W. (1968). Go To Statement Considered Harmful. Communications of the ACM, 147-148.
  • Brooks, F. P. (1987). No Silver Bullet – Essence and Accident in Software Engineering. Computer, 10-19.
  • Marron, M. (2019). Regularized Programming with the Bosque Language. Microsoft Research.
  • Jonathan Goldstein, A. A. (2020). A.M.B.R.O.S.I.A: providing performant virtual resiliency for distributed applications. Proceedings of the VLDB Endowment.
  • Harper, R. (2011). Programming in Standard ML. Carnegie Mellon University.
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • 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

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.

Who is this book 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.

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
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 30, 2021
Length: 336 pages
Edition : 1st
Language : English
ISBN-13 : 9781839211973
Vendor :
Microsoft
Category :
Languages :

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Publication date : Apr 30, 2021
Length: 336 pages
Edition : 1st
Language : English
ISBN-13 : 9781839211973
Vendor :
Microsoft
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 124.97
Learn Bosque Programming
$43.99
The TypeScript Workshop
$43.99
TypeScript 4 Design Patterns and Best Practices
$36.99
Total $ 124.97 Stars icon

Table of Contents

19 Chapters
Section 1: Introduction Chevron down icon Chevron up icon
Chapter 1: Exploring Bosque Chevron down icon Chevron up icon
Chapter 2: Configuring the Bosque Environment Chevron down icon Chevron up icon
Chapter 3: Bosque Key Features Chevron down icon Chevron up icon
Section 2: The Bosque Language Overview Chevron down icon Chevron up icon
Chapter 4: Entrypoint Function Chevron down icon Chevron up icon
Chapter 5: Types and Operators Chevron down icon Chevron up icon
Chapter 6: Bosque Statements Chevron down icon Chevron up icon
Chapter 7: Project: Bosque in the Cloud Chevron down icon Chevron up icon
Section 3: Practicing Bosque Chevron down icon Chevron up icon
Chapter 8: Expressions in Bosque Chevron down icon Chevron up icon
Chapter 9: Collections Chevron down icon Chevron up icon
Chapter 10: Iterative Processing and Recursion Chevron down icon Chevron up icon
Chapter 11: Project: AI Classifier Chevron down icon Chevron up icon
Section 4: Exploring Advanced Features Chevron down icon Chevron up icon
Chapter 12: Namespaces, Concepts, and Entities Chevron down icon Chevron up icon
Chapter 13: Testing in Bosque Chevron down icon Chevron up icon
Chapter 14: Project: Path Optimizer Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3
(6 Ratings)
5 star 33.3%
4 star 66.7%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




POE Jun 09, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The authors did a phenomenal job introducing Microsoft’s new open-source programming language, Bosque. The book starts with relevant history and, most importantly, details the importance of Bosque to developers. Just when you think there is no room for another programming language, Bosque is introduced, and this book serves as a great guide. Yu will need to install Node.js, NPM, TypeScript, and a C++ compiler on your computer to follow the programming examples. The book’s early chapters provide sufficient details to get you up and running.This book was appropriately written for experienced developers. The assumed programming knowledge will help readers quickly grasp the new language’s constructs as well as the regularized programming paradigm. Basic topics include language features, data types, loops, recursion, and syntax. More advanced topics include how to implement the cloud computing with Bosque, expressions, collections, testing, and more.The book also includes two excellent appendices that have more advanced Bosque-related concepts as well as a look at Bosque’s future. All said, this book is a great read for any developer looking to increase efficiency or just to try something new.
Amazon Verified review Amazon
S M Jun 11, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I had only heard about Bosque before in passing, but I was a skeptic. One more programming language. Why? The authors explain in detail what the language aims to solve and how to install/configure it. And then, throughout the rest of book proceed to flesh out a comprehensive reference. It's well-organized, going from fundamentals to more advanced topics. As a data scientist, I particularly enjoyed the "Project: A.I. Classifier" chapter which provided insight into how you can put many of the elements learned in previous chapters together to train a machine learning model.
Amazon Verified review Amazon
Swati Srivastava Jul 31, 2021
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
This book serves as a great cookbook for Bosque - Microsoft's new open-source programming language. The thing I like about this book is that it assumes nothing. It starts off with explaining why another programming language is needed, how to setup an environment (which is huge because without this the rest of the book will be useless and most beginners get stumped at this step), what are its building blocks, how to come up with complex stuff and finally how to test your code. It also includes a few exercises which I haven't practiced yet, but looking at the quality of the rest of the book, I am sure they will be useful. All in all, I recommend this book to anyone who wants to explore Bosque!
Amazon Verified review Amazon
Jason William Alls Jun 21, 2021
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
The book itself is very well-written. If it were not for this book, I would have never known such a programming language by Microsoft called Bosque. This programming language is an open-source programming language actively developed by Microsoft and is still in its infant stages. Therefore, the language and its setup are still very much in flux. And that is where I struggled with this book. It is indeed accurate for the date and time it was written. But the setup instructions since then seem to have changed somewhat, and unfortunately, the website instructions also seem outdated as they don't work. Because of the difficulty in setting up the language with the language setup changing over time, this book gets 4 stars instead of 5.But if we see past the teething problems of downloading the language, building it, and deploying it to VSCode, then we have an up-and-coming computer programming language by Microsoft that is very much geared towards cloud computer programming and deployment.The book does an excellent job of teaching you the ins and outs of computer programming using the Bosque programming language and providing why we need yet another programming language. And this book makes that case extremely well.This book is a very good introduction to the Bosque language, why it exists, and how to write projects with it, compile them, and deploy them to the cloud using Microsoft Azure. Testing, contributing to the project, expressions, and AI classification are all covered in this book.I am confident that should you read this book as an introduction to Bosque, that you will not be disappointed. Just keep in mind that the language is new and still in active development. If you encounter problems with the source code, by all means, contribute to the project.In the latest versions of the project, the make-exe script and Dockerfile appear to have been removed. The second chapter of this book mentions executing the non-existent make-exe script, and online resources make use of the non-existent Dokcerfile instead. So, to get the software to run on your computer, you may need to investigate the check-in history of the project, and then download the version that suits your needs.Apart from not being able to compile and run the source, I found the book interesting in its overall subject matter. I like the conversational style of the book and the instructions for performing tasks.Chapter 7 discussed using Boque in the cloud. The chapter used node and express to expose our API and I found this particularly interesting.I see this book evolving over time with new editions as the Bosque programming language is further developed by Microsoft and the open-source community.
Amazon Verified review Amazon
ivo balbaert Aug 31, 2021
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Having worked through half of the book, I probably have a good view on it. The book presents a good overview of Bosque and how it is likely to be used. Keep in mind however that it is targeted at version 0.5 of the language, which can be found in the LearnBosqueProgramming branch on GitHub.The book cannot be followed from the master branch, which is at the moment of writing incomplete. It is difficult to estimate how much versions 0.8 and higher will differ from the version 0.5 described in the book. Given the difficulty of writing a book on a language still in development, the authors did a good job. However, quite a few of the examples don't (yet) work because the used feature wasn't yet implemented or buggy (this is mostly indicated in the text). Also I noticed quite a few errors in the code samples (typographical, old syntax, etc.), some strange uses of English, and a few inconsistencies in the book structure.(e.g. the term value pack used at a certain moment, referring to a previous explanation where the term was not used). A positive point is that the authors made the effort to write realistic examples, and they included 3 projects to illustrate how Bosque could be used in real-world software; that's why I scored it 4/5. All in all, the book provides a good introduction to Bosque, fulfilling a need because of the lack of tutorials and consistent documentation on the GitHub Bosque site at the moment. The book deserves a good update when Bosque v1.0 will be published.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
Modal Close icon
Modal Close icon