about
03/02/2024
Bits Repository
Bits Code in github Repo

Bits Code Repository

organized bits of syntax, idoms, and patterns

Quick Status Short Bits Enable easy comparison of languages Demonstration code Demos in C++, Rust, C#, Python, and JavaScript Documentation yes Test cases NA Static library NA Build requires C++, Rust, C#, and Python installed Planned changes Add more bits
Bits Index Bits Track Summary Overview of Bits Bits Repository Document for Bits code repository Introduction Initial language comparisons Tooling Compilers, builders, VS Code IDE C++ Hello "Hello World" program with links to Rust, C#, Python, and JavaScript C++ Data Basic types and instances C++ Objects Standard and user-defined types C++ Iteration Iterators and iteration    
Note: Bits pages are under construction. Hello, Data, and Object pages are nearly complete, the remaining, Generics and Iter are works in progress.

1.0 Contents

The purpose of Bits is to present a sequence of compileable code snippets that illustrate syntax, idioms, and small patterns, for each of a set of languages. With these a user can learn a new language by looking at a sequence of small codes in the new language and directly compare each of those with snippets from a familiar language. At this time we provide code for the programming languages: C++, Rust, C#, Python, and JavaScript. Bits_Intro, Bits_Tooling,
Bits_HelloCpp, Bits_HelloRust, Bits_HelloCSharp, Bits_HelloPython, Bits_HelloJs
For help navigating among the Bits pages click "Help" button on the top menu.
There are a couple of necessary inconsistencies that this will help you sort out.
The video below will give you, in less than ten minutes, a brief introduction to the Bits track. It describes the purpose and some of the installed parts.
You will probably want to view "picture-in-picture" or "full-screen" so details are large enough to be seen easily.
Running as "picture in picture" allows you to move to other web pages while still watching and listening to the video.
The first three items in the Bits list, below, are introductory, helping you get ready to start coding in any of the five languages. They provide step-by-step instructions for installing and using development tools appropriate for each language. The rest of the items, Hello, Data, Objects, ... are coding examples with instructions for building, running, and debugging code.

2.0 Bits - Background & Code Snippets

Here are the currently planned Bits: background information and code snippets. The ordering of some of these may change. Ordering so that each code snippet depends only on its predecessors doesn't necessary provide a good logical ordering. I'll be thinking about this as the list gets completed.

  1. Introduction Introduction to code in C#, C++, Rust, Python, and JavaScript on Windows, macOS, and Linux

  2. Tooling VS Code with tools to develop C#, C++, and Rust on Windows, Linux, and macOS

  3. References References for VS Code and languages

  4. Hello World Step-by-step instructions for setting up environment for editing and debugging code
    C++ Hello World Use C++ with CMake
    Rust Hello World Use Rust with cargo
    C# Hello World Use C# with dotnet CLI
    Python Hello World Use Python with interpreter
    JavaScript Hello World Use with HTML page

  5. Data Explore types: copy, move, and reference. Consider bind, copy, assign, and move ops

  6. Objects Declare Classes/Structs and create instances. Focus on user-defined types.

  7. Generics Demonstrate implementation and execution of generic functions and classes

  8. Iteration Demonstrate iteration through strings, slices, and user-defined collection types

  9. Data Structures Demonstrate standard data structures

  10. Generic DIP Demonstrate Dependency Inversion Principle using Generic Trait

3.0 Language Categories

Categories Comments
Types Static Types
C++, Rust, C#
Dynamic Types
C#, Python, JavaScript
Static types => types of variables and expressions are fixed at compile-time
Dynamic types => variables have the types of the data to which they bind, and can be rebound to data of a different type at run-time.
Execution Native Code
C++, Rust
Managed Code
C#, Python, JavaScript
Native code runs in a process created for its execution.
Managed code runs in a virtual machine hosted by the process created for its execution.
Similarity This page orders the languages by similarity, e.g., C++, Rust, C#, Python, and JavaScript. Each of the languages is most similar to its adjacent siblings.

4.0 References

Reference Comments
C++ Summary - Wikipedia Summary of the language, its versions, types, execution, and syntax.
C++ Reference Excellent thorough reference to the latest version of C++.
Rust Summary - Wikipedia Summary of the language, its types, execution, and syntax.
Rust Reference Rust types, syntax, and structure.
C# Summary - Wikipedia Summary of the language, its types, execution, and syntax.
C# Reference C# types, syntax, and structure.
Python Summary - Wikipedia Summary of the language, its types, execution, and syntax.
Python Reference Lexical analysis, data, execution, imports, expressions, top-level components.
JavaScript Summary - Wikipedia Excellent summary of the language, its types, execution, and syntax.
JavaScript Reference Reference organized for beginners, intermediate, and advanced.

4.0 Build

The languages have different tool chains, but the Tooling link, above, shows that build processes can be very similar. Our goals are to build on Windows, macOS, and Linux. We do that using Visual Studio Code as a text editor and building from its integrated terminal.
  • C++ code was built from the command line using CMake.
  • Rust code was built from the command line using the rust cargo tool.
  • C# code was built from the command line with dotnet CLI.
  • Python code was executed from the command line with python interpreter.
  • JavaScript code was translated and executed by loading its demo page in a modern brower (firefox).
Three of these builds, C++, Rust, and C#, work in similar ways on the cited OS platforms. Python and JavaScript are loaded and executed on demand. We will give step-by-step instructions for downloading and configuring tool chains for all these languages.
VS Code, with the help from plugins for each language, can build and debug using launch.json files. We will give step-by-step instructions for building from the terminal and launching from VS Code.

5.0 Status

The Bits UI is stable and seems to work well. It seems to be intuitive and easy to maintain. User testing is starting, and you can supply feedback here. That requires login to a github account. Code snippets and discussion are being added and should be complete by the end of Fall 2023.
  Next Prev Pages Sections About Keys