0%

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.

Table of Contents

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