-
Notifications
You must be signed in to change notification settings - Fork 1
Improve README with framework introduction, philosophy, effect system explanation, and comprehensive examples #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
README.md
Outdated
|
||
Roots its foundations on the concept of **computational fields**: | ||
a _distributed data structure_ manipulated by _aggregate_ functions implementing the business logic for **large-scale distributed systems**. | ||
## 🌟 What is Aggregate Programming? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, do not use emoji @copilot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot address this issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed all emojis from section headers in commit 65055a8.
README.md
Outdated
def scalaVersion = "3.7.3" | ||
|
||
def ivyDeps = Agg( | ||
ivy"it.unibo.scafi::scafi3-core:1.0.5", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use mvn
dependency style @copilot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated Mill dependencies to Maven style (e.g., ivy"it.unibo.scafi:scafi3-core_3:1.0.5"
) in commit 65055a8.
README.md
Outdated
|
||
- **Examples**: Check the test suite for comprehensive examples | ||
- **API Documentation**: [ScalaDoc](https://scafi.github.io/scafi3/) | ||
- **Research**: Based on the [Aggregate Computing](https://doi.org/10.1109/MC.2015.261) research |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add also this doi: https://doi.org/10.1016/j.jss.2024.111976 @copilot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added JSS 2024 paper DOI (https://doi.org/10.1016/j.jss.2024.111976) to research references in commit 65055a8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR transforms the README.md from a minimal 3-sentence description into comprehensive documentation for ScaFi 3, providing a complete introduction to the framework's concepts, philosophy, and practical usage.
- Introduces Aggregate Programming paradigm and computational fields concept
- Documents ScaFi 3's philosophy emphasizing effect system integration and type safety
- Adds complete installation instructions for both SBT and Mill build tools with cross-platform support
- Provides five practical code examples demonstrating key aggregate programming patterns
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
65055a8
to
beb57b1
Compare
README.md
Outdated
def scalaVersion = "3.7.3" | ||
|
||
def ivyDeps = Agg( | ||
ivy"it.unibo.scafi:scafi3-core_3:1.0.5", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot use mvn
for dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated Mill dependencies to use Maven-style notation with :::
for cross-version dependencies (e.g., ivy"it.unibo.scafi:::scafi3-core:1.0.5"
).
README.md
Outdated
def scalaVersion = "3.7.3" | ||
|
||
def ivyDeps = Agg( | ||
ivy"it.unibo.scafi:::scafi3-core:1.0.5", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ivy"it.unibo.scafi:::scafi3-core:1.0.5", | |
mvn"it.unibo.scafi::scafi3-core:1.0.5", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot do the same for the other code snippets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated all Mill code snippets to use mvn"..."
notation with ::
for cross-version dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated all Mill code snippets to use mvn"..."
notation with ::
for cross-version dependencies.
@cric96 ask for review, please ahahah |
6c241e3
to
7c1d8b2
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #153 +/- ##
=======================================
Coverage 65.80% 65.80%
=======================================
Files 49 49
Lines 693 693
Branches 58 58
=======================================
Hits 456 456
Misses 237 237 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The README needs to be improved. Sometimes, the code is too high-level. Some details are irrelevant.
a _distributed data structure_ manipulated by _aggregate_ functions implementing the business logic for **large-scale distributed systems**. | ||
## What is Aggregate Programming? | ||
|
||
Aggregate Programming enables you to program collective behaviors across networks of devices—from IoT sensors to robot swarms—by thinking in terms of **computational fields**: distributed data structures that span across the entire system. Instead of programming individual devices, you express global behaviors that automatically adapt to the network topology and evolve over time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I would perhaps include a “typical” image of our compositional/field-based approach along with the result in a simulation (gif).
### Effect System Integration | ||
ScaFi 3 leverages Scala 3's advanced type system and **effect tracking** to provide compile-time safety guarantees: | ||
|
||
- **Safer Exceptions**: Using Scala 3's `throws` clauses, functions explicitly declare what exceptions they can throw, enabling better error handling at compile time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhm I perhaps avoid writing this level of detail here. The rest is okay but the part about safer exception it may be too deep.
val roundCount = evolve(0)(count => count + 1) | ||
|
||
// share: compute values while sharing them with neighbors | ||
val consensus = share(0)(neighborValues => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not call this "consensus". It will a different value for each node. Or we should change that with a "max" aggregate, otherwise I think it will not converge to a single value
README.md
Outdated
|
||
### Distance Gradient | ||
|
||
A classic aggregate programming example—computing distance from a source: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
computing "hop count" distance from @copilot fix please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed description to "computing hop count distance from a source".
import it.unibo.scafi.libraries.All.* | ||
|
||
def conditionalBehavior(using context: ExchangeCalculus & ExchangeLanguage { type DeviceId = Int }): String = | ||
val distanceFromSource = gradient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thinks that this it is broken. Where gradient comes from? Add a parameter @copilot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added gradient: Double
parameter to conditionalBehavior
function to fix the undefined reference.
|
||
### Exchange Calculus: The Foundation | ||
|
||
Under the hood, ScaFi implements the **Exchange Calculus**, a more expressive variant of field calculus: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expressive? In the sense that it is possible to express more behaviours w.r.t. standard calculus? It makes sense but perhaps it is not something that I would put in the readme.
}(localId) | ||
``` | ||
|
||
### Complete Example: Self-Healing Gradient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhm this is similar to the one already showed. Moreover, hopDistance should be a sharedData, not just a Double
- Values received from aligned neighbors | ||
- Combinators for field manipulation (map, flatMap, etc.) | ||
|
||
### Alignment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this from the README, @nicolasfara? Too low level
|
||
## Key Concepts | ||
|
||
### Shared Data Types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember correctly, this may also be a single value since it can be used like normal scafi. Am i right @nicolasfara ?
c695609
to
b745ad6
Compare
…tructions Co-authored-by: nicolasfara <[email protected]>
Co-authored-by: nicolasfara <[email protected]>
Co-authored-by: nicolasfara <[email protected]>
Co-authored-by: nicolasfara <[email protected]>
Co-authored-by: nicolasfara <[email protected]>
…vior Co-authored-by: cric96 <[email protected]>
b745ad6
to
8763c38
Compare
Overview
This PR significantly expands the README.md to provide comprehensive documentation for ScaFi 3, transforming it from a minimal 3-sentence description into a complete guide for newcomers and potential users.
Changes Made
Framework Introduction
Philosophy and Design
The README now articulates ScaFi 3's core design principles:
Computational Fields First: Values mapped across space and time in distributed networks, with fields as first-class citizens
Effect System Integration: Highlighted ScaFi 3's use of Scala 3's advanced type system features:
throws
clauses for safer exception handling at compile timeusing
/given
) for implicit context passing without boilerplateProgramming Style: Declarative, composable, resilient, and pure approach to distributed programming
Installation Instructions
Added complete setup instructions for both build tools:
SBT: Dependencies for both cross-platform (
%%%
) and platform-specific (%%
) scenariosMill: Basic and cross-platform configuration examples using
mvn
notation with::
for cross-version dependenciesCode Examples
Added five practical examples demonstrating key concepts:
neighborValues
,evolve
, andshare
primitivesbranch
to create independent computational domains (with gradient parameter)All examples use the simplified
All.*
import pattern for easier adoption.Additional Sections
Style and Formatting
mvn
notation with::
for cross-version dependenciesImpact
The README now serves as a complete introduction to the framework, enabling new users to understand the philosophy, install the library, and write their first aggregate programs without needing to dive into source code or external documentation.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.