Fork me on GitHub
#fulcro
<
2021-06-30
>
genekim12:06:54

@holyjak I’m working through your fantastic exercises, and I’m wondering what the “normalized data” should look like in Exercise 5. https://github.com/fulcro-community/fulcro-exercises/blob/master/src/holyjak/fulcro_exercises.cljs#L248 Here’s mine — is this correct? > (cljs.pprint/pprint (comp/query Root5)) > [{:teams > [:team/id > :team/name > {:team/players > [:player/id :player/name {:player/address [:address/city]}]}]}] > > (show-client-db) > {:fulcro.inspect.core/app-id “holyjak.fulcro-exercises/Root5", > :fulcro.inspect.core/app-uuid > #uuid “87215949-9c38-4b2a-ac31-37dbef3c6ef6”, > :teams > [{:team/name “Hikers”, > :team/id :hikers, > :team/players > [{:player/name “Jon”, > :player/address {:address/city “Oslo”}, > :player/id 1} > {:player/name “Ola”, > :player/address {:address/city “Trondheim”}, > :player/id 2} > {:player/name “Olddda”, > :player/address {:address/city “Trondheim”}, > :player/id 23}]}]} Again, I love the exercises! I’ll have some PRs to give additional hints, and potential hints on what the correct answers are to help the student “check their work.”

Jakub Holý (HolyJak)12:06:54

Hi, thank you! Feedback and PRs most welcome!!! The data you are showing is not normalized. A normalized DB would have team/id and player/id in addition to teams. You can always compare your result against the solutions ns. I guess you did not think it was suitable / appropriate here. Why? I see the exercise is not clear enough. Suggestions for a clarification welcome :-) I guess you added idents to the query but not :ident to the components?

genekim13:06:11

Solutions are in another namespace?? Oh! I had no idea! 🙈 Thx!!

genekim13:06:33

So good! Thank you! https://github.com/fulcro-community/fulcro-exercises/blob/master/src/holyjak/solutions.cljs These exercises are really awesome — kudos on such an instructive set of exercises. It’s forcing me to really understand what idents are, which I’ve gotten away with by “mostly guessing”, which is a pretty scary thought. 🙂 (I had to re-watch Grokking Fulcro 3a and 3b videos.) I feel like these exercises will help many many people who are trying to learn Fulcro. I’m learning a ton! cc @U0CKQ19AQ

genekim13:06:35

I mentioned @U0CKQ19AQ only because I think it’d be nifty to mention the tutorials/exercises in the official Fulcro docs somewhere.

Jakub Holý (HolyJak)13:06:14

The Book now links to the whole fulcro-community site, as does fulcro home page and this channel's topic :) The docstring in the exercises ns mentions the solutions: https://github.com/fulcro-community/fulcro-exercises/blob/master/src/holyjak/fulcro_exercises.cljs#L16 Have you overlooked it or not considered relevant to your question? Ie. how can I make it more visible? 🙏

tony.kay14:06:16

It never ceases to surprise me how many people use Fulcro without understanding the basics (which are not hard, as I'm sure you're finding). I've spent months of my life on documentation, videos, exercises, tutorials (some now defunct). I've decided people are going to do what people do: which is play with it in whatever way they feel like doing. Most people are going to copy some kind of template (provided) and start hacking.

tony.kay15:06:28

Then when they get stuck they come here, because now they're in a hurry to get something done, and reading/watching is inconvenient.

tony.kay15:06:11

This is all fine. I do it too. I'm just saying I don't think any amount of "start here" will get this to change.

tony.kay15:06:37

not to say that everyone does that. Just seems to be a common pattern that I myself am guilty of in other libs

xceno16:06:48

Can confirm, did this back last year and wrote tons of shit code. Then I watched all your tutorials multiple times and read all the books (normal + RAD) back to back and surprise, everything just clicks together once you got it. (and yes, it isn't that hard) I took tons of notes and thought about writing tutorials / blogs too but there's just no way getting around the fundamentals. What helps the most is having the fulcro sources and just looking things up

xceno16:06:50

I was completely new to clojure too and learned datomic at the same time, that probably complicated things, but nowadays I can crank out complex UIs in no time, it's fantastic. (Sorry for hijacking this thread 🙃)

tony.kay19:06:12

Thanks for the feedback, and don't apologize for chiming in. I'm happy to hear that others really are able to use if effectively once they stop and look at the fundamentals carefully.

genekim21:06:12

So glad you’re chiming in, @U012ADU90SW. Totally relating to your experiences! Just figured out how to do Exercise 4, @holyjak — forgot to change the (merge/merge!) argument from [:teams] to (comp/get-query Root5). 🎉 🙂

🎉 3
sheluchin13:07:35

I'm a little late to the discussion here but I would like to provide some feedback of my own. I think I'm the opposite of the case mentioned above. Instead of just copying a template and starting to hack on things, I went the opposite route and spent most of my initial time carefully studying and reviewing the first four chapters of the Fulcro book. I have most of it committed to memory, while also watching some of the tutorial videos for additional context. I haven't yet taken a deep dive on the community resources - that'll be next. I'm definitely still at the beginner/learning stage. I'm now putting most of my time into working on some personal Fulcro projects. Despite knowing the intro material quite well, things are still pretty difficult. The Fulcro model is just very different from what I'm used to, which is mostly building Django apps. My point is that - at least in my case - understanding the concepts is not easy despite familiarity with the lesson material. Studying that stuff is an essential step, but nothing really beats practice and testing your understanding. Being somewhat new to both Clojure and Fulcro, getting to the practice stage requires a decent amount of upfront work. Setting up a project and getting comfortable with the tooling takes a non-negligible amount of time. The templates are good, but I also feel like I'm missing out on some of the essential learning by relying on them before really understanding everything they do for me. Perhaps something interactive to help new users really learn the building blocks in isolation from other complexity would be useful in helping people get started? Maybe some web-based interactive tutorials that allow users to practice small pieces like setting up idents, queries, and initial states on components, and making sure they compose properly all the way to the root. Maybe present some sample source code with errors, and give users a point-and-click interface for fixing it? Not sure, just kinda brainstorming and offering my own feedback. The Fulcro community seems to be growing nicely, maybe we could consider adding such learning resources at some point.

Jakub Holý (HolyJak)20:07:39

@UPWHQK562 doesn't fulcro-exercises fit this?

sheluchin15:07:52

@holyjak I think it comes very close but perhaps it can be made even simpler for the user and more focused on the essentials. Cloning a repo and running the code is something most devs are used to, but I still think that having to do so adds a bit to the initial learning friction and isn't actually necessary to convey lessons about idents, queries, and initial states (or some other fundamental building blocks of Fulcro). I'm just imaging a simple web interface that would cover the same theory as the exercises repo, but would reduce it down to multiple choice or something extremely simple like a fill-in-the-blanks style quiz. I think limiting the users this way, instead of giving them an entire project repo, would be effective in building up confidence. It's conceivable that the questions could even be generated and not hardcoded lessons. If someone wanted to run through 10 quick practice sessions of composing or refactoring the UI tree and its data, it might be very helpful in reinforcing the involved concepts. Anyway, just throwing the idea out there and providing my own user experience as I ramp up with Fulcro. Thanks to everyone that has worked on the existing learning resources we have, I've found them very helpful, this is just brainstorming about how on-boarding could be made simpler.

3
xceno08:07:45

@UPWHQK562 I thought about stuff like this a lot too in my last job (TypeScript/React/Java), shortly before I left. I was tasked to mentor some juniors and build a simple "template application" to transfer some knowledge. At this point I've written numerous state management solutions myself over the years 'cause I didn't like redux and all the other stuff. Long story short: Instead of building a template, I built a very simple demo application like the fulcro RAD demo and documented the hell out of it. And not just the app itself, but I left links to books, blogs, embedded YT videos of talks, etc. Because I had this idea that I want to teach / show them the very basics that informed my decisions to build stuff the way I did. And on top of that I did something like you just described. I built sample components and wrote about every single line and what it did. I built "skeleton" components so people could fill out the stuff they learned. I showed how to optimize them, how to use an async web-worker pipeline, etc. etc. In the end, no one gave a damn. All they wanted was something like npx create-foo-app and hack crap together ASAP. Well, I guess all I want to say is, i think you're one of very few people who'd take the time to actually go through such lessons. I might be a bit cynical here though, so I welcome everyone to prove me wrong 🙂 I thought about why people struggle with fulcro so much in the beginning and I think it simply comes down to one thing. In my experience, the average enterprise dev isn't exposed to (basic!) graph theory that much, if at all and might not even really understand what a tree is and how to normalize it. As I said, my views might be way too negative here based on my past experiences. I'm sure what I just said is controversial. I'd love to work on tutorials, I enjoy teaching stuff, but I just can't seem to figure out the "right" angle to go at it. Anyway, I quit rambling now haha. On another note: @U6VPZS1EK I just figured you're the author of the phoenix project and I want to take this opportunity to thank you! I enjoyed it very much! 🙂

Jakub Holý (HolyJak)09:07:29

@U012ADU90SW sorry to hear about your experience, that must have been very frustrating. I'm sure some people would appreciate it but many are too eager to get going (perhaps due to the constant pressure on delivering features?). Perhaps there is a culture problem...

xceno13:07:24

> ... that must have been very frustrating it was, but i think we're all "guilty" of that. I used to learn best by just jumping in head first and trying to find my way out again. Nowadays I'm a bit more careful. But either way, when I work with OSS i always have the original sources at hand and just look things up there, that proved tremendously helpful with fulcro as well. And that's the single most important thing I always told people around me: just read the source. > but many are too eager to get going Yeah like I wrote in my initial comment here, I was as well. I needed to have a functional POC with a ton of bells and whistles and all that in mere weeks. So I just started cranking code out as fast as I could. Funnily enough, when I came back later with the proper understanding I rewrote a major part of the app, which took me almost two weeks, in an afternoon (including additional features and performance improvements) - lessons were learned that day haha

👍 4
tony.kay23:07:48

This is exactly what I've experienced over and over again in my career. People (myself included) just jump in and code. It's a very bad habit and does speak volumes about our profession and professionalism. Lots of reasons (and bad excuses), but the vast majority of people in this field do things (and are pressured to do things) in a very sloppy and costly manner. Not an individual criticism (though individuals certainly make better/worse choices), just the state of the game. It's frustrating as someone that is interested in doing it better. I've had many management battles over exactly this sort of thing...and mostly lost. "Features fast" no matter the cost later has killed many projects, but on the other hand there are many companies that would never have made it if they didn't defer the costs and just crank out crap. 🤷