Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Conversation

@andreamah
Copy link
Contributor

DON'T MERGE; just an small-scale example of the python microbit model design (as requested by coaches)

@andreamah
Copy link
Contributor Author

@sagarmanchanda is this what you envisioned in terms of the shim-based singleton design?

Copy link
Collaborator

@sagarmanchanda sagarmanchanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. This is exactly what I was thinking.

Although we should now think about the folder structuring too.

src
|____microbit
_____|____tests
_____|____microbit_model
__________|____microbit_model.py
__________|____display # Could be a folder if it has multiple files, otherwise just files in root
_____|____shim.py
_____|____init.py

What do you guys think about the folder structuring?

@andreamah
Copy link
Contributor Author

@sagarmanchanda I think that that directory structure sounds good! I'll try to incorporate that into the upcoming work.

Also, I was thinking that it might be better to replace

class display:
    @staticmethod
    def scroll(self, message):
        microbit_model.mb.display.scroll(self,message) 

in src/microbit/code_processing_shim.py with

display = microbit_model.mb.display

To reduce repetition with static methods mapping to actual object methods. I believe that the new version uses pass-by-reference in order to assign a simple global "display" object with the microbit model's display.

What do you think?


# EXAMPLE
# can be called simply as "show_message("string")"
def show_message(message):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's awesome, it was exactly what I was thinking as well :)

@sagarmanchanda
Copy link
Collaborator

@andreamah Good catch! Totally makes sense to directly use the methods rather than creating static mappings.

@sagarmanchanda
Copy link
Collaborator

Also thanks for doing this sample implementation! Good job. :)

@xnkevinnguyen xnkevinnguyen changed the title shim design example WIP: shim design example Jan 28, 2020
@andreamah
Copy link
Contributor Author

no intention to merge these changes yet, will ping coaches with new changes when it comes up

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants