Skip to content
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

DRAFT: Web Applications part 1 concept #723

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ceddlyburge
Copy link
Contributor

Hi everyone, I'd like to get some early feedback on this.

Its a plan to create a concept for #639.

It is possible to shim the Browser module and the tests all run and pass and test all the important things.

There is a change to the elm.json, but just moving the Html dependency from indirect to direct, so I don't think we would need to update the docker images or anything (although we should update all the other elm.json's for consistency).

I think that any syllabus for learning Elm needs to include actually writing a web app, so I am keen to do this, but want to hear peoples thoughts.

@mpizenberg
Copy link
Member

It is possible to shim the Browser module and the tests all run and pass and test all the important things.

Hum, I’ve never used it, but I wonder what you can get with elm-program-test https://github.com/avh4/elm-program-test
Or something like it.

@ceddlyburge
Copy link
Contributor Author

That is an option as well. It would require us to update the docker image for the test runner, but we can definitely do that.

I don't think we need it for this exercise though, we can test virtually everything already.

THe only thing we can't test is that the correct update function gets passed to Browser.sandbox, but we do know that it has the correct type signature, and we do test the update function itself, so you would have to write some very weird code for it to be a problem.

@jiegillet
Copy link
Contributor

This is nice, and you are testing all that needs to be tested, although I would also give elm-program-test a shot, maybe we can get even better tests (and they would also be more realistic).

However, I'm still unsure whether that concept really works. The point of the Browser module is to make web pages, but here you will never see it, that seems like a shame. Maybe it's still good to learn about the Elm architecture in theory, but... yeah, I'm not sure.

@ceddlyburge
Copy link
Contributor Author

I've never used elm-program-test, and Matthieu hasn't either, not sure if you have?

But I do test my update and view functions routinely, and sometimes my init functions if they are complicated. So I think the testing that is done here is basically the same as what I normally do, so it feels quite realistic to me.

It is true that you would never see the code running in the online editor, but we could promote Ellie, and people could copy and paste it in to there to see it running. We could also give people instructions to make it work locally on peoples computer (delete Browser.elm and install the Browser package).

Another option is to use the actual Browser module, instead of using a fake. This would mean that if you were solving the exercise on your own computer, you could run it and see a web page. It feels like it might open up a security hole though, but I could investigate if people think this is worth pursuing.

@ceddlyburge
Copy link
Contributor Author

We could maybe try and have different files (Browser.elm) for the online version and the download version (no Browser.elm).

I imagine this would require a chanage to exercism, but I could put something on the forum

@jiegillet
Copy link
Contributor

jiegillet commented Nov 21, 2024

We could maybe try and have different files (Browser.elm) for the online version and the download version (no Browser.elm).

I imagine this would require a chanage to exercism, but I could put something on the forum

I expect that to be complicated to maintain.
Maybe it would be enough to leave a comment on the fake Browser explaining that this is a stand-in for the real one, and instructions on how to use the real one offline.

I've thought about this some more and you know what? I think that it's worth a shot, especially since you are interested in working on this. Let's do it, and if we get negative feedback, we'll regroup :)

No need for elm-program-test for now, that's not required for this exercise.

Just a note though: let's keep the required knowledge about HTML to a strict mininum (by providing pre-made views easy to adapt). I knew close to nothing about HTML/JS/CSS when I picked up Elm, Elm-UI was all I needed.

@ceddlyburge
Copy link
Contributor Author

Ok cool, I'll try and keep the html and css part as small as possible, and keep going with this. We can always see how we like it later, or see if we get any feedback about it if it goes live

@mpizenberg
Copy link
Member

Nice! I agree with minimal html/css stuff and adjust after feedback. Maybe it will also be pioneering some new capabilities for exercism on visualization for web languages tracks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants