-
Notifications
You must be signed in to change notification settings - Fork 8
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
Discuss code refactoring #22
Comments
Here are some thoughts, feel free to comment. I'll need to add to this more as I think of things. ModulesCreating Types.elmFirstly, we should break off all types and type aliases into their own module that everything else can import. This will be required when we start breaking off stuff into other modules, and it will have the advantages of making things shorter in Main.elm as well as giving people a quick way to see all data types in the application. Modules for each "page"We should probably have modules which contain the logic for each main state of the application, ie One potentially good way of doing it would be to have the "common denominator" of machine rendering in its own module, with a variable for modules to pass in their own extra shapes (and by extension, logic). Update functions and their modelsRight now, there are separate update functions for each "page" but they still return the full Helper functionsSome things are shared but they are not data types, e.g. the rendering of LaTeX equations which is used throughout the app. These should likely be placed into a helper module or modules. Should it be one module with all such things, or is there enough to warrant splitting it up into separate modules? For now we only have a handful of such things, including the LaTeX logic and text box logic (which will likely eventually be made part of Data TypesRefactoring
|
CommentsMost of the points mentioned above are very good. While I agree with most of them, here are some additional thoughts I have: Is
|
Agreed with the
|
I just thought of something else. We might run into situations where a module wants to "clean up" or "prepare" things when the user if entering or exiting that module. So we should probably also have each module provide the following:
Our Come to think of it, each module also need to provide
And we'll also need to provide global Overall, I think this will give us a nice API to keep adding things modularly. What do you think? |
Minor gripe with the We could change it to a custom two-constructor datatype to better reflect what it is being used for |
Just my yearly check-in here to look up what the |
Lol yes, I am noticing myself a lot of opportunities for refactoring, including re-use of code and making things more explicit. We should definitely clean things up, yet again! Though we luckily are in a much better place than the beginning of this thread suggests: one module with 2000 loc! |
Another thing to refactor: have all the "real actions" have their own message types. And then separate out more "meta messages" (like keyboard presses) from those, but have those actually create a |
The Main.elm file contains the entire logic of the application and is over 2000 lines long (after elm-format). Adding more features will only grow the size of the code. Discuss here a scalable way to refactor our current code into logical chunks!
The text was updated successfully, but these errors were encountered: