For people that use stored procs rather than sql in your app, how do you manage dependencies for stored procs? i.e. I have a stored proc spFoo
and it's called by application A and application B.
A developer is working on Application A and needs to change spFoo
, how does he know that he is potentially breaking application B. Other than just be disciplined in putting this informatoin in the stored proc comment header?
I cannot answer generally. But specifically for that problem i would make app A call a new function spBaz instead of altering spFoo. If the two functions have a lot of code in common this can potentially be moved to a third function they both call.
I'll just say that more than one application talking to the same database is something I'd be really suspicious of. As your system grows, everything becomes coupled to the database schema and things become harder and harder to change. Of course this is a hard and fast rule. But I've seen so many systems suffer because of this. So I'd really consider if it isn't possible to have an API in front of the db and have other apps call it.
At one of my previous employers, stored procs were mandatory for data access (the services could not do a SELECT
for example.) They versioned the stored procs using a suffix like getData_V1
. Basically what @sigve.nordgaard said.
The reason this has come up is moving from not having sql calls in the apps themselves, and moving to only accessing db via stored procs, but there would invevitably be people looking at an existing stored proc and knowing they could call it. but then someone doesnt know that someone on another team is calling their stored proc now, changes it and breaks the other app. Unfortunately a db per app is infeasable right now.
The scheme I described avoided this because the stored procs were managed in a separate git repo, PRs had to be validated by DBAs who then created them (and they refused any modification to existing stored procs.)
I guess all the same things apply as for other shared dependencies. Out of curiosity why go from plain old SQL to stored procedures?
In our case ? DBAs wanted to review the SQL code to ensure there won’t be any perf issue.
Easier to code review sql, easier to configure perms on a per stored proc basis, easier to see history of a query.
Easier to see what dependencies are on a table, it's all in the dB rather than scatters through various apps
Well then a decent tradeoff might be to not break stored procedures (ever).
Treat it like a public api of any kind?
Is anybody here using Github Enterprise Cloud in their company by any chance?
Each app could also have procedures in the app namespace (in postgresql it's called schema, if your db doesn't support that, you could just prefix procedures with <app_name>_
. In case you would really want to share some procedures, you could put them in some shared
namespace (in which case they should never be broken or each app using the db should be checked if it uses the procedure)
I don't use procedures much though. So I don't have much experience with it.
I was thinking to myself “huh, parentheses, brackets, and curly brackets sort of shape data, so what if they expanded to take as many lines as they encapsulate?” Never mind this idea is ugly lol
These are several visual representations of https://raw.githubusercontent.com/t-mon/selffinding-chronicles/cb24e067579ba755c26ef642b24f9d2a8d3b45b9/gamedata/savegames/test-savegame.json for different sizes. The visualization works with any edn data. Color represents depth, and each box is a leaf value (ie. strings and non-collections like numbers, keywords, symbols). Map keys are given priority space.
I've tried a bunch of variations for "screen space bounded pretty print". I haven't tried background colors or otherwise to outline collections which is why I thought your initial suggestion was interesting.
I'm partial to rendering that data like this :portal:
@djblue what would that experience look like if that was an editing interface?
I haven't implemented edit in any capacity, but I think editing would be driven by the viewer. For instance, if you have a table view, I could image a ghost row at the bottom where you can start filling out new values for known keys, probably as an edn string that will get parsed. You could reorder/delete rows and add a new column.
For string: textarea, for boolean: checkbox, for number: slider, for inst: calendar. For anything novel, you can enter the value directly as edn or maybe you choose a type, get a default value for that type, then edit it like any other existing value.
What would “edit” mean in this context? You would need either a reference to an identity or place to put a new value
Yeah, that's the hard bit, especially editing recursive values. That's why I've avoided this problem 😅
I think tracking references is doable. You could use a lens-like library to do a lot of the heavy lifting (eg. specter, clojure.zip), but once you "edit" a value, your source code is no longer the source of truth. If you did want a reproducible program state (I think you do), then you would either need to do source editing, have a way to save program state (eg. smalltalk), or something else.
You're "collapsing blocks" away from a kick-ass EDN/code browser 🙂
It's a little intense with nested maps, but seems like an interesting direction
> (backend/draw-to-image! "boxes.png"
(depth-draw
(read-string
(slurp "<https://raw.githubusercontent.com/seancorfield/dot-clojure/develop/deps.edn>"))))
Could the idea of “many visualizations to the same blocks of data” be incompatible with things like Portal, Reveal, or the REBL? Why not just mix it?
What other structures would have a distinct color? Anonymous functions, maybe?
I’m not just thinking depth as a replacement for rainbow parens.. I was thinking about color coding the blocks based on whether the borders indicate it’s a vector, a map, a list, or a quote. I think shading for nesting is good too, but imagine if vectors had shades of a different color than parens. Like, how can we communicate more than the various types of parens, indentation, and rainbow parens?
Coming late to the party, but in theory what we are showing here (different ways to render EDN) is already possible with Chlorine and Clover, with a little bit of effort. I'm working on getting a better customizer for the rendering of EDN
Also, @rob370 I would love to know what are you thinking about this strucutural editing of Clojure code. Do you already have some ideas?
(Specially because the current Chlorine/Clover code is already 100% separate from any specific text editor, so if you decide to re-think text editing, I'm almost 100% sure that we can port Chlorine to it for example)
https://www.reactiongifs.us/wp-content/uploads/2015/01/well_there_it_is_jurassic_park.gif
I kind of like it tho
for a few lines it may be nice to see the grouping, but the wider {}
gets the more they start looking like ()
which i could see being confusing
It is kind of interesting
I experimented with https://blog.phronemophobic.com/treemap/treemaps-are-awesome.html to visualize medium size edn data. I tried using colors to represent types, but I never colorized based off of containers (only leaf types. see below) which might be worth experimenting with.
Just sharing this for fun. Search the Slack history using the Zulip Archive using a Scittle bookmarklet: https://borkdude.github.io/scittle/bookmarklet.html?name=Search%20Slack-archive&code=(when-some%20%5Bq%20(js%2Fprompt%20%22Search%20the%20Clojurians%20Slack-archive%3A%22%2C%20%22Query%22)%5D%0A%20%20(set!%20(..%20js%2Fdocument%20-location%20-href)%20(str%20%22https%3A%2F%2Fclojurians.zulipchat.com%2F%23narrow%2Fstream%2F180378-slack-archive%2Fsearch%2F%22%20q)))%0A Made by @jeroenvandijk and @eval2020
Btw is it possible to switch between the markup editor of Slack and the non-markup editor? I have turned it off by default, but for such a long link it would have been nice if I could have formatted it as [foo](bar)
Reminds me of https://github.com/thiagoalessio/rainbow_levels.vim
What the gadget!
That werkbank thing is very intriguing. The rainbow levels actually looks hella useful. If keywords and stuff could still somehow keep a color, or maybe a glow, or outline color, or even just a slight change in Light (Hue, Saturation, Light = brightness)
Doo doo doo alternative versions
Woah werkbank looks really cool. I wonder if it would be possible for Clojure to use Fructure for a structural editor? https://www.youtube.com/watch?v=CnbVCNIh1NA
on the desktop app, you can just type foo, select the text, and paste the link and it will automatically turn it into a link
oh really
no, that doesn't work when you have turned off the formatting stuff
oh, right. 😳
Yeah you have to change your preferences for that single message, currently
Hmmm. It would be cool to have a repl set up to a visual coding canvas so you can see results of "map" and "filter" operations instantly on observed data
ide of the future: coloring book
pff
Yeah @sova @clojurians-slack100 the rainbow indentation is cool but I think would work better if it were a translucent background color for the text instead of replacing syntax highlighting
Sove re coloring book you’ve got to watch the Fructure video it’s so cool
It's not too hard to get a basic insta-repl setup. The biggest missing pieces I've found are:
1. pretty printing results in within bounded screen space and bounded time
2. being able to pause/stop run away executions (eg. (last (range))
)
Would love to know if anyone has good solutions for 1 or 2.
Runaway calculations would be a big thing to address correctly. That's a really great question. How can we terminate a function that's maybe never going to halt ? Maybe add an escape clause to every function via macro that waits on a keypress combo or something? Naive idea
Damn it would be great to see the errors as something other than EOF BRO while you're typing
like "java.lang.hay not valid but keep going i guess
the EOF thing would be less of an issue if I was using paredit
If the JVM were a human being, what would be some of their favorite pastimes?
yes that is true -- my comment about seeing errors as more friendly "waiting" lines still pertains to any incomplete code ... did you make that little demo ?
That's one reason I really enjoy LightTable... inline evaluation of expressions. I think someone will soon nail it with the canvas'd clojure development experience
there's a couple of options that I think might be able to address run away calculations: • run everything in a separate process. you can always kill a process • write an interpreter that allows you to preemptively pause execution • modify an existing interpreter (eg. sci) to preemptively pause execution • use cljs and use a js interpreter that allows you to preemptively pause execution
dig it. process per function might be a lot but also maybe all good
you could reuse processes that don't need to be terminated.
Fair point. That way you are only hot-loading what is novel.
Good idea.
collecting garbage?
So all the good people who volunteer to clean up public parks on weekends are actually running java? :thinking_face:
found object art?
Putting things together just in time?
being very vague when it comes to telling you what's wrong?
https://twitter.com/RobertHaisfield/status/1398048606892875778?s=20