This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-30
Channels
- # admin-announcements (1)
- # adventofcode (2)
- # announcements (2)
- # babashka (60)
- # beginners (48)
- # cherry (1)
- # cider (16)
- # clj-kondo (4)
- # clojure (53)
- # clojure-belgium (3)
- # clojure-europe (20)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-poland (4)
- # clojure-uk (6)
- # clojuredesign-podcast (19)
- # clojurescript (39)
- # community-development (12)
- # cursive (4)
- # datalevin (7)
- # datomic (23)
- # honeysql (14)
- # hyperfiddle (3)
- # instaparse (3)
- # lsp (3)
- # malli (10)
- # off-topic (34)
- # overtone (8)
- # polylith (2)
- # re-frame (9)
- # reitit (3)
- # releases (1)
- # squint (16)
- # timbre (7)
- # wasm (2)
- # xtdb (8)
suppose you have a very long string, several MB say, and a list of short strings (10-100 chars say), maybe just a couple but maybe several hundred or a thousand, and you want to get back the long string with all instances of all the short strings elided. What are some viable approaches?
You compile the short strings into an automata, a regex really that is an or of all of them, and walk the regex (starting a new matcher on each character) over the long string, discarding matchers that can't match. As you feed characters into the matchers, also copy the characters into a stringbuilder, deleting from the stringbuilder on a match
There are third party alternative java regex libraries that might be nicer to work with for this than java's built in Pattern, but I am not sure
Isn't what you describe exactly what String.replaceAll
already does? Assuming you feed it stuff like (str1|str2|str3|...)
.
Okay, makes sense. Is there a way to compile a regex, an x such that (x coll-of-strings)
gives you the str1|str2|…
you need?I mean besides some editor trick + eval
Just (str/join "|" coll)
(assuming none of the strings have characters that are special to RegEx) and then call re-pattern
on it.
So.... I just did something crazy. I was quite mad about the lack of Solid and other frameworks' support for ClojureScript... so I decided to try and make a macro that invokes Babel to generate some code from JSX. After a lot of attempts... I think I have a prototype!
What does it mean? Does it mean that now you can take CLJS and convert it into JSX so that later it would be converted into what Solid framework understands? Or does it mean something else?
It means that we can take a hiccup form, and it'll generate JSX and send to Babel in a single step, generating a valid JS on the other side. It basically is a macro that makes what Babel does, so it happens before ClojureScript's compilation. The great thing about this (if it works on most cases) is that every super-power that Clojure have still works - in this prototype, I still have REPL support, hot-reload, etc
I'm interested in some feedback on the idea of using cognitive development models for understanding how software engineers think about design. Why do different developers have spontaneously different reactions to, say, the distinction between "simple and easy", or to the significance of reducing coupling and increasing cohesion? Psychologists like Jean Piaget use cognitive development models to show how different sorts of understanding rely on prior cognitive skills. These cognitive skills are arranged into levels, such that, if one is on a lower level, the conditions for understanding higher level concepts aren't there. I think the same sort of explanation is useful for explaining the divergences in the opinions and practices of software developers. I've put together a sketch of what I think the levels are https://gist.github.com/thomascothran/c7152559da0dfbe862236e495b5d1467. Does this ring true? Are there better models out there?
One of things that I find intriguing is that often developers are programming in one model while holding a completely different model in their heads. I find this is particularly true with clojure as you pass a data structure through different functions you have to hold the model in your head. (yes I know you could use spec to describe it - but ...) I also think this is true of meta programming where you have to hold two models in your head while writing the macro or meta program.
Interesting that you should arrive at three levels/categories. Back when I was on the C++ Standards Committee, we joked that there were three levels of programmer: public
, protected
, and private
that somewhat corresponded to your three levels. A public programmers assembles solutions from the building blocks they have without necessarily understanding how they work or the tradeoffs involved in the different ways of assembling them. At the other end, a private programmer has much more understanding of both how software "works" at a fundamental level but also how to design and build robust software that can withstand change and/or be more reusable/more adaptable. With the protected programmer inbetween: understanding more of the tradeoffs than the public programmer but not yet able to reach the next level of adaptable software.
(that was the best part of 30 years ago)
Level 3 rings true (and with great example), but not level 1 or 2. I disagreed with your last article (about 2 kinds of readability) too, because I think your second example made it more flexible, not more declaratively readable. The flexibility is something that may or may not pay off, and I would agree with your level-1s that it makes it more complex. Whether it is worth it is another question. Anyway I think you should reconsider level 1 and 2 and see if you can leave room for the possibility that some cases of adding indirection or abstraction end up being a net negative. I don't think there is any room for that with the words you have now.
@U08JKUHA9 I don't mean to rule out "thinking in implementations", or choosing easy vs simple. Sometimes the easy choice is the better choice. Squarespace is fine for some websites; A shared excel sheet is fine for some business use cases. Or, in a code base, the costs of drawing an architectural seams may sometimes exceed the benefits. The problem is when one thinks one is weighing the costs and benefits, but doing so in a way that is systematically produces highly coupled systems. Many (most?) developers seem to grant that simplicity is better, but nevertheless think that all their particular situations are the exception. My claim is that there are levels of development that explain why -- in practice -- some software developers tend to produce decoupled, cohesive systems, and others highly coupled systems where the business rules could be squirreled away almost anywhere
@U04V70XH6 - that's an interesting way to divide the layers as well. It makes me think my divisions are tailored more to business-oriented applications (where the challenge is usually to think at a higher level). Versus other cases where the challenge may be performance (where the challenge is to understand the lower level mechanics).
Hey, it was the C++ crowd after all... 🙂
I think the other thing to bear in mind is that developers don't inherently move through these layers over time. Some stay at level 1 all their careers, some reach level 3 very quickly. I know plenty of level 1 programmers who've had 20 years of experience... but they've only worked in environments that accepted and supported "level 1" work: they haven't been pushed to improve/advance. And there often are no "level 3" folks where they work, because the environment isn't challenging/interesting enough for them to stay...
Another model that might feed into thinking about this topic is Dreyfus' model of skill acquisition. I also think that "cognitive development" is maybe a bit grandiose when scoped specifically to software dev.
The image is so oversimplified and under-detailed that it means nothing. 2-6 year olds have ethics, they understand the concept of yours/mine, they understand that it's wrong to hit other people. Similarly, 2-6 year olds have some degree of rationality and logical thinking. At the same time, the logical thinking of a 7-11 year old is minor. To do something like this you have to be very precise. For example, you can to say "we made this logical puzzle that involves stacking cubes in a particular way. We find that, on average, kids under 4 can not solve it". That's fine, but trying to generalize that to "kids to under 4 can not think logically" is naive and dishonest. Another example from the pic is that 7-11 year olds supposedly understand numbers. I don't think I even understand numbers. At the same time, my 3 year old can count with some success. What understanding numbers "in general" is completely subjective, which kind of invalidates the research from the start. I think this type of thinking leads nowhere but to misunderstanding.
@UM7566XGS - you do realize this is a diagram? Surely you wouldn't think the standard model of physics can be conveyed in a diagram. I'm puzzled why you would think it's any different with developmental psychology. In any case, it's just a way of framing the argument I'm making. It's not something I am relying on.
Hey, really neat article. Still going over it. I noticed one sentence - > Facility in mathematics is really about being able to execute a series of steps correctly. Did you mean to include not here? The paragraph seems like it would flow properly that way. I'd say formulating problems is really not an obvious series of steps.
Also skeptical about the existence of such scales / phases but I do find it interesting to reflect on. Cook-Greuter scale and also spiral dynamics are interesting to compare to Piaget's scale. I suspect there is no "correct" model out there
Robert Kegan extended Piaget's model, also covering adulthood, and if I squint a little your levels 1-3 map to Kegan stages 3-5. https://vividness.live/developing-ethical-social-and-cognitive-competence here is a blog post introducing them if you want to explore that
Please if you are interested in #flow join that channel to discuss ways of moving enteprises forward. As a teaser read one of my columns written long time ago when I started this movement 🎈 https://www.linkedin.com/pulse/stop-modern-form-slavery-hans-van-bommel?utm_source=share&utm_medium=member_ios&utm_campaign=share_via
This feels icky to me. Like when right-wing Americans have signs in their yard saying “Taxation is slavery” Call it “wage theft” or something else but slavery is slavery and this is a structural policy misalignment and a big problem but sure as heck isn’t slavery.
Whats the name of the algorithm which will return the path from a node to a different node in a tree. DFS can do this with the right accumulator. But is there a name for this algorithm? I want to make sure i have the "ideal" implementation of this and i'm not missing something.
I think the general name for this is https://en.wikipedia.org/wiki/Pathfinding. Depending on the graph, good places to start are Dijkstra's algorithm and A*.
yeah, thats what i assumed to. Basically what i have is a modified Dijkstra's algorithm.
This made me think of Alex's "A-Maze-ing Clojure" talk https://www.youtube.com/watch?v=ZMQbHMgK2rw