Fork me on GitHub
#off-topic
<
2018-11-21
>
lilactown00:11:38

my company just sent out an email saying everyone must uninstall Java due to the license changes in 2019 facepalm

andy.fingerhut00:11:18

Only the new Oracle JDK 11, or all versions of Java?

lilactown01:11:33

just “Java”

lilactown01:11:56

I would assume they want us to move off of Java 8 since it’s being EOL’d for corporations in January

Lennart Buit07:11:34

red hat is taking over support right?

henrik06:11:11

@lilactown I’ve never used JSX—am I wrong in assuming that it’s a templating language rather than a data structure? For example, I have Hiccup stored in a database (parsed from scientific articles, originally XML). Before serving the Hiccup as HTML, I map over the structure, looking for nodes that have a certain class attached to them. Depending on live data, I transform the nodes holding those classes in various ways. Is stuff like this straightforward to do in JSX?

lilactown06:11:00

JSX is a macro for function calls

lilactown06:11:17

so you couldn’t store it in a DB (probably)

lilactown06:11:22

you can traverse the returned React element tree. that’s how e.g. apollo-react and Relay do data fetching while server-side rendering

lilactown06:11:44

it’s definitely easier to do when using native collections, especially in Clojure

emccue06:11:31

Yeah, react elements aren't base data structures like vectors and maps, but they are still data

emccue06:11:58

just not data in the unordained useful form

Lennart Buit07:11:18

there is not much stopping you from replacing jsx with some map-based syntax right. You indeed would need to write a macro to generate createElement calls again

Lennart Buit07:11:24

Then you can traverse that map, change it and then expand the macro

lilactown07:11:10

both hiccup and JSX are kind of local maximums for their respective users, it seems

lilactown07:11:48

native JS data structures feel awkward to write deeply nested structures

lilactown07:11:51

all those commas!

Lennart Buit07:11:19

yeah you get createElement in createElement in …

lilactown07:11:46

plus the UIs they’re usually building are already going to be represented by XML anyway

lilactown07:11:00

there are all sorts of libraries out there that implement hiccup for React

Lennart Buit07:11:26

yeah right, and those hiccup “trees” you can transform in your clojure right

Lennart Buit07:11:50

so then you are where you wanted to be?

lilactown07:11:16

yeah there’s tradeoffs with hiccup vs a macro like JSX

lilactown07:11:27

hiccup is, at runtime, a vector

lilactown07:11:43

which means that you can transform it with your normal clojure.core collection functions

lilactown07:11:15

whereas JSX, being a macro that expands to function calls, requires you to operate on React elements which is obviously awkward

lilactown07:11:43

you do get some more performance out of the macro approach. but that hasn’t seemed to have much impact for people who use hiccup with rum and reagent

Lennart Buit07:11:21

how is that different than having some form of hiccup-to-react macro that you feed a normal collection. The only downside I see is that it is out of your control as soon as you transform it to react

lilactown07:11:35

but also React users don’t seem to be clamoring for a way to arbitrarily transform element trees ¯\(ツ)

lilactown07:11:00

right, it means you can only operate on it at macro expansion time

Lennart Buit07:11:27

right, we are on the same page then ^^

lilactown07:11:31

which, again, in Clojure isn’t untenable but in JS-land is completely off the table for most devs

henrik07:11:53

So, let’s say I’m in JS/React vanilla land, and I want to fetch a description of a page that I don’t control at programming time, transform it, and render it (or render it and then transform it, if the former is hard to do in JS). How would I do that?

lilactown07:11:29

you would probably build, essentially, an interpreter

henrik07:11:45

So, have the server spit out HTML, then parse the HTML?

Lennart Buit07:11:46

can’t imagine that not having been done before

lilactown07:11:47

I think the status quo would probably be something like markdown

henrik07:11:20

Markdown is not sophisticated enough for scientific articles. You have MathML and stuff in them.

lilactown07:11:25

@henrik well, you’d have the server spit out some data structure. it could be XML. and then parse that to React elements

lilactown07:11:46

it depends on if you’re hand authoring them

henrik07:11:05

Alright, so it might as well be EDN made into JSON on the fly then.

Lennart Buit07:11:08

ohh its plain old javascript handling it on the client?

Lennart Buit07:11:49

yeah, it would be your best bet to “interpret” your json and build a component tree

henrik07:11:59

Well, I have a Clojure server and a JS/React consumer on the other side. I’m responsible for the Clojure side, so I can hand out whatever essentially.

lilactown07:11:59

I’m not saying that your use case is well served in JS-land @henrik. but it also doesn’t (at the moment!) seem very in demand, either

Lennart Buit07:11:33

I don’t think that should be too hard, if you do it depth-first

henrik07:11:37

I guess not. So no one is storing and serving pages with React I suppose.

lilactown07:11:06

I think most people use server-side rendering for simple cases

lilactown07:11:10

we are actually doing that at work, yes, but we had to build that interpretation of JSON => React element tree

henrik07:11:40

Yeah, I can do a lot of necessary transformations while it’s still EDN on the server side. But some things have to be done client side, such as hook up functions to certain nodes, or transform nodes in real time etc. With no guarantee as to what the page is going to look like. You just have classes, IDs, and detecting shapes of data to work with.

lilactown07:11:42

we store the pages / page fragments in an external store as JSON

henrik07:11:36

I’m storing transit/msgpacked EDN

lilactown07:11:47

that makes sense

lilactown07:11:58

our use case is (at the moment) very simple. we don’t have much dynamic UX in those stored fragments

henrik07:11:15

Well, we don’t either 🙂

henrik07:11:03

But it’s going to get more complicated quickly, and JS/React doesn’t seem very good with data transformation.

lilactown07:11:26

the main boon is that we have an editorial interface that builds these pages and we can have them hook up to our design library build in React. it’s actually been awhile since I worked on that portion of the system. I had forgotten a lot of this. I see your point that this might be more desirable in the community in the future

henrik07:11:24

At least for cases where you don’t control the page creation directly, but you have to react to someone else’s page.

lilactown07:11:15

there’s been a proliferation of design tools library that go from a kind of UI builder => React components / elements. I could see that use case being more important as those tools gain popularity

lilactown07:11:31

twitter was going crazy over a tool called Framer a month or so ago

henrik07:11:41

I’m a designer, so I do keep up with the design tools. I’m not convinced that there is substantial benefit in going directly from sketches to code.

henrik07:11:22

That’s not one of the top bottlenecks that design solves.

henrik07:11:53

The top bottleneck is to make management and development understand each other.

lilactown07:11:36

I’m actually more convinced that could be a better way for authoring experiences then doing actual design

lilactown07:11:31

it’s way cheaper to teach someone to drag some pre-made components around a screen then it is to make a JS dev with React knowledge create the same experience

lilactown07:11:49

depending on your business

henrik07:11:46

Yeah, it certainly depends. If you’re making a ton of landing/marketing pages that share virtually the same features, I’d agree.

henrik07:11:01

If you’re working on complex (business-domain-complex) problems the story is different

henrik07:11:54

Either your solution is very specific, and it solves a particular problem really well, or your solution is general, and it doesn’t solve any particular problem, but is maybe good enough in a ton of situations.

lilactown07:11:03

we have a healthy collection of both where I work right now. hence trying to use React to standardize our design library

henrik07:11:32

Oh, right. Well, a design system is always nice to default to.

henrik07:11:00

There’s no point in discussing what a dropdown should look like every single time one is needed.

lilactown07:11:19

we’re migrating all of our complex experiences to reagent and betting on this JSON => React system we paid some consulting firm to build :face_with_rolling_eyes: for our marketing pages

henrik07:11:47

Oh, interesting!

henrik07:11:09

So then you have an author tool to generate the JSON?

lilactown07:11:23

yes, which the consulting firm also built

lilactown07:11:13

it depends on the design system to provide the components to show authors when building a new experience

lilactown07:11:35

they can then place them and add text, minor theming/styling, etc.

lilactown07:11:49

it’s all pretty rudimentary right now but it’s a hopeful solve

lilactown07:11:34

of course now, the consulting firm has gone and built a product which does the same thing, after we paid them to build the POC, and are now trying to sell that to us

lilactown07:11:40

I’m a bit salty about the whole thing lol

henrik07:11:29

Oh, that’s sneaky.

henrik07:11:12

Aren’t they effectively trying to compete with SquareSpace etc. by doing so though?

zyxmn16:11:42

Hey fellas , is there any reliable/possible way give a http POST redirect response for an incoming http GET request. I achieve a similar sort of effect by responding to the GET request with a form that auto submits via post method once loaded on the browser. I am not sure if this is necessarily the right way to do it and worried if there are any security implications to this approach. Hope someone has faced a similar task!

chrisulloa16:11:09

That doesn’t sound very RESTful

lilactown16:11:08

@zyxmndaleyjes is this a sort of hack to get around some obnoxious client code or are you in control of both the server and client?

zyxmn16:11:28

only the server

zyxmn16:11:43

unfortunately I cannot direct talkly to the post endpoint but have to go via the client as it only accepts requests from the client's environment which is a messaging app .

lilactown17:11:28

I think the “RESTful” way of doing this would be to respond to the GET with the required parameters for the client to send the POST itself

lilactown17:11:40

it’s not as automagic but much more flexible and predictable

zyxmn17:11:27

I agree, but unfortunately my constraint is that the client code is not changeable and it will send the initial GET request and that's it . Any parameters I send to the client will be ignored, unless I send it a redirect or something that executes automatically like the form auto submit for instance .

vemv19:11:31

What's the best OOP book describing this style of programming/testing? I'm already familiar with it, but would appreciate an authoritative source that I can pass to my peers

vemv19:11:50

(DI is well-known of course... but side-effect-free OOP not so much)

3Jane19:11:35

…that is not what dependency injection is

3Jane19:11:49

which is not helpful when you’re looking for an authoritative source 😄

3Jane19:11:34

I guess you’re looking for things around single responsibility principle and composition over inheritance

vemv19:11:11

> …that is not what dependency injection is Dunno, e.g. stuartsierra/component advertises itself as a DI solution, which makes sense to me. And component eases writing projects that follow the technique described in the screenshot

3Jane19:11:40

I meant the quote you pasted; “let’s rewrite this function so it obtains all its state from the caller”.

3Jane19:11:14

If an object has no state, why make it an object? This is how you end up with awful Util classes full of statics.

vemv19:11:48

A class can have a SystemMap as its state, so we don't have to pass it as an argument to every method

class Foo
  SystemMap system_map;
  foo(x){ ... } 
  bar(y){ ... }
instantiable, testable, concise

dpsutton19:11:39

mark seeman had a great video "type driven development in f#" and it was basically how we worked in C# with DI

robert.spurrier19:11:26

What is your second favorite programming language? =]

eggsyntax19:11:46

@lady3janepl I took @vemv to be saying they were on a team and/or working in a language that was very OO, and that they were looking for a way to make things a bit more functional*. @vemv did I get that rightish? * without making the team feel too threatened

eggsyntax20:11:01

(in retrospect I was maybe going out on a limb there 😆 )

vemv20:11:12

That's right @eggsyntax, the team's instinct is to just inline side-effects instead of using any kind of DI or argument-passing Now, I don't want to pass them a bunch of blog posts from folks I happen to agree with. I'm pretty sure this has to be a well-known practice in certain circles

eggsyntax20:11:09

I agree with @lady3janepl that when OO folks talk about DI, they're fundamentally talking about objects which bundle state. So if it were me, I wouldn't choose DI as the point of intervention.

3Jane20:11:14

pipeline style programming

vemv20:11:37

as in ->>?

3Jane20:11:03

as in unix pipelines for example (but also applicable to ETL pipelines as an example). it’s a term. let me find you a book I saw recently

vemv20:11:19

know the unix ones too

vemv20:11:16

but it's too broad a term to convey the knowledge I want. Same with decorators probably

3Jane20:11:49

it presents various programming styles, and presents functional programming as “pipeline”

vemv20:11:24

read! https://github.com/crista/exercises-in-programming-style/blob/master/05-pipeline/tf-05.clj maybe the example is not as rich as I would want. I'm more interested in how applications are organized, how to deal with side effects and how the logic is tested in a decoupled way

3Jane20:11:24

can’t help any further, I’m more of an understand-good-practices-intuitively than quoting-buncha-authorities person 🙂 ¯\(ツ)

vemv20:11:42

I respect that 🙂 But in certain gigs one just gotta quote the bunch...

👍 4
3Jane20:11:23

decorators and such?

schmee20:11:39

@vemv you may want to look into “Constructor-based dependency injection”, if you want some “authority” to refer to check out https://martinfowler.com/articles/injection.html for instance

👍 12
eggsyntax20:11:24

Good thought! I forgot that people sometimes used a constructor-based style of DI. I'm a bit out of practice on OO 😆

eggsyntax20:11:24

That way you could at least treat it as an immutable bundle of state...

dpsutton20:11:21

this is how we programmed at last job in C# and it was quite nice

🙂 4
3Jane20:11:45

see, that’s what I know as DI 🙂 object composition.

3Jane20:11:16

(of course, when you couple this with the common “define dependencies declaratively”, you can end up with circular dependencies, and also what I heard someone once call “ask for a monkey, get a forest” (ie you ask for a service which requires its 3 dependencies to be instantiated first, which requires their 12 dependencies to be instantiated first, which requires…)

dpsutton20:11:39

dependency injection for us removed that concern with interfaces. it might be a monkey in a jungle but all you coded against was IMonkey for example

dpsutton20:11:15

very nice to code against what you needed IMonkey and then later worry only about those requirements in a dedicated class

3Jane20:11:26

yeah, the monkey thing is a runtime problem rather than a coding problem

3Jane20:11:42

also spec testing with interface based mocks is 👌

schmee20:11:27

if you write Java 8+ with constructor DI, interfaces and without the big, “enterprisy” frameworks, it’s actually not bad

3Jane20:11:33

anyway, I think we’ve veered off the question quite far now 🙊

schmee20:11:46

good thing we’re in #off-topic 😉

😱 4
vemv20:11:41

> https://martinfowler.com/articles/injection.html gave it a quick read, it might be on the right track but the amount/density of boilerplate can be scary. The essence of the pattern is probably small and clean. The other day I created a good-enough component clone in Ruby in dunno, 45 minutes? Also I'm interested in how DI relates to side-effects, which in turn relate to testing. I could find some blog posts illustrating this relationship, but without the clarity and authority that can really motivate a team and make them learn new things fast. Perhaps for what I want to achieve (convey a specific technique/benefits) there's no shortcut 🙂

schmee20:11:51

I noticed that the article is from 2004 so it’s probably not up to date with how people are doing things in 2018

👍 4
jaide21:11:02

Is it ethical to just “double your estimates”? I get the idea is to offer padding for the unknown unknowns buuuut is the practice dishonest or at the very least demonstrating a lack of ability on my part to accurately estimate projects?

dominicm21:11:48

Is anyone adversely affected by it?

dpsutton21:11:27

my understanding is that if you don't double it it isn't accurate. seems unethical not to double it

eggsyntax21:11:28

Remember Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.

jaide21:11:22

Those are excellent points. I don’t think anyone is adversely affected by doubling it and if it’s the hubris of an engineer to believe they can accurately estimate a project then it sounds like it’s the right way to handle it.

Richard Smedley21:11:28

When you estimate how long a job will take, you will default to assuming everything will go right. It's been demonstrated often that human beings are not very good at picturing realistically how sub-optimally life turns out. 😄 Double your estimate with a clear conscience, and after doing it a dozen times, see if doubling is enough. https://en.wikipedia.org/wiki/Planning_fallacy https://www.lesswrong.com/posts/CPm5LTwHrvBJCa9h5/planning-fallacy

eggsyntax21:11:28

@jayzawrotny I think it's fine, with the caveat that someone needs to double it at some point along the line. If you have a savvy PM, it may be worth communicating with them about which of you will do that. Although frankly, if you both double it, it often ends up being more accurate 😆

✔️ 4
eggsyntax21:11:02

> Double your estimate with a clear conscience, and after doing it a dozen times, see if doubling is enough. ☝️

ljosa21:11:36

Good PMs know to multiply any engineer's estimate by pi.

😄 4
andy.fingerhut22:11:48

When I was about 25, an engineer I worked with who was about 50 and I talked and decided on the rule of thumb: Multiply the time estimate by (50 divided by the age of the engineer giving the estimate)

😆 16
jaide22:11:20

Did that work?

andy.fingerhut22:11:09

I didn't actually apply it that often. Remember it more for its humor value than anything else. Some managers / VPs who are good, are good in part because they figure out and remove the road blocks that make better time estimation possible.

eggsyntax22:11:32

I find it useful to be aware of the inside-view vs outside-view discrepancy (from Kahneman; see http://www.overcomingbias.com/2007/07/beware-the-insi.html ). We tend to estimate from our inside view. Adding a fudge factor is something we do from outside view, based on our observations over time of the relative (in)accuracy of inside-view estimates.

metal 4
eggsyntax22:11:23

(the planning fallacy articles posted above probably talk about that)

3Jane22:11:13

Firstly, the problem is that estimates are often taken as informal deadlines.

3Jane22:11:14

(This is not a deliberate evil or incompetency; this is anchoring effect in action - the same reason for why people say “never be the first person to give a number in negotiations, but if you do have to give a number, start with an overly high one.)

3Jane22:11:36

If you start with a large estimate and deliver earlier, people will see you as competent; if you start with a short estimate and have to renegotiate it, people will see you as less competent. People value keeping promises. (But not, apparently, overdelivering.)

jaide22:11:15

Ouch, my ego… but very good point. I’m very guilty of doing that.

3Jane22:11:19

We all do, because it describes how human buttons are pushed. The problem is, even being aware of where your deficiencies are doesn’t make you better at avoiding them: the aforementioned Kahneman, currently the authority (although my view of who’s the authority might be skewed, as I’m a popscience reader) on the subject of cognitive errors, expressed frustration that despite years of research he was unable to stop himself from making these errors.

Conor22:11:10

A lot of the human experience is probably post hoc narrative building

💯 8
3Jane22:11:07

So, like, is it unethical? Not any more than knowing that your manager is grumpy before first coffee, and waiting with dumping a problem on their head until they’ve had that coffee. I’d say it’s more in the realm of diplomacy and empathy.

👍 8
3Jane22:11:35

(Empathy because I suck at this, you suck at this, we’re all in this together, and the only thing we can do is to be aware of what buttons we may be pushing by our actions.)

3Jane22:11:35

and that, gentlemen and ladies, is where I discover great empathy towards people whose eyes are closing and bundle myself off 😉 gn!

jaide22:11:17

Good night! Thanks for your insight.

andy.fingerhut22:11:49

I think it would be unethical to deliberately give a wrong estimate to someone who was paying you to give your best estimates. I think it is quite ethical to give a range of "best case, if things go well, average case, if average number of unknown things arise, and longer case, if lots of bad things arise"

andy.fingerhut22:11:28

and try to list the things you don't know, that you believe would lead to the largest increases in time required.

jaide22:11:45

Cool, I did make that list of unknowns for the first time in this project.