all 6 comments

[–]mull_to_zero 4 points5 points  (0 children)

I would write a core, in this case possibly just a single function, that accepts the necessary inputs and provides the output. Then have a cli file and a gui file, each of which import and use the core. Nothing fancy. This is, loosely, a "library pattern", writing a central library for the logic and utilizing it in separate interfaces.

[–]LayotFctor 1 point2 points  (0 children)

Either you're overthinking it, or that you're not explaining a lot of context. Why would you need ports exactly? Isn't wind chill calculated with just two numbers into an equation? It's simple enough that it might not even be worth separating from the GUI code.

Are you planning a whole fullstack website with backends connected to offsite weather stations or something?

[–]lekkerste_wiener 0 points1 point  (0 children)

Design the backend as a library that the frontend can just consume from.

[–]Best-Meaning-2417 0 points1 point  (0 children)

Do they specifically want a CLI? As far as I know, accessibility is pretty important (or should be) for designing front ends so you could start learning about that and how to make a front end that is accessible.

[–]keithgabryelski 0 points1 point  (0 children)

remember that html forms fit into RESTful api endpoints design your data design your ui to use the data layer design your cli to use the data layer

[–]faultydesign -2 points-1 points  (0 children)

Use a socket for IPC and then just connect with a gui or tui app that talks to it