Fork me on GitHub
#off-topic
<
2018-01-26
>
tagore03:01:30

Going back a bit to exposure to OOP vs functional, etc... I think a lot could be said on that subject. I won't try to say it all.

tagore04:01:53

My first real programming language was C (BASIC was the first, and Dijkstra had some pungent words about BASIC and exactly this question,) and I wound up doing scheme/CL and C++ in parallel for a while after that. But for a long time I treated C++ as C with a novel scoping mechanism (a not uncommon approach among graphics programmers to this day.) I'd say the C++ I wrote back then was essentially procedural rather than object-oriented in any real sense.

tagore04:01:42

But in the early aughties I started paying attention to the whole OOPSLA, GoF, Ward's Wiki thing, and eventually wound up pretty deep in the rabbit hole of Object Oriented Design.

tagore04:01:29

I've come to think that much of that turned out to be a dead end for me, in the long run, but I learned quite a bit from it.

tagore04:01:00

The thing is, procedure is the natural coin of the von Neumann architecture. And any approach that isn't entirely procedural must be a matter of encoding procedure. The encoded procedure is tucked away somewhere in every program that can run on a computer.

tagore04:01:38

I eventually wrote some complicated software in a true OOD style. I was never a huge "patterns" guy, and I at least had the good sense to stay away from factory factory factories, and such, but...

tagore04:01:50

I eventually found that the way I was encoding procedure was through run-time relationships between objects with mutable state, and... well, that that was too clever by far, and there were way too many ways to do it, none obviosuly more straightforward than the rest.

tagore04:01:19

I found that OOD can far too easily become architecture for the sake of architecture.

tagore04:01:07

And that these architectures could become difficult to understand because the procedure was embodied in run-time relationships. You had to model the changing run-time behavior of the system in your head to understand even pretty simple things.

tagore04:01:47

Don't get me wrong- I had a lot of fun writing software in that style. But I had a bad time maintaining and extending it.

tagore04:01:59

Suffering from the effects of that style was educational for me, and made me more inclined to prefer a functional style, even in languages where that was not entirely natural.

tagore04:01:58

So I'd say that, unlike Dijkstra, I think that exposure to OOD is not a permanent impediment, and can in fact be an asset.

tagore04:01:10

And I really did learn a lot from the Smalltalk community, OOPSLA, etc. A lot of it was pretty OOD specific, if not C++ weakness specific, but a lot of it was and is applicable to all sorts of programming.

tagore04:01:13

I do try my hardest to avoid people who are still enamored with architecture for the sake of architecture though.

tagore04:01:08

Even abstraction for the sake of abstraction, or DRY for the sake of DRY. Everyone's first complaint about beginners is that their code is not DRY enough. My main complaint with experienced programmers is that their code is often far too DRY.

naomarik04:01:52

@tagore yeah and with OOP style i’ve ended up backing myself into a corner far too often over abstracting things only to find a small new use case that breaks everything i’ve meticulously built

tagore05:01:54

@naomarik Exactly. That's why I mentioned DRY. It might seem unrelated, but...

naomarik05:01:10

makes perfect sense

naomarik05:01:22

dealt with it a lot in my own experience 😉

tagore05:01:34

Committing to an abstraction too early is dangerous.

tagore05:01:02

And a lot of OOD kind of makes you do that.

tagore05:01:01

It's funny- when I was just starting to be reasonably adept at programming, say after a couple of years of doing it...

tagore05:01:19

I wrote a lot of very abstract code.

tagore05:01:49

These days... I write a lot of fairly plodding code, much more than I would have then.

jgh05:01:55

at one of my first jobs half the company was in germany and often I would come to work in the morning finding my code refactored with a stern message about DRY waiting for me.

tagore05:01:22

@jgdavey h I know the feeling. There is maybe a bit of struggle for me even now over this where I work.

jgh05:01:49

wrt abstraction I find for whatever reason c++ is relatively easy to avoid too much abstraction (maybe because doing boilerplate stuff for the abstraction is painful), but languages like java and c# make it very easy to go down the abstraction rabbit hole

naomarik05:01:52

awhile back when i worked for a company here a task fell on me last minute and i had 8 hours to finish something that was someone else’s mess. had to navigate through like 6 interconnected classes that made absolutely no sense why it was that way. ended up just ignoring all that and doing it from scratch, was way shorter and got it done in time, and no interconnected class dependencies.

tagore05:01:58

A lot of the code I write looks childlike, apparently.

tbaldridge05:01:18

ooh, storytime? 😄

tagore05:01:41

My opinion is that, as long as it's correct, that's a compliment.

tagore05:01:18

It takes a certain amount of work to write code that is both childlike and correct.

tagore05:01:37

And yes, it is storytime.

tbaldridge05:01:39

I once worked on a .NET app that used events a lot. Basically they were the equivalent to a list of functions that could be attached to a object's property. So when you fire the event the functions all get called. Each of those functions were on classes that had a polymorphic tree about 3-4 levels deep. It was insane because any sort of change in the object could send you flying in the debugger to the other side of the app.

tbaldridge05:01:45

.NET also has properties, which are methods that look like fields. So foo.bar = 32, could end up calculating the 32 factorial for all you know

tagore05:01:59

If someone can follow your code as easily as they can follow 'Goldilocks,' and with as much engagement, you have done your job better than I generally do mine 😉

tbaldridge05:01:12

For that matter foo.bar could do the same, so that can hang your debugger when it tries to watch a class.

naomarik05:01:37

speaking of preventing nesting, peter introduced me to this and i use it quite liberally https://github.com/ptaoussanis/encore/blob/master/src/taoensso/encore.cljx#L212

jgh05:01:47

i wonder what writing a c++ program as if it were functional would be like.

tbaldridge05:01:11

It's really possible these days with C++14

tagore05:01:28

@jgh it's just very ugly and uncomfortable, pretty much.

tagore05:01:47

Which halfway defeats the purpose.

jgh05:01:57

i imagine so, especially if you have any plans on using 3rd party libs

tagore05:01:39

Dunno.. I don't want to offend any C++ lovers here, but...

tbaldridge05:01:39

Something like Ferret, but a bit more opinionated on how to do RCs and dynamic typing.

tagore05:01:53

C++ might be tha language I have programmed a lot in that I hate the most.

jgh05:01:30

I really like the changes to c++ since c++11, even if a lot of it is comically verbose.

tagore05:01:41

It's just that it was for a very long time close to impossible to do serious work in graphics in any other language.

jgh05:01:29

and of course there are funny little quirks like c++17 structured bindings don’t have ignore, so you have to do stuff like auto [a, b] = func(whatever); (void)b; to avoid compiler warnings

tagore05:01:26

One issue with C++ is that it is the language that can't say "no."

jgh05:01:45

interesting point.

tagore05:01:29

So you think you kind of know C++ and then you try to read someone else's code and realize that they are using a subset of the language you aren;t at all familiar with.

tagore05:01:11

I wonder if I can find a line of code a friend of mine wrote in actual anger....

jgh05:01:31

i bet you could find a doozy.

naomarik05:01:40

i have that experience, except instead of c++ it’s every new version of javascript that comes out biannually

tagore05:01:03

It is the most bizarre templatey thing I've ever seen, but according to him it actually made sense to write it.

jgh05:01:02

theres a talk from cppcon last year I think called “constexpr all the things” and they basically demonstrate writing a program that runs at compile time and just emits the answer at runtime. I think they mentioned (or someone maybe commented on the video or something) that the code takes 45 minutes to compile.

seancorfield06:01:19

Erwin Unruh showed something like that to the committee back in the mid-90's. We had quite a bit of fun with it... writing C++ programs that didn't actually compile but the error messages produced had the answers to the computation 🙂

madstap13:01:56

Reminds of aphyr solving the n queens problem in the haskell type system https://aphyr.com/posts/342-typing-the-technical-interview

madstap13:01:21

You smile kindly. “Haskell is a dynamically-typed, interpreted language.”

jgh05:01:13

oh it was a compile-time json parser or something like that

tagore05:01:14

That's actually a pretty normal C++ thing.

tagore05:01:47

Think of templates as equivalent to macros in Lisp.

tagore05:01:42

Except they are so hard to write that it's amazing when someone manages to compute something interesting with them.

jgh05:01:40

yeah the templating language is pretty dense…at least constexpr gets part of the way to making it comprehensible

jgh05:01:55

between template recursion and type_traits it’s a mindbending world

tagore05:01:43

I haven't kept up with C++, but is there anything there that isn't trivial with CL-style macros?

jgh05:01:11

well you can write another language with macros cant you

jgh05:01:54

my guess is no! (to your question, not mine)

tagore05:01:12

Both macros and C++ templates are Turing-complete,

jgh05:01:24

yes but one is easier to do it in than the other 😉

tagore05:01:54

Which was my next point 😉.

jgh05:01:58

i mean sure i could write a webserver in brainf*ck….but do I really want to?

tagore05:01:39

Actually, I'm not sure about the can there, except theoretically.

tagore05:01:15

I could not write a web-server in brainfuck.

jgh05:01:39

ya i dont know if it’s actually possible or not, i was just being hyperbolic

tagore05:01:51

It's possible in theory.

tagore05:01:20

But the whole point of programming languages is to make the theoretical possible given ou very limited brains.

tagore05:01:18

I think I'd find writing an acceptable web-server challenging in my favorite language.

tagore05:01:14

Just so, when it comes to meta-programming...

tagore05:01:54

The amazing thing about a dog who speaks isn't his conversational skills- it is that he speaks at all.

tagore05:01:58

It was amazing when people figured out how to count with C++ templates.

tagore05:01:59

It was even more amazing when people figured out that C++ templates are basically a Turing-complete language.

jgh05:01:58

maybe one day we’ll get proper macros in c++ haha

tagore05:01:28

I'm inclined to think that if you find it amazing that a language is Turing-complete I'd rather not do general programming in it.

tagore05:01:21

Of course it also turns out that macros in Lisp are overrated, but that's another topic.

tagore05:01:08

At least they aren't much harder to write than anything else in Lisp, right?

jgh05:01:46

metaprogramming is only going to be so useful because ultimately you can’t do everything at compile time, but at least it shouldn’t have to be completely different from the language you’re already working in for the runtime component.

jgh05:01:09

yeah exactly

tagore05:01:38

I'm inclined to think that the only good use of macros is to introduce new syntax, and that it had better be useful new syntax.

tagore05:01:21

That said- syntax is not unimportant.

tagore05:01:35

You could in fact consider a lot of Clojure's implementation macros that provide a convenient interface to its lower level JVM bits.

tagore05:01:29

Oops, sorry- I sometimes forget I'm not always in vi and post vi command sequences.

seancorfield06:01:19

Erwin Unruh showed something like that to the committee back in the mid-90's. We had quite a bit of fun with it... writing C++ programs that didn't actually compile but the error messages produced had the answers to the computation 🙂

tagore06:01:16

Sure- but this is only

tagore06:01:56

err- didn't mean to post that, but...

seancorfield06:01:26

Blame vi again 🙂

tagore06:01:45

I'm all about blaming vi, tbh.

tagore06:01:10

Though I'm really more about blaming every other text input for not being vi.

tagore06:01:49

Here's an interesting question:

tagore06:01:17

What's the most meaningful message you might plausibly accidentally send because you thought you were in normal mode?

seancorfield06:01:09

😂 My wife refers to vi as "vicious instrument" after using it at work decades ago...

tagore06:01:49

There's def some garble in many of my github comments. A lot of them end with :wq for no very good reason.

tagore06:01:34

Even worse. SPC f s, cause evil-mode.

tagore06:01:42

That one I tend to catch though.

tagore06:01:23

I am curious about the longest string someone can come up with that is both comprehensible English and a plausible vim command sequence.

seancorfield06:01:30

I bet you could write a clojure.spec for that and then use generative testing and a dictionary to find the answer 🙂

tagore06:01:04

It's the plausibility bit that's the rub.

tagore06:01:26

Interesting you should say that though. I just spent a bit more on a graphics card than I consider entirely reasonable in order to be able to experiment with things like that.

tagore06:01:09

I'm pretty convinced that generative testing is a step in the direction of generative coding. That said, figuring out what you want has always been the most difficult part of writing software.

tagore06:01:44

In a very real sense if you can write down what you want, completely, and it doesn't run, your compiler is not sufficiently smart.

tagore07:01:38

I'm interested in the gaps... how do we get from partially expressed to completely specified?

bherrmann16:01:15

This "scientist" thing is an interesting idea. So you want to push a change to production (or have a ci system which does it all the time), but you dont want your production users to experience the suprise of getting new code. The idea is that instead you have a "use" and a "try" block. The users always get the outcome of the "use" block, but the system also runs the "try" or "experiement" block. The system keeps track of the two outcomes and shares them with you, the developer. This way you get to test your code in production (only if your code is side effect free) and get reporting on if your new technique worked... so you can feel comfortable switching to the newer approach when the stats look good. https://github.com/yeller/laboratory

gonewest81818:01:08

There’s a GitHub engineering blog post describing the motivation for their “science” library for Ruby. This article led to some fun discussions with the C-suite why one would ever wish to push experimental code into a production environment. https://githubengineering.com/scientist/

pesterhazy16:01:23

I'm looking for a hosted database, ideally postgresql or mysql, but it could be anything. Requirements: - most importantly, easy to set up (ideally zero set up, free for small amounts of data) - usable from a hosted service like https://zeit.co/now - only tiny data requirements (<10M) - only simple queries, k/v store might be enough I'm aware of AWS's RDS and gcloud sql. Anything else I could try?

pesterhazy16:01:53

Basically I need something hosted to use for coordination, for simple services.

rauh16:01:28

redislabs has 30MB free I think

pesterhazy17:01:52

@rauh, interesting. Does that persist to disk?

pesterhazy17:01:57

hm that's only for ephemeral data (mostly caches) then

pesterhazy17:01:12

perhaps firebase is a better option

greglook16:01:46

DynamoDB if you only need k/v or simple indexes

Chris Bidler16:01:50

how hard is your requirement that it be an RDBMS? DynamoDB would be the fir-

pesterhazy16:01:56

yeah that would be fine

pesterhazy16:01:06

good idea, didn't think of that

Chris Bidler16:01:05

today’s #justclojuristthings moment for me - that feeling the first time you correctly identify some->> as the appropriate tool for a “real” problem, write it out, and it works the first time

Chris Bidler16:01:18

power …overwhelming

dpsutton16:01:28

from my friend who went to lambda conf: > It was awesome but dunno if closure people would like it. It was very haskell centric

pesterhazy16:01:38

A room full of types types

qqq17:01:17

@pesterhazy: seconding aws dynamodb/rds

pesterhazy17:01:04

@qqq, RDS postgresql db.t1.micro is USD 18/month

jgh17:01:44

interesting summary of the lambdaconf 2016 situation mentioned in #events for those of us who missed it: http://medium.com/@codepaintsleep/lambdaconf-2016-controversy-2d4b13c338cf

pesterhazy17:01:37

@qqq, GCloud SQL postgresql db-f1-micro is USD 8/month

pesterhazy17:01:26

I guess an acceptable price...

jgh17:01:46

@pesterhazy digitalocean has 1 vcpu/512mb/2gb(?) instances for $5/mo that you could throw postgres or mysql on

rauh17:01:22

@pesterhazy A bunch of the MongoDB cloud providers have a free tier. Though you'll share the instance...

pesterhazy17:01:37

@jgh, true! but RDS/GCloud give you reliable backups, that seems worth the premium

pesterhazy17:01:56

@rauh, any ones you've tried?

rauh17:01:25

Many years ago, yes. But they still seem to have it.

jgh17:01:09

2nd mlab

rauh17:01:34

For $6 a month you have fully managed 100MB redis instance with failover and persistance...

qqq18:01:25

@pesterhazy: if your work is tiny, does it not qualify for amazon free tier ?

qqq18:01:36

$18 / month sounds high for the smallest tier

pesterhazy18:01:56

Yes but only for a year right? @qqq

andy.fingerhut22:01:54

@michael740 was asking in the beginners channel yesterday about other discussions of, and/or the significance of, the Y combinator (not the startup incubator, but the lambda calculus construct after which that company was named).

andy.fingerhut22:01:26

I've never studied lambda calculus, but I know that an oft-explained aspect of the Y combinator is that you can use it to define anonymous recursive functions, and I've heard that perhaps its origin was in proving that the lambda calculus is a Turing complete model of computation.

andy.fingerhut22:01:40

Does anyone here know if there is anything more to it its significance than that? I do believe that is hugely significant, but was wondering if there was something else about it than that. It is of course a mind-twisting example of code, too, that makes for a puzzler to figure out what is going on.

andy.fingerhut22:01:05

Here is a link to a potentially-informative StackOverflow question on the topic, with many answers that I haven't fully digested: https://stackoverflow.com/questions/93526/what-is-a-y-combinator

andy.fingerhut22:01:28

Hmm: Searching a bit more, some discussion on possible origins of the idea here: https://mathoverflow.net/questions/31893/what-is-the-history-of-the-y-combinator