about
11/07/2023
IdiomsAndPatterns Repo
Idioms and Patterns Repository
Comparing C#, C++, and Rust
Quick Status
1.0 Contents
2.0 Snippets
-
Tooling Tools to develop C#, C++, and Rust on both Windows and Linux -
Hello World use C# with dotnet CLI, C++ with CMake, and Rust with cargo to build Hello World -
Hello Objects Declare Classes/Structs and create instances. -
Manage data Explore types. Consider bind, copy, assign, and move operations -
Basic DIP Demonstrate basic Dependency Inversion Principle -
Generic DIP Demonstrate Dependency Inversion Principle using Generic Trait -
Iteration Demonstrate iteration through strings, slices, and byte arrays -
Create static libraries Explore projects with library and console executive -
Explore performance use timers written in each language to compare performances -
Explore ownership implement simple graphs using C# references, C++ (smart) ptrs, and Rust indexes -
Sharing with Rc<T> and Arc<T> Shared data -
Explore strings C#, C++, and Rust all use different string types -
Iterations Iterating over byte arrays and strings -
More strings Creating, mutating, converting -
Functions Syntax, passing by value and reference, return types -
User defined types Declaring, instantiating, methods, access, state mutation -
Generics Parameterization, Policies, lifetimes -
Traits Bounds on generic types, Static and dynamic dispatching -
Lambdas Syntax, data capture, transporting across scopes -
Liskov Substitution Principle Inheritance, dynamic dispatch, trait objects -
Dependency Inversion Principle Interfaces, object factories, trait objects -
Decorator Pattern Structure, application flow -
Observer Pattern Structure, application flow
3.0 Build
- C# code was built from the command line with dotnet.
- C++ code was built from the command line using CMake.
- Rust code was built from the command line using the rust cargo tool.