{"id":19157740,"url":"https://github.com/shybyte/exercises-in-programming-style-rust","last_synced_at":"2026-06-16T12:30:17.315Z","repository":{"id":142064092,"uuid":"91297894","full_name":"shybyte/exercises-in-programming-style-rust","owner":"shybyte","description":"Exercises in Programming Style - Rust Version","archived":false,"fork":false,"pushed_at":"2017-05-26T07:32:22.000Z","size":283,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-03T20:27:55.884Z","etag":null,"topics":["exercises","programming-paradigms","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shybyte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-15T05:19:42.000Z","updated_at":"2017-05-15T08:07:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"be5c2fe9-4483-4c8b-97c5-38776b66c568","html_url":"https://github.com/shybyte/exercises-in-programming-style-rust","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shybyte%2Fexercises-in-programming-style-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shybyte%2Fexercises-in-programming-style-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shybyte%2Fexercises-in-programming-style-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shybyte%2Fexercises-in-programming-style-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shybyte","download_url":"https://codeload.github.com/shybyte/exercises-in-programming-style-rust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240241820,"owners_count":19770466,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["exercises","programming-paradigms","rust"],"created_at":"2024-11-09T08:41:58.526Z","updated_at":"2026-06-16T12:30:17.075Z","avatar_url":"https://github.com/shybyte.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Exercises in Programming Style - Rust Version [![Build Status](https://travis-ci.org/shybyte/exercises-in-programming-style-rust.svg?branch=master)](https://travis-ci.org/shybyte/exercises-in-programming-style-rust)\n \nComprehensive collection of well-known, and not so well-known, programming styles using a simple computational task, *term frequency*.\nThis is the Rust Version. For the original python version and the companion book see\n[https://github.com/crista/exercises-in-programming-style](https://github.com/crista/exercises-in-programming-style).\n\n## List of Exercises\n\n### Part 1 - Historical\n\nFeel the pain of programming in 1970. \n\n* Good old times - Minimal memory and no identifiers\n* Go Forth - Working on a stack\n\n### Part 2 - Basic Styles\n\nIt happens every day. You have seen it already.\n\n* [Monolithic](src/bin/03-monolith.md) - One big program with no named abstractions and no clever library usage\n* [Cookbook](src/bin/04-cookbook.md) - Procedural code with global state\n* [Pipeline](src/bin/05-pipeline.md) - (Impure) Nested Functions\n* [Code Golf](src/bin/06-code-golf.md) - Short code by clever std library usage \n\n### Part 3 - Function Composition\n\nCombine functions in interesting ways.\n\n* [Infinite Mirror](src/bin/07-infinite-mirror.md) - Recursively, call yourself.\n* Kick Forward - Callback style like in good old javascript\n* [The One](src/bin/09-the-one.md) - Use a kind of a Monad to create a pipeline, Functional composition\n\n\n### Part 4 - Objects and Object Interaction\n\nStateful encapsulated things talk with other encapsulated stateful things. \n\n* [Things](src/bin/10-things.md) - Object-oriented \n* Letterbox - Communication by untyped messages between objects\n* Closed Maps - An Object is just a Map of functions\n* Abstract Things - Objects implement Interfaces (Traits)\n* Hollywood - Objects need to register at a fancy framework, which calls the objects\n* Bulletin Board - Objects communicate via an Eventbus\n\n### Part 5 - Reflection and Metaprogramming\n\nWhen code knows about itself and hacks itself. \n\n* Introspective - Code know about itself\n* Reflective - Code can modify itself\n* Aspects - Add general aspects like logging to existing code, without modifying the source code\n* Plugins - Load external code without recompiling \n\n### Part 6 - Adversity \n\nHow to prevent errors or deal with it.\n\n* Constructivist - Check Arguments. If something goes wrong, use fallbacks and defaults\n* Tantrum - Check Arguments. Handle problems when the occur by (logging and) forwarding the error to the caller\n* Passive Aggressive - Check Arguments. Forward problems to the caller as default (Exceptions)\n* Declared Intentions - Declare and enforce types\n* Quarantine - Handle IO differently (Kind of IO monad)\n\n### Part 7 - Data-Centric\n\nIt's about relations between data.\n\n* Persistent Table - Put data in a (relational) database and query it\n* Spreadsheet - Like dependent cells in a excel sheet\n* Lazy Rivers - Streams of data instead of loading everything into memory at once\n\n### Part 8 - Concurrency\n\nDoing work in parallel. \n\n* Actors - Like Letterbox but things have independent threads of execution\n* Dataspaces - Concurrent units read/store data in synchronized common data spaces\n* Map Reduce - Divide data in blocks, map over it (parallelized) und reduce it to result\n* Double Map Reduce - Like Map Reduce, but result of first map step is regrouped for a second parallelized map step which makes reduce trivial or unnecessary \n\n### Part 9 - Interactivity\n\nInteracting with an user or client.\n\n* Trinity - The famous MVC = Model-View-Controller Pattern\n* Restful - Client accesses resources on server by using uniform resource identifiers\n\n### Part 10 - Rusty\n\nDo it in the Rusty Way.\n\n* [Rusty](src/bin/42-rusty.md) - Idiomatic efficient Rust solution with complete error handling\n\n\n\n\n## Run one variant\n\n```\n  cargo run --bin 06-code-golf test-data/input/simple.txt\n```\n\n\n## Run and test everything\n\n\n```\n  ./test.sh\n```\n\n\n## License\n\nMIT\n\n## Copyright\n\nCopyright (c) 2017 Marco Stahl\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshybyte%2Fexercises-in-programming-style-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshybyte%2Fexercises-in-programming-style-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshybyte%2Fexercises-in-programming-style-rust/lists"}