Learn Type-Driven Development: Benefit from type systems to build reliable and safe applications using ReasonML 3

Yawar Amin, Kamon Ayeva

  • 出版商: Packt Publishing
  • 出版日期: 2018-12-26
  • 售價: $1,200
  • 貴賓價: 9.5$1,140
  • 語言: 英文
  • 頁數: 180
  • 裝訂: Paperback
  • ISBN: 1788838017
  • ISBN-13: 9781788838016
  • 相關分類: JavaScript
  • 立即出貨 (庫存=1)

商品描述

A fast paced guide for JavaScript developers for writing safe, fast, and reusable code by leveraging ResaonML's strong static type system

Key Features

  • Reduce code errors with the power of type systems
  • Employ static typechecking and genericity to promote code reuse and consistency
  • Understand functional programming which is the foundation of type-driven development

Book Description

Type-driven development is an approach that uses a static type system to achieve results including safety and efficiency. Types are used to express relationships and other assumptions directly in the code, and these assumptions are enforced by the compiler before the code is run. Learn Type-Driven Development covers how to use these type systems to check the logical consistency of your code.

This book begins with the basic idea behind type-driven development. You'll learn about values (or terms) and how they contrast with types. As you progress through the chapters, you'll cover how to combine types and values inside modules and build structured types out of simpler ones. You'll then understand how to express choices or alternatives directly in the type system using variants, polymorphic variants, and generalized algebraic data types. You'll also get to grips with sum types, build sophisticated data types from generics, and explore functions that express change in the types of values. In the concluding chapters, you'll cover advanced techniques for code reuse, such as parametric polymorphism and subtyping.

By end of this book, you will have learned how to iterate through a type-driven process of solving coding problems using static types, together with dynamic behavior, to obtain more safety and speed.

What you will learn

  • Use static types to capture information, making programs safer and faster
  • Learn ReasonML from experienced type-driven developers
  • Enhance safety by simply using basic types
  • Understand the most important type-driven concepts with simple examples
  • Explore a design space using static typing and find the best way to express your system rules
  • Use static types and dynamic runtime in harmony to write even safer and faster code

Who this book is for

If you're a programmer working with dynamically typed languages and are looking for ways to mitigate production runtime errors, Learn Type-Driven Development is for you. You'll also find this book helpful if you're a programmer working with statically typed languages looking for increased safety and improved performance.

Table of Contents

  1. Start Type-Driven Development
  2. Program with types and values
  3. Package types and values together
  4. Group values together in types
  5. Put alternative values in types
  6. Make types that can 'slot in' any other type
  7. " Make types that represent operations"
  8. "Reuse code with many different types"
  9. "Extend types with new behavior"
  10. "Bring it all together"

商品描述(中文翻譯)

一本針對JavaScript開發人員的快節奏指南,教你如何透過ResaonML的強大靜態類型系統撰寫安全、快速和可重複使用的程式碼。

主要特點:
- 利用類型系統減少程式碼錯誤
- 使用靜態類型檢查和泛型促進程式碼重複使用和一致性
- 瞭解作為類型驅動開發基礎的函數式編程

書籍描述:
類型驅動開發是一種利用靜態類型系統實現安全和效率的方法。類型用於直接在程式碼中表達關係和其他假設,並在程式碼運行之前由編譯器強制執行這些假設。《學習類型驅動開發》介紹了如何使用這些類型系統檢查程式碼的邏輯一致性。

本書從類型驅動開發的基本概念開始。你將學習有關值(或項目)以及它們與類型的對比。隨著章節的進展,你將學習如何在模塊中結合類型和值,並從較簡單的類型構建結構化類型。然後,你將瞭解如何使用變體、多態變體和泛化代數數據類型直接在類型系統中表達選擇或替代方案。你還將掌握總和類型,從泛型中構建複雜的數據類型,並探索表達值類型變化的函數。在結尾的章節中,你將學習代碼重複使用的高級技巧,例如參數化多態和子類型。

通過閱讀本書,你將學習如何使用靜態類型迭代解決編碼問題的過程,並結合動態行為,以獲得更高的安全性和速度。

你將學到:
- 使用靜態類型捕獲信息,使程式更安全、更快
- 從有經驗的類型驅動開發人員學習ReasonML
- 通過使用基本類型來增強安全性
- 通過簡單的示例瞭解最重要的類型驅動概念
- 使用靜態類型探索設計空間,找到表達系統規則的最佳方式
- 在靜態類型和動態運行時之間和諧地使用,編寫更安全、更快的程式碼

本書適合對動態類型語言有經驗的程式設計師,並希望減少生產環境運行時錯誤的方式。如果你是使用靜態類型語言的程式設計師,並希望提高安全性和性能,本書也將對你有所幫助。

目錄:
1. 開始類型驅動開發
2. 使用類型和值進行程式設計
3. 將類型和值打包在一起
4. 在類型中將值分組
5. 在類型中放置替代值
6. 創建可以“插入”任何其他類型的類型
7. 創建表示操作的類型
8. 使用多種不同類型的代碼重複使用
9. 通過新行為擴展類型
10. 將所有內容結合起來