Fork me on GitHub
#beginners
<
2022-04-15
>
John Bradens00:04:15

Hey I posted this a while back, but figured I'll post again because things are a little more organized now. We have a little study group going in discord where we're working through projects together & just started a weekly coding challenge where we're gonna do a codewars or advent of code problem each week and compare how we solve it! My apologies if this sort of thing isn't okay to post here, I'll take it down if needed https://discord.gg/TEB7SU6Ark

πŸ‘€ 1
Serafeim Papastefanos09:04:19

Hey friends! What's your opinion on the coast framework: https://github.com/coast-framework/coast (please point me if i need to ask somewhere else)

dgb2309:04:17

It’s in maintenance mode I think.

Serafeim Papastefanos09:04:10

yes that's what I've understood from a previous discussion in HN... do you recommend some other web framework ? or go the luminus way to use the libs directly ?

dgb2312:04:55

I would recommend studying this illustrative repo first: https://github.com/seancorfield/usermanager-example It links to versions that use different libs as well. I think from the example above you can learn how to do general plumbing for Clojure web apps, including REPL friendliness. I think it’s a great starting point to build things from the ground up. Luminus seems to be quite cool and comprehensive. But I have only played with it a bit.

Serafeim Papastefanos12:04:56

Thank you!

πŸ‘ 1
seancorfield16:04:24

Luminus is great... once you understand all the libraries it bundles together.

πŸ‘€ 1
Serafeim Papastefanos11:04:54

what's the difference of managed-dependencies vs dependencies in a project.clj (leiningen) ?

noisesmith14:04:37

excerpt from the output of $ lein help sample - a sample annotated project.clj

;; "Managed Dependencies" are a concept borrowed from maven pom files; see
  ;;  
  ;; Managed dependencies allow you to specify a desired version number for a dependency
  ;;  *if* the dependency exists (often transitively), but a managed dependency
  ;;  will not actually cause the described artifact to be a dependency on its own.
  ;; This feature is most useful in combination with some other mechanism for
  ;;  defining a "parent project"; e.g. you can have a "parent project" that specifies
  ;;  managed dependencies for common libraries that you use frequently in your other
  ;;  projects, and then the downstream/child projects can specify a normal dependency on
  ;;  those libraries *without specifying a version number*, and thus will inherit
  ;;  the version number from the parent.  This provides a simpler means of keeping
  ;;  common dependency versions in sync across a large number of clojure libraries.
  ;; For more info see ./doc/MANAGED_DEPS.md and 
  :managed-dependencies [[clj-time "0.12.0"]
                         [me.raynes/fs "1.4.6"]]

Serafeim Papastefanos14:04:23

Still it's confusing for me πŸ˜‚

noisesmith14:04:55

if that description makes no sense, you don't need the feature - this is for projects that have many separate sub-projects that want their dep versions to stay aligned

πŸ‘ 1
Serafeim Papastefanos14:04:54

This seems like jar hell to me thank God i don't need it 😁

Baye15:04:25

Hi, Maybe somebody can chime in on the following issue I have. As a beginner, I find "classical" programming relatively understandable when learning: for example trying to make a little CLI program, or solving math or data structure problems. Yet I find learning web dev or mobile dev very difficult: there is too much to learn and too many concepts that are difficult to grasp. But my perception in the forums: beginners are sold on front-end as easier than "classical" programming. I am puzzled. I am attempting to learn to make web/mobile apps (such as simple health apps, simple specialized social networking) but my first crack at "Web Dev with Clojure" is appearing to be a tall order. Any advice is welcome.

Cora (she/her)15:04:54

people who say frontend is easier must not do frontend work

☝️ 4
marcofiset15:04:50

web dev is indeed very involved. I would suggest you start with getting a basic understanding of how HTTP and browsers work, + some HTML (links, inputs, forms, etc).

Cora (she/her)15:04:23

I guess we'd need to know where the knowledge gaps are so we can recommend things. it's definitely not an easy process, especially in clojure where you must assemble all the pieces to do a web app on your own

Cora (she/her)15:04:23

if you wanted something very full stack you could look at fulcro

marcofiset15:04:57

Clojure is not the best language to learn web dev with I figure, since we don't really have an opiniated framework with batteries included to get you going quickly.

βž• 1
Cora (she/her)15:04:53

the only way through is learning, though. you don't want tutorials or things to read but don't know how to do webdev then the only other solution is for someone to teach you directly?

Cora (she/her)15:04:27

spend some time on MDN and http://javascript.info if you want to learn

Cora (she/her)15:04:00

the nice part about MDN is it won't teach you the web from a clojure perspective, or php perspective, or ruby, or python, or any number of other languages. it teaches you the web as-is and then afterwards you can learn how languages like clojure can be used to make things for the web

Cora (she/her)15:04:10

it's not easy to learn so it's ok to be frustrated!! like with making command-line apps there is a large amount of base understanding that must be built up. for the cli this is leaning what a shell even is, how to run and cancel commands, how to read and write input, how to list files and read files and edit/update/delete/etc. for the web this is the http protocol, client/server request/response in general, html, css, javascript. just like with the cli you don't need to have a perfect understanding of everything in order to use it but you do need some understanding

Cora (she/her)15:04:21

to start with you might want to try making an API. that's a lot closer to a cli app and doesn't require as much know-how. layer on html and you have something a browser can use. layer on css and it starts to look good. layer on javascript and it gets more interactive

practicalli-johnny15:04:55

Front-end is easy when creating simple landing pages that are html (or Clojure hiccup) and a CSS framework that does everything required. Other than that niche use case, front-end is often more complex than back-end - regardless of the technology used I found it really easy to do landing pages in ClojureScript with CSS, but adding JavaScript into the mix I find makes it a lot more challenging. Projects like shadow-cljs help, but unless you are familiar with all the JavaScript project used, its a lot to learn.

Cora (she/her)15:04:34

even html and css, if you don't know it, is quite a bit to pick up

Cora (she/her)15:04:20

I wouldn't ever say it's easy by any means even then. once those things are familiar it's very easy but until then it's a mountain of things to become familiar with.

Cora (she/her)15:04:42

even request/response with http is a whole thing to learn if you're not at all aware of how it works

noisesmith16:04:17

one thought that occurs to me just now: a good web page "gracefully degrades", if you don't have the storage and scripting features it needs (or don't allow them to be turned on) it should offer a reasonable static page, if you can't fit the preferred layout on the allotted dimensions, it should offer a version without columns and text boxes etc. you could start with the least featureful thing (web 1.0, static html from the server, no css or js or cookies), and add the extra layers features one by one the biggest problem with web frontend is that it's a very specific beast, with strange decisions that "made sense at the time" baked in, for the strange goal of turning document markup into an interactive application. actually navigating that history (making a web page like you would in 1990, 1995, 2000 etc. (probably skipping things like iframes and java applets and realplayer...) is likely to make the whole thing make sense (if anything would)

noisesmith17:04:49

that you find the whole thing is hard to understand is a sign of insight / sanity. it's not a reasonable setup, it's not a well designed way to make applications. it's a series of weird compromises that we are stuck with.

πŸ™Œ 1
Stuart17:04:47

> a good web page "gracefully degrades" I wish more sites worked with JS off. If you're site just displays a totally blank page when JS is disabled then it's broken. Even just display a message that says "No JS, No bueno", fine. But just a blank page...

Baye17:04:54

Thanks all for your helpful inputs. Just to clarify a few things: I know basic html, css, and very basic react: built very basic landing page with nav bars, sign up forms using react + tailwind + basic react router functionality...that's it. I am learning clojure because programming is a hobby for me and I have been convinced/converted to clojure (especially after going through a book)...Before that I learn't basic C++, python and Javascript. However, I have yet to build an app at production level. I am not against leveling up with whatever Clojure material/tutorial I have to learn...It's just I have not yet found a beginner friendly web tutorial in Clojure (though I haven't tried many yet) and also I don't to be stuck in tutorial mode. I have very clear and well-defined app ideas I would like to implement.

noisesmith17:04:10

I'm not really sure what "stuck in tutorial mode" means. most front-end dev is done via massive amounts of copy and paste with relatively little need for understanding the details (this might be disguised as "using a template" or "using a framework"). the Sotnikov "web development with clojure" book is the best intro I know of, it uses the closest thing we have to a default batteries included framework last I checked (luminus), but the community is hostile to such things https://pragprog.com/titles/dswdcloj3/web-development-with-clojure-third-edition/ https://luminusweb.com/

Baye15:04:19

Note I don't want to get stuck reading books/tutorials...I want to start building. I already finished Getting Clojure Book.

Baye17:04:27

Any tutorial on mobile app dev in Clojure...What is the common stack, if any? Clojurescript+ reactnative?

noisesmith17:04:22

last I checked making a native mobile app via clojure is clumsy, and was hacky enough that it didn't support any recent clojure releases; if making a web app is an option, it will be much simpler

noisesmith17:04:26

(my background: I learned clojure because I got hired to do web dev and had a background with lispy programming, my first real project was a defunct and misguided web framework)

Baye17:04:21

I see. Thanks again

noisesmith17:04:03

looks like react-native might be more viable than I thought - I'll defer to someone whose actually used this stack https://www.juxt.pro/blog/clojurescript-native-apps-2021

kennytilton02:04:39

This is a good starting point for RN + re-frame: https://github.com/PEZ/rn-rf-shadow Here is an RN clojure solution not using re-frame: https://github.com/lilactown/helix A Clojure+Dart+Flutter solution is on the way. If you are OK with Web and want to help with the documentation, this is something radically different I am about to ship for the web: https://github.com/kennytilton/mxweb-trainer. I would work with you to get you going. Right now I have paused that to work on a similar wrapper for ClojureDart. Have fun! ps. There is nothing easy about web/mobile development. Modern day tooling and frameworks are a disaster, and any UI app is hard because of the multitude of states to keep straight while users bang away at random.

Baye10:04:13

Great! will check it out. Thanks you for your time

Baye17:04:14

But I have see youtube talks touting the greatness of using clojure for mobile apps such as https://www.youtube.com/watch?v=toGEegAzrZA&amp;t=998s

Baye17:04:45

There is another famous one about a mobile car app

Serafeim Papastefanos19:04:05

can somebody explain to me what would Clover (https://marketplace.visualstudio.com/items?itemName=mauricioszabo.clover) offer me over Calva ? (if it offers anything at all)

andy.fingerhut19:04:32

I do not know, but there is a #calva channel where you could see if anyone there can compare them for you.

πŸ™Œ 1
seancorfield19:04:26

As someone who uses Clover and Calva together, I answered in a thread in the #calva channel (in case anyone else wants to know the answer).

❀️ 1
neilyio19:04:38

I can't seem to figure out how to import a java dependency in Clojure. I'm following a stack overflow answer https://stackoverflow.com/questions/42009963/importing-java-lib-in-clojure-how-does-it-work I have a minimal deps.edn:

{:paths ["src"]
 :deps  {javax.xml.bind/jaxb-api {:mvn/version "2.2.12"}}}
I run clj in my project folder to start a REPL. I see the javax.xml.bind dependency download. When I (import javax.xml.bind.DataTypeConverter), I get:
Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (URLClassLoader.java:445).
javax.xml.bind.DataTypeConverter
Even printing my classpath with (java.lang.System/getProperty "java.class.path"), I see /.m2/repository/javax/xml/bind/jaxb-api/2.2.12/jaxb-api-2.2.12.jar as the third or fourth entry. Not sure what I'm doing wrong, but it's probably something simple. Hope anyone can help!

Darin Douglass19:04:01

when calling import directly like that (i.e. outside of the ns call) you have to quote your import name. so try

(import 'javax.xml.bind.DataTypeConverter)