Hi all,

TL;DR: What are some patterns/approaches for web sites for which Racket is 
particularly suited *and* for which you can point at decently written up 
examples in Racket or other languages that share such features?

Much longer me:

I spent much of summer implementing online web sites with quite a bit of 
state (do step 1; if answer a do step 2, if answer b do step 3; keep 
forking, randomize some things in between). The first website I did in 
Django, because 2 years ago when I rolled my own in Racket, I ended up with 
an unmaintainable mess of code that had sql and sexpr sprinkled across all 
types of files, and I didn't dare touch anything anymore. Now I learned 
that I am perfectly capable of writing an unmaintainable mess of code in 
Python too. Hence the second such web site (all are used for economic 
experiments, think surveys with a lot of randomization and if/then logic) 
is again back to Racket. 

The thing is that, while I know about MVC and grok it better after having 
spent time with Django, I am often at a loss to figure out where to draw 
boundaries in Racket. This is true for Django too, but there are so many 
examples out there, that it is easier to figure out what belongs where, and 
Django forces you to put some things in the models (more or less) and 
others in the views. And all the standard stuff - forms, simple SQL - has 
obvious ways of doing it. There are some things I dislike about it, but 
these are some positives.

Now that I am back in Racket land, and at least partially get what 
continuations do (thanks to primarily Philip, George, Jesse, Bogdan and 
Matthew B's writings and answers on this list over the years), my code is 
vastly better than 2 years ago. Yet, I still feel that it is pretty bad, 
and I see loads of duplications that I do, sometimes due to lack of time to 
refactor, but just as often because I have no clue how to refactor it in a 
way that will not make it ridiculously fine-tuned to my current purpose.

So, my question is this: what approches (if you like big ponderous words, 
what paradigms) and patterns are there to write web sites, and are you 
aware of examples that highlight them *concretely* in code in a way that 
the send/suspend/dispatch is described in the "Continue: ..." tutorial? 
Here are approaches that I know of:

- MVC: Django and Rails for instance, easy to find examples. Usually object 
oriented it seems, but it's sort of what I do in Racket as well.
- Single-Page Apps: I never implemented one, but my sense was that you can 
do MVC with it too, and it's more about whether you use JS to do things 
asynchronously. I may be wrong and there might be more to it.
- Continuation style: What "Continue" does, and again it's not really an 
alternative to MVC, but more how you implement it (or other things). I 
still struggle a lot with doing this well, as there are few descriptions of 
it that go beyond "Continue". When I google, it brings up essentially the 
Racket crowd and something called Seaside (I had never heard of it)
- Microservices (I do not get what it is, if it even is one thing)

So what are examples in Racket or Racket-like languages (semantics, not 
syntax, so it doesn't have to look Lispy if it is functional or uses 
continuations or whatever features of Racket) that I could use to guide how 
I *could* structure my web site in a given way? Django isn't that great a 
fit since it has a pretty heavy ORM, and does lots of magic behind the 
scenes on objects, which is not trivial to map to the functional style of 
Racket. 

I don't know whether these are related to it, but half (all?) of my 
struggles come from trying to manage the state people are in and ending up 
passing around biggish objects, or adding 2 or more boolean fields per page 
to the database and calling the database on every new page.

I understand that this is not the most well-formed question on this email 
list and it's likely I am asking the wrong question, so I am very open to 
being told "What you should be asking is ... " (such as, this is not about 
web stuff, but ...).

Cheers,
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/3375bd01-2fe5-4c9a-b926-d8b272010b74%40googlegroups.com.

Reply via email to