Boost your productivity and software reliability with Bosque - Microsoft’s new open-source programming language
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, modules, and interfaces 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.
Author(s): Sebastian Kaczmarek, Joel Ibaceta
Edition: 1
Publisher: Packt Publishing
Year: 2021
Language: English
Commentary: Vector PDF
Pages: 336
City: Birmingham, UK
Tags: Programming; JavaScript; Functional Programming; Node.js; TypeScript; Bosque; Cloud Computing
Cover
Title Page
Copyright and Credits
Dedication
Contributors
Table of Contents
Preface
Section 1: Introduction
Chapter 1: Exploring Bosque
Identifying the need for another language
Learning what Intermediate Representation is
Discovering regularized programming
Understanding accidental complexity
Immutability
Loop-free
Indeterminate behaviors
Data invariant violations
Aliasing
How the experiment is going so far
What next?
Bosque applications
Cloud-first development
Automatic verification
Synthesis programming
Summary
Questions
Further reading
Chapter 2: Configuring the Bosque Environment
Technical requirements
Prerequisites for Bosque
64-bit operating system
The LTS version of Node.js and NPM
TypeScript
Installing a C++ compiler
Windows
Linux
MacOS
Installing Bosque
Setting up the IDE for Bosque
Windows
Linux and MacOS
Writing a "Hello, World!" program
Understanding the code
ExeGen – Ahead-of-time Bosque compilation
Parameters for ExeGen
Summary
Questions
Further reading
Chapter 3: Bosque Key Features
Technical requirements
Identifying immutable values
The let keyword
The var keyword
The ref keyword
Introducing typed strings
SafeString
StringOf
Discovering bulk algebraic data operations
Bulk read
Bulk update
Projection
Merge
Learning iterative processing in Bosque
Identifying recursive functions in Bosque
Validating program behavior using the built-in mechanism
Summary
Questions
Further reading
Section 2: The Bosque Language Overview
Chapter 4: Entrypoint Function
Technical requirements
Why do we need an entrypoint function?
Writing our first entrypoint function
Passing arguments and returning values
Summary
Questions
Further reading
Chapter 5: Types and Operators
Technical requirements
Bosque type system
Nominal type system
Structural type system
Core types
Int
Bool
String
Float64
Typed strings
SafeString
StringOf
Operators
Unary operators
Binary operators
Logic operators
Order comparison operators
Equality comparison operators
Select operators
Summary
Questions
Further reading
Chapter 6: Bosque Statements
Technical requirements
Writing comments
Understanding variables
Using constants
Using conditionals
Understanding switch
Understanding return and yield
Understanding blocks
Writing validations
Summary
Questions
Further reading
Chapter 7: Project: Bosque in the Cloud
Technical requirements
Defining requirements
Implementing the solution
Getting the RSSI values detected by the receiver for the three known access points
Calculating the distance in meters using each of the measured RSSI values
Calculating our x, y coordinates using the 2D trilateration method
Building an API to expose our program as a web service
Running our program in the cloud
Compiling the Bosque program
Running the Express server
Making an HTTP request to our exposed API
Summary
Further reading
Section 3: Practicing Bosque
Chapter 8: Expressions in Bosque
Technical requirements
Understanding parameters handling in Bosque
Recognizing named parameters
Using rest and spread operators
Key-value argument notation
Learning about scoped access and invocations
Understanding variable scoped access
Learning about scoped invocations
Chaining in Bosque
Introducing PCode types and constructors
Recognizing PCode types
Discovering PCode constructors
Identifying access operators
The tuple typed access operator
The record typed access operator
The nominal typed access operator
Summary
Questions
Chapter 9: Collections
Technical requirements
Learning about List and ListOf
Reviewing standard List methods
Discovering Bosque additions to List
Introducing ListOf
Getting familiar with Map and DynamicMap
Reviewing standard Map methods
Discovering Bosque additions to Map
Introducing DynamicMap
Understanding Set and DynamicSet
Reviewing standard Set methods
Discovering Bosque additions to Set
Introducing DynamicSet
Discovering Stack and Queue
Reviewing Stack methods
Reviewing Queue methods
Summary
Questions
Further reading
Chapter 10: Iterative Processing and Recursion
Technical requirements
Learning about structured loops
Practicing iterative processing without structured loops
Multiplying vectors
Grouping list elements by key
Discovering the NSIterate namespace and its helper functions
The reduce() function
The steps() function
The until() and while() functions
Recursion and the recursive keyword
Summary
Questions
Further reading
Chapter 11: Project: AI Classifier
Technical requirements
Defining project requirements
Understanding the approach
Brief introduction to neural networks
Designing a model
Implementing the intelligent model
Creating the basic functionality
Writing the training algorithm
Wrapping the classification feature
Defining two entrypoint functions
Testing the program
Improving the code
Enhancing ideas and suggestions
Summary
Questions
Further reading
Chapter 12: Namespaces, Concepts, and Entities
Technical requirements
Using namespaces to organize code
Understanding concepts and entities
Concepts
Entities
Exploring fields and methods
Using inheritance
Using static methods
Understanding parametric polymorphism
Summary
Questions
Section 4: Exploring Advanced Features
Chapter 13: Testing in Bosque
Technical requirements
Discovering symbolic execution
Introducing SymTest – the Bosque symbolic testing tool
Creating an alias for the SymTest command
Command line parameters and flags
Practicing symbolic testing
Working with sanity checks in Bosque
Summary
Questions
Further reading
Chapter 14: Project Path Optimizer
Technical requirements
Defining requirements
Implementation of the program
Storing our problem data in an orderly structure
Implementing Dijkstra's algorithm to get the optimal route
Processing our data using the written algorithm and returning a human-readable format
Demo and running our program
Summary
Questions
Further reading
Appendix A: Advanced Topics
Technical requirements
Discovering the Bosque source code and the project structure
Understanding the design of a programming language
Looking at the Bosque source code
Summarizing the Bosque structure
Learning how to report bugs and feature requests
Learning how to contribute
Summary
Questions
Further reading
Appendix B: What's Next in Bosque?
Exploring the Bosque language roadmap
What we should expect in the next versions
Summary
Why subscribe?
About Packt
Other Books You May Enjoy
Index