Technical Debt Is Like Tetris - <AUTHOR> https://medium.com/@erichiggins/technical-debt-is-like-tetris-168f64d8b700 <comment> dane-pgp It's a great analogy, and it reminds me of a model I like to use when thinking of technical debt:

Get a jar full of jelly beans, and every time you have to make a compromise (e.g. adding some hacky code or introducing some problem you'll have to fix later) take a bean out of the jar. If it's a terrible hack, then take out several. For the first few jelly beans, you won't even notice the change to the jar, and the first few compromises aren't going to be a problem for the code either.

Once the decrease in the jar contents starts to become noticeable, though, use the fraction of empty space as an enlargement factor for any estimate. So if the jar is 10% empty, consciously and vocally add a 10% additional "interest payment" on every estimate you give. If the jar is half empty, then you can double your estimates.

This is all very approximate and not rigorous at all, but it does help a team to visibly keep track of the amount of compromises they are making, and does surface the hidden cost to future development that gets ignored by a "normalization of deviance" bias.

At the very least, even if a team isn't allowed to change their estimates based on this model, you still get to eat a jelly bean or two every time you add a hack to your code, which can make the decision less stressful (unless it becomes an incentive to deliberately add hacks).

<comment><USER2> It's weird when you are part of a larger org; you still worry about technical debt as a team, but you have to also deal with, like, _institutional_ technical debt.

Realistically, something like 10-20% of the engineering resources at a company like Google or Microsoft are going to service technical debt at an institutional level. Sometimes it is literally all an engineer does, like maintain a deprecated system that can't be turned down for five years or a team migrating large systems from the old and busted to the new hotness, sometimes it's just the tax on engineers doing other projects to work around the technical debt. It's just what happens when you have tens of thousands of engineers working for decades.

</comment></comment><comment><USER3> I recently needed an HDMI cord for a monitor and realized that my cord drawer was accruing technical debt.

Whenever I am done with a cord I just throw it in there... it gets all tangled up with all the others. When I inevitably need one of those cords I impatiently pull it out and it makes all the other cords more tangled.

Here I am needing an HDMI cable that won't just come out easily, I have to pay off my past laziness. But I have choices/tradeoffs/opportunities here.

I can just hurry up and get the minimum untangled and get back to watching TV.

I could untangle all of them since untangling one of them will help me untangle the others and wrap and label them.

I could just untangle the minimum, but also throw a roll of tape and a marker in there and wrap and label all future cords that go into that drawer, eventually they'll all be nicely wrapped up and well documented.

¯\\_(ツ)_/¯

<comment><USER4> Wow. I never thought of clutter in the home as technical debt, but it's as similar as you describe. That really makes me see home organization in a whole new light.

<comment><USER5> Check out Mari Kondo's show on Netflix! It is a guide on managing organizational debt in your home!

</comment></comment></comment><comment><USER6> I like the analogy, but it slightly suggests that you're always powerless along the way and that the debt is inevitable. I think there _is_ a technique that is possible in a lot of situations: not putting in abstractions/complexity that don't really do any of transformation/transfer required of the underlying requirements.

The reason why this is often possible, is that it's _less_ work to start with compared to adding in the layers...

... and then when unexpected requirements turn up, there is less complexity to deal with, there are fewer layers to work/hack around, and refactoring those that _are_ there to be more suitable to the current set of requirements is often easier, and so more likely to fit into time constraints.

I like to think of it as:

> Just about everything is cheaper than the wrong abstraction

(With a clear nod to Sandi Metz)

<comment><USER7> > _I like the analogy, but it slightly suggests that you 're always powerless > along the way and that the debt is inevitable._

We are, and it is.

> _I think there _is_ a technique that is possible in a lot of situations: not > putting in abstractions /complexity that don't really do any of > transformation/transfer required of the underlying requirements._

That's no good, because we can pile debt even when we don't put in "abstractions/complexity" that are not required.

Plus, the abstractions we built (that were 100% necessary) 1 year ago, can impact a big debt into the requirements we have now.

Debt comes from (a) the mismatch between the cleanest/fittest implementation and what we have done instead (which would always be there), (b) things set rigidly, even if they were OK for then (c) changing requirements that force us to work around our imperfect and rigid implementation.

So, it's multifold:

1) We'll never be able to write the cleanest implementation (due to time/skill/etc. constraints)

2) Even if we get close to the cleanest implementation, we'll never be able to foresee all kinds of future needs (and if we try to plan ahead for "possible cases" before we know what they actually are, we're just making things more verbose and rigid if we were wrong).

3) When the new requirements actually come, we won't have time to rebuild everything, and thus we need to build on top of what we have, adding things that go to new directions and for which our previous structures are not ideal

Rinse and repeat.

The only way to avoid debt is to work on smaller, constrained problems, that don't change and which doesn't have to adapt to changing environments much either (e.g. write the 'grep' program). This gives us all the time to polish our implementation, rewrite everything we want, etc.

</comment></comment><comment><USER8> Less code, less debt.

<comment><USER9> A good general rule but not an absolute one.

<comment><USER10> If it were we could just delete all our tests.

</comment></comment></comment><comment><USER11> One thing I like about this analogy is the implication that some debt can make it harder to pay off other debt. It definitely operates in higher dimensions than just the two. I'm not sure about the implication that delivered features don't have a cost.

</comment><comment><USER12> Is tech debt subjective? I've worked on different teams that call anything from wrong grammar in comments to incorrect capitalization of a var name tech debt. Wondering if it follows that more code = more debt because more people have opportunities to disagree about how something was done.

Asking for a friend.

<comment><USER13> Do you disagree with the notion that misspelt comments or variables is technical debt, though? Personally I would consider it a light form of technical debt simply because it makes the code slightly harder to read.

<comment><USER14> It not only makes it slightly harder to read - it can also make it slightly harder to modify.

For example, if all variables in a code base are camelCase but one variable StartsWithUpper, chances are every time you reference that variable in a future code change you'll call it startsWithUpper and then hit an error (depending on the language, either at compile time or run time), and have to go back and fix it. So it adds a little time to development in that way. Negligible, but non-zero

</comment></comment></comment><comment><USER15> Excellent and pragmatic analogy!

</comment><comment><USER16> Author here, thanks for sharing! Happy to answer any questions!

<comment><USER17> Great analogy, and very thought provoking.

Had me thinking about different strategies you might use in Tetris and how they mirror development.

For example, when you do the big setup to drop a vertical 4x1...and it doesn't arrive.

Classic case of Yagni or Premature Optimisation leading to technical debt.

</comment></comment><comment><USER18> "It hid any patterns that might have alerted us customers weren't being billed." Haha. Not being billed by the software owner...

</comment><comment><USER19> This title is so great, it conveys an almost perfect analogy of the reality of technical debt!

</comment><comment><USER18> My Google Drive has an enormous "cable drawer" technical debt.

</comment><comment><USER20> This might be captain obvious to some, but I think it still needs to be said: Technical debt is like any other debt and needs thorough analysis and some business strategy applied before things can and do get better.

<comment><USER12> You're saying tech debt is a business strategy problem?

<comment><USER21> I'd say so. If you aren't assigning your teams time to review the mistakes of the past and actually fixing them, then you're not employing a strategy for success.</comment></comment></comment>


The First Documentary about Crowd Funding - <AUTHOR> http://capitalc-movie.com/

<comment><USER2> Interesting idea, and the time is right with Kickstarter achieving some of it's largest funded projects yet with all the video game developer hype as of present. I hope it will contain aspects of a self exploratory nature as well about their own attempts at crowd sourcing funding. I'm interested in seeing what other methods there are to raise large sums of money via crow funding other than Kickstarter.

<comment><AUTHOR> I'm also very curious how it turns out. One thing about Kickstarter that gets on my nerves is the fact that only American companies can have projects there. The crowdfunding market will be splintered into a myriad _me-too_ businesses because of this.

<comment><USER2> Where does it say only American companies can have projects? I'm from the UK and my friends successfully raised £1000 to fund their project, although it is true the money you receive is only in US Dollars but this standardised measurement is probably more usefl since the US is were a prevalent majority of backers will come from, and they will be more likely to spend money if they know exactly how much it costs them.

<comment><AUTHOR> Right there in the eligibility requirements for creating projects:

" _Be a permanent US resident and at least 18 years of age with a Social Security Number (or EIN), a US bank account, US address, US state-issued ID (driver's license), and major US credit or debit card._ "

[http://www.kickstarter.com/help/faq/creating%20a%20project#A...](http://www.kickstarter.com/help/faq/creating%20a%20project#AmIEligToStarAKickProj)

It seems to be tied to Amazon Payments. I didn't know this myself until recently when the guys making the documentary told me (they had to jump through some hoops because they're German).</comment></comment></comment></comment>


S3 static site Cross region - <AUTHOR> http://millennialprogrammerguy.com/2017/03/04/s3-static-sites-cross-region-availability/ <comment><USER2> Here's what I don't get: why is cross-region necessarily better availability than cross-availability-zone?

Regions are created for geographical proximity reasons. Availability zones are created for availability reasons.

Right?

Why do multiple data centers close to me have to go down at the same time, forcing me to use one far away from me?</comment>


Static Linux - <AUTHOR> http://sta.li/

<comment><USER2> I wish Linux would replace dynamic libraries (especially ones referencing specific paths) with a system based on the library's hash. Then we could have a single lib folder with 1 copy of each library, and get ourselves out of dependency hell by just making dynamic loading act like static loading. We could even download libraries from the web on the fly, if needed. Heck it would even remove a lot of the need to compile every_single_time because apps could reference binaries.

The notion of being able to fix an app by merely upgrading a library it depends on has not worked out in practice. More often than not, when I upgrade a library, I find myself having to upgrade my app's code because so much has changed. The burden of having to constantly backup, upgrade, manually tweak config files, over and over and over again for days/weeks/months was SO not worth the few hundred megabytes or whatever dynamic loading was supposed to have saved.

<comment><USER3> > I wish Linux would replace dynamic libraries (especially ones referencing > specific paths) with a system based on the library's hash.

Given this scheme, how would you distribute a security patch? Is each user of the library supposed to re-compile against the patched library?

Also, a program A depends on library B and library C v1.1. Library B also depends on C, but v1.2. Which gets used?

> More often than not, when I upgrade a library, I find myself having to > upgrade my app's code because so much has changed.

To me, this is the point of major version numbers. If you break clients, you increment the major version number, resulting in libfoo.so.2 and libfoo.so.3. Then, the scheme becomes much like hashes, in that newer versions won't break older clients, except you get security patches and a single copy of the library. However, the responsibility of knowing when to increment the major is left to a human, and all the error that entails.

As a sibling notes, there are distros out there that do this. (They are not my preference, for the above reasons.)

<comment><USER4> >Given this scheme, how would you distribute a security patch? Is each user of the library supposed to re-compile against the patched library?

No, this is the responsibility of the server which distributes binaries to users via the package manager.

<comment><USER5> User, as in programmer who uses the library.

<comment><USER4> Programmers are used to recompiling all the time. What's the problem here?

</comment></comment></comment></comment></comment><comment><USER6> Cool idea. Not enough people seem aware of executable packers like UPX [http://upx.sourceforge.net/](http://upx.sourceforge.net/) though.

These are excellent tools to keep the size down when using large static binaries. By compressing the file on disk and decompressing in memory you often wind up with a smaller and sometimes even faster loading (depending on disk IO speed vs decompression speed) package. I got a static Qt binary from 4 MB down to 1.3 with upx --lzma. Very nice stuff.

<comment><USER7> The downside to tools like UPX is that the executable code is actively transformed on load. This limits the ability to use shared memory for multiple concurrent executions of the same executable.

If the OS loads executables by mmap and load on page-hit, you can potentially save memory by not ever loading unused parts of an executable. a transform-on- load requires the entire program to be loaded before execution begins.

<comment><USER8> '... never loading unused parts of an executable...' \- this is one of the benefits of a paging system. Paging was (is?) the best way to keep memory requirement down. The way Multics worked was by having paged segments. [http://www.osinfoblog.com/post/136/segmentation-with- paging:...](http://www.osinfoblog.com/post/136/segmentation-with- paging:-multics/) The x86(-64) can support something like this, but as far as I know, no modern OS supports this feature.

<comment><USER9> Linux does this, as does basically every other modern OS.

Pick a random large process on a linux host - like your web browser. cat /proc/$pid/status.

VmExe is the size of the mapped executable; VmLib is the size of all the other mapped libraries and executable pages. Add those two numbers together to find the size of all the executable code mapped into this binary.

VmRSS is the amount of physical memory that the process is currently using. You'll find that this is a lot smaller than the code mapped into the binary. That's because the kernel hasn't loaded any of that into physical memory.

<comment><USER8> Thank you. I'm not at all sure why the 'old hands' here on HN have decided to so viciously downvote this. I didn't call anybody names, didn't violate any posting rules, did not violate etiquette, and provided a very nice link to Multics.

If there is a perceived error in what I wrote, then, like the one nice responder, explain, please.

HN is such a different community now than when I joined 1,835 days ago. It brings tears to my eyes.

</comment></comment></comment></comment></comment><comment><USER10> I have been keeping an eye on this "project" for years and have yet to see anything come of it except lightning talks.

suckless.org seems to focus on their web browser and their xterm clone these days, judging by the listserv traffic.

<comment><USER11> Sin, the original author and maintainer of a few of the suckless utils necessary for Stali, has a similar project called Morpheus[0]. He has actually shipped a bootable image for testing and has more or less gotten the packaging sorted out[1].

If you're interested in the idea, definitely check it out.

0: [http://morpheus.2f30.org](http://morpheus.2f30.org) 1: [http://morpheus.2f30.org/0.0/packages/x86_64/](http://morpheus.2f30.org/0.0/packages/x86_64/)

<comment> vezzy-fnord A similarly interesting project is the musl-based Sabotage Linux with its own tiny but concurrent package manager: [https://github.com/sabotage- linux/sabotage](https://github.com/sabotage-linux/sabotage)

<comment><USER11> Much of the bootstrapping of Morpheus appears to have come from Sabotage Linux, especially the use of musl-cross[0]. I thought I remember seeing numerous references to Sabotage in the docs but now I can't seem to find them.

Anyhow, definitely another interesting project in a similar vein. The biggest difference I see, from a base perspective, is the choice of coreutils replacement: Sabotage uses Busybox while Morpheus uses a mixture of sbase[1], ubase[2], hbase[3] (rewrite of heriloom utils[4]), and 9base[5] (some utils from plan9port[6].)

0\. [https://github.com/sabotage-linux/musl- cross](https://github.com/sabotage-linux/musl-cross) 1\. [http://git.2f30.org/sbase/](http://git.2f30.org/sbase/) 2\. [http://git.2f30.org/ubase/](http://git.2f30.org/ubase/) 3\. [http://git.2f30.org/hbase/](http://git.2f30.org/hbase/) 4\. [http://heirloom.sourceforge.net](http://heirloom.sourceforge.net) 5\. [http://git.suckless.org/9base/](http://git.suckless.org/9base/) 6\. [http://swtch.com/plan9port/](http://swtch.com/plan9port/)

<comment> vezzy-fnord The README for hbase characterizes it differently:

       hbase is a collection of programs that complements sbase
       and ubase. It's meant to be a temporary project that
       will shrink and die once sbase and ubase gets
       implementations of most of the programs included. hbase
       mostly contains programs taken from the Heirloom project,
       but also has other programs, such as patch taken from
       FreeBSD and mk taken from plan9port.

So it's not a rewrite, but rather a temporary code dump for "miscellaneous utilities". Skimming at the code confirms this.

<comment><USER11> Correct. When I said 'rewrite', I mean 'update of some'.

</comment></comment></comment></comment></comment></comment><comment><USER12> "Of course Ulrich Drepper thinks that dynamic linking is great, but clearly that's because of his lack of experience and his delusions of grandeur." I find these kind of comments reflect veerryyy poorly on their authors..

</comment><comment><USER13>
      > Because dwm is customized through editing its source code, it's
      > pointless to make binary packages of it. This keeps its userbase
      > small and elitist. No novices asking stupid questions.

I never understood why the authors of dwm thought this was a "nice" feature of configuration via source code.

<comment><USER14> They don't mind if DWM is only ever used by a handful of people if only a handful of people agree with the principles behind it.

</comment></comment><comment><USER15> Apart from the general system management advantages of dynamic libraries, they provide an important extensibility/customization mechanism (e.g. [https://www.gnu.org/software/emacs/emacs- paper.html](https://www.gnu.org/software/emacs/emacs-paper.html) for an early mention).

High performance computing systems typically use dynamic linking extensively for that. One example: The hooks for profiling and tool support in the MPI standard for parallel programming pretty much depend on an LD_PRELOAD-type mechanism to be useful. Another: You can cope with the mess due to missing policy on BLAS libraries in Fedora/EPEL (unlike Debian) by using OpenBLAS replacements for the reference and ATLAS libraries; have them preferred by ld.so.conf and get a worthwhile system-wide speed increase on your Sandybridge nodes with EPEL packages.

Anyhow, rebuilding a static system to address a problem with a library ignores all its uses in user programs. The ability to adjust things via properly- engineered dynamic libraries really has a lot more pros than cons in my non- trivial experience. The use of rpath ("ones referencing specific paths"?) is mostly disallowed by packaging rules in the GNU/Linux distributions I know, so I'm not sure where that comment came from, and it tends to defeat the techniques above.

</comment><comment><USER16> An advantage of dynamic libraries is that the memory used to hold the library's executable pages can be shared across processes. So using static only binaries will lead to less free memory on the OS.

<comment><USER17> That's the party line. It's often wrong. If two copies of the same program are running, they share memory for code. For a shared library to reduce memory consumption, there must be multiple _different_ programs using the _same_ version of the _same_ library. That's not all that common, beyond very basic libraries such as "libc".

Linking to a shared library brings in and initializes the whole library, even if you only need one function from it. So you tend to get stuff paged in during load that never gets used.

<comment><USER18> _That 's not all that common_

Isn't it? Usually distros target their packages to a single library version, and often people run suites (Gnome, KDE, etc) that use a similar set of libraries in their different processes.

<comment><USER19> Indeed. ldd any substantial GTK app and scroll past the dependencies. They are huge. Most of them are shared across applications.

Desktop would be crippled if every app was compiled with the whole stack of X, toolkit and Gnome libraries linked in statically.

<comment><USER20> I'd argue that libraries like GTK were only allowed to become so bloated because dynamic linking masked their true impact on the system. If static linking were the norm, we'd be using _much_ simpler, cleaner libraries because people would think twice about adding 100+ megabytes to their binaries for basic GUIs.

</comment></comment></comment></comment></comment><comment><USER21> Static linking OpenSSL is probably not a good idea

<comment><USER22> You mean for security patches? i.e rebuilding all your binaries, instead of just openssl's shared libs

</comment></comment><comment><USER23> One downside to static linking is security vulnerabilities. Say, for example that all the programs on your computer that use OpenSSL statically link. When OpenSSL has a security flaw, you have to not only update OpenSSL, but all of those other programs too.

</comment><comment><USER24> Are there any static BSDs?

<comment><USER25> You can build NetBSD to be statically linked [1]. It is not the default, but it is trivial to do, one line config change. Note that you can build NetBSD from source on any system, eg Linux or OSX and then boot it in a VM, so you dont really need a binary "distro".

[1] [https://www.netbsd.org/docs/guide/en/chap-build.html#chap- bu...](https://www.netbsd.org/docs/guide/en/chap-build.html#chap-build- environment-static-build)

</comment></comment><comment><USER26> I would like to see "static" USE flag in Gentoo for all packages with ability to statically link whole system. Also profiles or env with other libc's would be nice. Dunno why they need to crate new distribution instead of expanding ones that are already there.

</comment><comment><USER27> Stali has been in 'planning' for as long as I can remember. At least 4 years.

</comment><comment><USER28> Wonder if it helps with dep hell...

<comment><USER29> It would for a certain class of hell. You won't get issues w/ resolving symbols in dynamic libs, but you _would_ open yourself to feature disparity across different apps that use similar libs. For example, if you've got a Client-A that uses libfoo feature X(v1), and Client-B that shipped w/ and links against libfoo feature X(v2), it might be frustrating -- this scenario is part of the promise (and responsibility) of shared libraries.

Can't have your cake and eat it too.

<comment><USER30> And that feature disparity includes security updates. If a library is updated with a security fix, you'll need to update everything that uses that library to get the fix, rather than just the shared dynamic library.

<comment><USER7> The tools for updating security fixes should be applicable for the applications just as easily as the libraries. The applications would have to be rebuilt which should be automated. If the library changes anything that causes the build to fail, much better to find that out at that time than to have the failure occur when it dynamically links on end user machines.

There would be inevitable bandwidth costs in updating like this, but that is the trade-off that is Explicitly made by choosing to go with static.

<comment><USER29> > The tools for updating security fixes should be applicable for the > applications just as easily as the libraries...

I don't think anybody would disagree, but you can't dismiss out-of-hand this required effort. The point is there _are_ pros and cons. Its arguable that one really ought to have a build-server to mitigate the effect/work. For an OS/distribution, this would be a repository of binaries that are maintained, and you could do an (eg) apt-get update and have the proper software fixed (for your "enterprise" or similar software, a similar in-house mechanism) -- if everything is static, the act of replacing the binaries on the end-machine ought to be relatively simple for binary replacement, with the effort for library maintenance moved to maintaining an "out of band" record of what libs ea. app is using, so that when you have a flaw in libxyz that client-a, client-b, and client-c are using, you _know_ you need to update the source for client-[a-c] one way or another -- it boils down to a case of responsibility -- are you going to build safeguards into the link/run mechanism (dynamic libs) and have it adopt a certain amount of responsibility or move the cost upfront to build/maintenance and manage the responsibility yourself (with some other appropriate tooling)...</comment></comment></comment></comment></comment>


Time to End Factory Farming? - <AUTHOR> https://quillette.com/2018/10/20/why-its-time-to-end-factory-farming/ <comment><USER2> About three months ago I decided to stop purchasing factory-farmed meat. It's been pretty difficult for a few reasons.

The biggest reason, by far, is access to information. Roughly, I would like to purchase only meat from animals that lived a "happy" life and had a relatively short death. Animals that lived outdoors, basically. But there are no credible labels or certifications for this, which means buying meat at the grocery store is pretty much impossible.

So I have to buy meat from a farmer. Recently I've been using crowdcow.com, but even there, the messaging seems to be all around _flavor_ and not _welfare_. Farmers will tell you what they feed the livestock, not how they treat them. So the best you can do is research the farm and hope their website isn't lying.

Another difficulty has been flavor and texture--pasture raised meat tastes more gamey and is much tougher than "normal" grocery store meat. I've actually found that I prefer the flavor of "humane" pork and chicken but not beef.

Lastly there's price. It's about 2/3x more expensive. This isn't that big of a problem, because we simply spend the same amount as a household and just eat less, substituting for vegetables. It does mean that I buy a lot more of the "cheaper" cuts, which require more skill in preparation. I haven't yet bought a pasture-raised ribeye--it's simply too expensive.

As for eating out, it's basically impossible. No restaurant I know where I live (Chicago) credibly serves only ethically sourced meat, as far as I know. To be honest I still eat "normal" meat when I eat out, although I have reduced my consumption somewhat. There are, unfortunately, some products of dubious ethical provenance that simply have no substitute, like fine cheeses and cured meats.

It seems to me like a huge opportunity. I would gladly pay 2/3 times for meat if I knew it was raised more ethically. In fact, that's what I think meat _should_ cost (and _all_ meat be ethically raised).

<comment><AUTHOR> How would you respond to the author of the article who dismisses free-range meat as similar to being a good slaveowner or killing people painlessly in a genocide?

<comment><USER3> As a false equivalence fallacy...

</comment></comment></comment><comment><USER4> A lot of this article is based on Jacy's new book, which I reviewed and summarized earlier this year. Well worth checking out to dive deeper into some of these issues. Link here: [https://medium.com/@hnryjmes/61-key-insights-and- thoughts-af...](https://medium.com/@hnryjmes/61-key-insights-and-thoughts- after-reading-jacy-reeses-new-book-the-end-of-animal-farming-3e4a01e9ce49)

"1. The scale of animal suffering is in the hundreds of billions killed _every year_. Most of that is unnecessary, which further adds to the tragedy. However, horror on this sort of scale just doesn't motivate some people. For them, we need to talk about other things — or the message simply won't stick."

</comment><comment><USER5> My sister tried to get a job at a factory farm. She found there weren't many openings as they primarily employ prisoners through work programs. They employ prisoners because nobody wants those jobs. Even the prisoners would chose a different work program given the option.

<comment><USER6> A couple months ago there was a nationwide prisoner strike in the US against this practice: [https://www.theguardian.com/us-news/2018/aug/20/prison- labor...](https://www.theguardian.com/us-news/2018/aug/20/prison-labor- protest-america-jailhouse-lawyers-speak)

</comment></comment><comment><USER7> I dont like those extensive animal farming anyway but, _cattles_ are responsible for 25% of greenhouse gas emission. Those factory farms are included is it? We _must_ stop. Let's have some regulations; it's not so bad after all, it's just a matter of changing eating habits.

<comment><USER8> and eating habits are only the hardest habits for a culture to change, after all..

</comment></comment><comment><USER9> This video by Kurzgesagt has a very good explanation as well

[https://youtu.be/NxvQPzrg2Wg](https://youtu.be/NxvQPzrg2Wg)

</comment><comment><USER10> Great article. I agree that the meat industry thrives on the fact that most people see animals at assets/property. They dont treat them as entities who are entitled to live their life, like we do with other humans. The analogy to slavery is interesting and I have no doubt in generations from now we will look back on these days as savage and uncivilized. This is essentially a cultural problem with a ton of history behind it which is why meat consumers tend to be sensitive about to topic.

But science is on our side here (I'm talking to you, intelligent, rational HN readers). Technology can solve the problems with efficiency and taste by making alternatives accessible and cheaper. And then you have the scientist/public figures in this article. These are the folks who should be bringing awareness to the masses. I think we need to slowly legislate away this cruelty and destruction of the environment. Much like the gay rights bills and tobacco legislation that has come and gone over the years. We need to take baby steps to make animal production impossibly difficult.

</comment><comment><USER11> People don't care about people that much...saying that it's time to stop factory farming sounds like saying it's time to stop using materials from conflict zones or imported from non-democratic countries

</comment><comment><USER12> It's the convenience factor. That's it. Once plant-based options are more convenient than meat, game over. Most people lack the discipline to sustain a vegan lifestyle, even in 2018.

<comment><USER13> It's also indoctrination. We've been indoctrinated to think of meat as a staple food. Meat was never a staple food before factory farming came along. Fortunately, it seems that humanity's honeymoon with the farming industry is coming to its end.

<comment><USER14> > indoctrinated to think of meat as a staple food

Generally agree, although I think this is slightly the wrong way 'round. Meat was definitely a luxury, as recently as a century ago. (Speaking of the U.S. here.) Then we had an explosion of a (relatively) wealthy middle-class, who could afford lots of things that were formerly luxuries. And those things became expected, they became part of the culture, and they became commodified. I don't think there's any nefarious conspiracy, it's classic tragedy of the commons: everybody individually wants steak for dinner; the social price doesn't become clear until much later.

</comment></comment></comment><comment><USER15> Ok, here's a view I genuinely have and want to discuss. But it's quite far from the general consensus and is a bit radical (hence using a throwaway account) -

Yes, using animals in this was in unethical and yes animals have emotions. But I love meat so much I just can't seem to care. I mean I feel evolution made us humans evolve into beings that _can_ take advantage of all the tools and so why shouldn't we. Yes, this means I am ignoring the fact that the animals are being tortured. Putting it that way sounds bad but too bad, we step on ants every day as well. It's just where nature has gotten us.

In fact, if you mention the greenhouse effect and all, I think we're destroying our own habitat. In a few hundred years, might make humans extinct. But that's about it. The "Planet" is not being destroyed. It's us who are in danger. We brought it on us, we'll have to face it.

That was my rant and trust me, if you meet me you won't think I have such harsh views. But I wonder if anyone else thinks the same way or would like to discuss this.

<comment><USER16> You sound like you are playing your own advocate. People can find lots of ways to justify themselves. In the end, you know it brings suffering - you either go with it or not. The rest is just mental blabber.

The same reason people choose not to eat meat is the same reason some people choose not to rob someone or to treat someone kindly, etc - they see it as a good thing and they do it. And if I am aware and can avoid stepping on ants I will do it.

</comment></comment><comment><USER17> This article is wishful thinking, with no real evidence of what the author is saying is viable or desired by many people. I'm not sure why it is here, since it is pure ideology with no real scientific backing.

<comment><USER18> The brain structures present in mammals and humans that process suffering are very similar. That is basic neuroscience.

So maybe it's ok to make animals suffer, but at least have consistent ethics and agree it's ok to make people suffer.

<comment><USER19> Conspecifics are more important than other species.

<comment><USER18> Why does speciation define the border of the phenomenalogical experience of suffering?

</comment></comment></comment></comment><comment><USER20> I'm a vegetarian but my dog eats kibble made from Chicken. This has always made me feel like a hypocrite. "I have to kill animals to keep my pet alive?"

Anyone have any good recommendations for approved non-dead-animals dog food?

</comment><comment><USER21> To end factory farming, start eating goats

<comment><USER22> But wouldn't this, eventually, just lead to the factory farming of goats?

<comment><USER23> Yes. People think you can't do factory farming of goats because current goat breeds do not tolerate confinement and simply get sick and die. This used to be true of hog breeds as well, but people purpose bred for animals that can withstand confinement. That's one of the primary reasons modern pork has no flavor, we stopped breeding animals that taste good and just worried about breeding ones that survive the industrial process. The same would inevitably happen with goats.

<comment><USER14> > we stopped breeding animals that taste good and just worried about breeding > ones that survive the industrial process.

Exactly, and further proof of your point is that the exact same process has happened to vegetables: they're bred to be transportable and sale-able for a long period of time; not to be excellent. Tomatoes are the perfect example. Most tomatoes that you can buy from a grocery store are really not worth eating. Compare them to a actually ripe summer tomato from a neighbor's garden, and they may as well be different substances.

Commodification turns things mediocre almost by definition.

</comment></comment></comment></comment><comment><USER24> Where do the Christians stand on this issue? If there's one single group that has the power to calibrate people's moral compass on this issue, is would be clergymen. As another person said, people just don't care. People are on the whole an exploitative and unsympathetic species. They'll continue eating factory farmed meat and buying sweatshop clothing, much more than necessary. But in the US at least, where 77% of people identify as Christan, if preachers took issue with these things, they could make an impact on how their congregation spends money.

A preacher who actually targeted moral atrocities would be seen as radical, and would most likely lose the church members and money. And so church will continue to be large ornate buildings with large parking lots filled with luxury cars where people hear about their salvation, while wearing sweatshop clothing and then eat barbeque afterwords, instead of a place that actually makes a difference.

<comment><USER25> In the Orthodox tradition, almost half the year—including nearly every Wednesday and Friday—is for fasting, which means vegan plus shellfish. It's not considered radical at all.

(Incidentally, this is why Ethiopian food is so vegan-friendly!)

</comment></comment><comment><USER26> When taste and price of any "safe" kind of meat will be better, this issue solved. It's the only way.

</comment><comment><USER27> Recently I do feel a global feeling of tiredness. The things we held as progress don't work, abundance feels void it seems now. Jobs aren't giving you a lot of money and even if so, it can't bring you much; we're all very high in material comfort. What we lack is appreciation and sharing.

Maybe people will enjoy farming more, and doing things more because what we used to avoid to pursue ~higher jobs is now seen as both healthy and joyful activities that aren't so stupid when compared to the mass of idiotic ~jobs we're seeing these days.

<comment><USER28> I feels ya.

A few years ago, I got pretty worked up about my state killing an entire wolf pack, just to protect some cows. So I got involved. I learned a lot.

Ranchers are people too. I really loved these people. It was just one bad apple, deliberate repeat offender, causing all the problems. Everyone else was totally onboard towards creating a better future.

Ranching is unsustainable. And they (the families) know it.

Skipping to the end... My predictions:

#1 Laboratory meat will largely eliminate factory farming. It will completely upend our (Western) agricultural economy. Huge reduction in feed grains, pesticides, fertilizers, etc. Massive improvement in waste management. It can't happen soon enough. My uneducated guess is 10-20 year transition. All us tree huggers should work to expedite.

#2 To continue, ranchers will need to go up market. Artisan, bespoke meat.

#3 We will pay ranchers to restore habitat. This will make up for their loss of income from selling meat. And hopefully keep families working the land.

"How to fight desertification and reverse climate change" [https://www.ted.com/talks/allan_savory_how_to_green_the_worl...](https://www.ted.com/talks/allan_savory_how_to_green_the_world_s_deserts_and_reverse_climate_change)

#4 Trend towards direct micromanagement of animals (wild and domesticated) and habitat will continue. GPS tags, drones, IoT for soil monitoring & management, satellite imagery, adapt to weather predictions, etc. Even more so than my grandfather's day, future farmers and ranchers will be high tech entrepreneurs, knowledgable in tech, business, accounting / finance.

In conclusion: I know our current situation is bleak. There is a way forward, out of this mess. Keep the faith.

<comment><USER29> "#1 laboratory meat will largely eliminate factory farming. [..] All us tree huggers should work to expedite."

Any suggestion about how to help here? For instance, is there any organization where we can send money for pushing for this outcome?

The environmental reasons alone should be enough to invest in this.

<comment><USER30> The Good Food Institute is working on exactly that:

[https://www.gfi.org/donate](https://www.gfi.org/donate)

They are a non-profit that are advocating and researching clean meat and plant-based alternatives. I recommend this 75 minute interview with it's director if you want to understand why is it such an important and effective cause:

[https://80000hours.org/podcast/episodes/bruce-friedrich- good...](https://80000hours.org/podcast/episodes/bruce-friedrich-good-food- institute/)

</comment></comment></comment></comment><comment><USER31> How can you be against cruelty to animals and still regularly consume meat?

This question I ask sincerely.

There are other equally ethical considerations: global warming, land use, energy/water use, etc. I feel that any one of these should give most people pause.

<comment><USER32> Consuming meat and factory farming are not directly related things. Meat can just as well be produced by better farming methods or processes like hunting. Doesn't mean that's how people end up getting their meet, but mostly people don't generate the chain of logistics they end up using, and it's not directly related to the product itself.

This chain of thought also doesn't go anywhere, unless you want to end up a hermit of some sort, because pretty much every logistic chain is contaminated.

> There are other equally ethical considerations: global warming, land use, > energy/water use, etc. I feel that any one of these should give most people > pause.

Hmm. I'd say global warming et. al. is not even in the same universe ethics- wise compared to animal farming.

<comment><USER31> Is this a valid argument? You're right, consuming meat doesn't have to be related to factory farming. But consuming 220 pounds of meat, as far as I know, does.

<comment><USER33> Why? People have been raising or fattening a pig in their yard for ages. One or two pigs a year, add a couple of chickens on top of that, and here we go.

<comment><USER8> For ages there have not been billions of people. Now every year there are ~100m more people on the planet.

</comment></comment></comment></comment></comment><comment><USER34> The author has two articles, one is this one and the other makes a case for veganism.

I understand that killing animals for their meat strikes some people as morally wrong but you're not going to change my mind by making me feel bad about how a cow, pig or chicken is raised and killed. This is not a moral problem for most people. We don't really care enough. We eat them because they taste good, are easily available and are satiating. Vegan and vegetarian foods are usually less so for all three categories.

No matter how many articles or appeals you make trying to instill some amount of empathy for animals or guilt for their situation it's not going to stop people from craving a steak. Most people can't control their cravings for a cookie. This is not a moral problem, this is a taste and option problem.

I'm honestly going to Texas Roadhouse tonight because you made me think about having a ribeye. Way to go.

<comment><USER35> I feel that you don't want to change your mind anyway, and are happy to show us how smart you are by purposefully doing the opposite of what people hope to get you do after reading the article.

To me, your comment reads as someone saying that reading an article about lung cancer didn't deter them from smoking and actually reminded them to go and buy a pack of smokes. Or how an article about global warming reminded them they had to buy a gas guzzler today. Or reading an article about how cars should share the road with bicycles and saying it reminds you you didn't drive today and you're off to doing punishing passes and coal rolling cyclists.

Good for you, people can't tell you what to do and you know exactly what buttons to push to show how smart you are.

You might not agree with the article, but your reaction is ridiculous.

<comment><USER34> You're reading me a bit wrong, though maybe the last sentence was me being an asshole while also failing to explicitly point out what's wrong with their approach. You're correct that I don't feel like changing my mind but that's because their argument is old and I know that I enjoy meat. The objective was to point out that instead of trying to make meat eaters feel bad they should just make it easier for us to make better food choices. Food that we don't have to explicitly search for.

I'm not going to pick a food because it has a label for "vegetarian" or "vegan". I don't care. I pick what tastes good and is mostly healthy. Many other people have that line of thought besides me. Those kinds of people won't be attracted by those two terms and the moral implications behind them alone. If the food was good enough and marketed enough you wouldn't even need mostly useless articles like this.

That was what I was trying to point out. Hopefully you understand now.</comment></comment></comment>


Non technical books about programming/computer science - <AUTHOR> I am looking for books related to computer science but not technical ones. Something like memoirs of computer scientists etc, any suggestion? <comment><USER2> [https://www.amazon.com/dp/1695978552](https://www.amazon.com/dp/1695978552)

</comment><comment><USER3> Creativity Inc by Ed Catmull - the history of Pixar

The Illusion of Life: Disney Animation - a very beautiful book the history of Disney animation (pre computer though), discusses the foundations of animation used in software everywhere today.</comment>


Starting Many Things - <AUTHOR> https://jetholt.com/micro/starting-many-things/ <comment><USER2> I can't count the number of projects I've started (but not finished) in varying types of hobbies, including but not limited to card magic, music production, videography, creative writing, and of course software development.

Although I used to feel bad about all my "failed" projects, I have recently come to view them as all part of my growth. I tend to cycle between hobbies for whatever reason, and every time I come back to a hobby, I get a little better at it, and I think that's what really matters in the end. Though I haven't gone back to card magic in a while haha.

<comment><USER3> All the unfinished work begins to come together as a coherent whole, at some point. Concepts join, ideas merge, good parts stay and not so good parts fall off. Everything you've ever started is leading up to something. It'll come. You can't see it yet because it's something new. Something magnificent. Something worth all that effort. And when it does come, you will know. You will feel. And you will regret nothing.

<comment><USER4> Having an economics education, I like to think of this in simple economic terms: Everything has a production process, and during that process the unfinished goods are generally useless, or at least far less useful than the finished product. Economic development is, in some sense, the steady expansion of the scope and scale of production processes that society can engage in. I think the complexity of the modern economy along with globalization have drawn out the "production process" for building highly useful human beings as well. In any case, I guess my main point is that you have no idea how valuable your unique mix of skills will be until it is "complete", and that may take decades, but the payoff for building that skill set can be orders of magnitude larger than a "normal" path.

</comment></comment></comment><comment><USER5> This post appears to be part of an experiment in "micro posting":

> Usually, I try to aim for a certain standard of quality in my writing, and > this can really hold me up from writing about something I want to write > about.

> Sometimes it takes a week or more just to write one post. Yeah, perfection > is killer.

> It gets worse when I add images, because I agonise over them.

> So I'm going to be writing more things to a lower quality. I'm calling these > 'Micro' posts, and you can find a full list here: Micro.

> They will be just what I'm thinking about, or some small observations, or > whatever. Generally without pictures, without proofreading, without > rewording each sentence hundreds of times. Almost as if I have a typewriter > and a stream of conciousness - no going back to make changes.

[https://jetholt.com/may-2020-microblogs/](https://jetholt.com/may-2020-microblogs/)

This idea also fits in with the topic at hand: starting many things. With a rapid-fire, just-get-it-out "micro" posting style, you can spend a little time considering far more ideas than you would have before.

The funny thing is that it would have never occurred to me that this particular post was written in this way because it seems very well conceived and organized.

<comment><AUTHOR> That's a great perspective, thank you.

Funnily enough, I'd consider this post to be on the borderline between a micropost and a regular post.

Of all of my microposts, it's the one that I dedicated the most time to - though still much less than a post that would go on the homepage.

You've really hit the nail on the head though. By writing every day-ish, it lead me to start this post, which made me realise that I needed/wanted to dedicate a lot of time to to fully explain and say what was on my mind. (I reordered some of the paragraphs and added bits here and there, which I didn't do for most microposts to keep them 'micro')

By trying lots of posts, I found one that I wanted to go into detail with, which ultimately lead to it being the first post of mine to rank on the HN front page. Wow!

</comment></comment><comment><USER6> _Like how Brian May, lead guitarist for Queen, became an astrophysicist. That's completely different from what he became famous for, and it makes him unique and interesting to talk about. He isn't "just another musician" any more._

This is actually the reverse of what happened. Brian May _left_ a career in astrophysics to pursue Queen in 1974, once Queen started getting big. He was about 6 months away from defending his dissertation and earning his PhD. He re-enrolled in his PhD program in 2006, and earned his doctorate in 2007.

Doesn't detract from the author's point, however. Try a lot of stuff. You never know which bet will work out. Just so happened that, for Brian May, being a rock star panned out first!

<comment><USER7> Guitarist, astrophysicist, and even a hardcore gardener!

[https://www.spin.com/2020/05/queens-brian-may-tore-his- butt-...](https://www.spin.com/2020/05/queens-brian-may-tore-his-butt-muscle- while-gardening/)

<comment><USER6> I love gardening too, but I've never done _anything_ that approaches the level of enthusiasm required to tear a butt muscle while gardening.

Dude's in a league of his own. XD

<comment><USER8> Great accomplishments often require certain sacrifices.

</comment></comment></comment></comment><comment><USER9> I find in many respects I begin things not to aim for mastery but to scratch an itch. Some hobbies require deeper investment but ... I felt like making home made pasta at home last month, so I just did it. Scratched that itch and no desire to make pasta anytime soon.

Similar feeling to anything development related. I wanted to tinker with threejs. So I built a simple brick builder in it. Pushed the code to GitHub once I was happy and moved on.

</comment><comment><USER10> This is the exact article I needed to read. I've been trying to wrap my head around leaving work and making the jump to follow my interests. I'm going to setup a website just like Pat. For example, I want to get my pilot's license. Whenever I want to dedicate myself to something, it feels like I can't, because 8hrs of my time are gone to work. It's not that work is boring, just that other things might be more interesting, and I can't seem to strike that balance.

</comment><comment><USER11> > font-size: 1.4vw;

@op: this css rule currently makes it very hard to read the page on ultra-wide monitors - the font is very large and doesn't scale with browser zoom.

<comment><AUTHOR> I'm aware. I made this website's CSS before I knew about how to do responsiveness properly. Almost everything is based on viewport widths in some way. It's a real mess and I simply haven't had the time / seen the value to change it. My tiny little site rarely gets any visitors worth talking about.

I'll try to do something about it soon. Thanks!

<comment><USER12> For what it's worth, my first impulse when I saw your blog was "Hey that's a neat styling. I like it."

<comment><AUTHOR> Thanks!

I think the styling is fine, it's just how it copes with responsiveness.

Try opening it on your phone and flipping over to landscape, or on an ultrawide monitor, or even just resize your browser window to be really wide.

It's a mess, it makes me anxious every time I share something.

I know that I have to fix it for the edge cases but I kinda dread doing the work to do that, haha.

</comment></comment></comment></comment><comment><USER13> Want to point out that starting something every other day is very different from starting many things. To build renowned things, knowledge has to (usually) compound over periods of time / focus. You can't expect to build something overnight, achieve success and then hop on over to the next thing. That's why we never really refer to any meaningful project as "finished" in that regard.

</comment><comment><USER14> Change the font, if you expect someone to read your article.

</comment><comment><USER15> > _" This is my personality - ... - I really enjoy learning about new > things"_.

This is me in a nutshell. I wondered, in my teens, why I was so drawn to music when I'd quit whatever instrument I was trying to learn. Turns out when I got a good understanding, that was the good thing, and practicing the same song enough times to get good at it was boring.

> _but is playing with being a DJ on Twitch._

I think that's a really great thing about where we are right now... you can learn so much on the internet, and then _try it out_ and see if it's for you, and get feedback. Nice!

</comment><comment><USER16> Learning 12 skills in 12 months seems extreme to me, in particular, because a lot of skills take long to master. Instead, I prefer the "theme of a season" approach as espoused in this CGP Gray video:

[https://www.youtube.com/watch?v=NVGuFdX5guE](https://www.youtube.com/watch?v=NVGuFdX5guE)

</comment><comment><USER17> I was aware of Exploration vs Exploitation in regards to A.I. but never really thought of it in regards to living someone's life, so thanks for that.

If I never did any exploration, then I would have only ever been a writer. I didn't decide to pursue computer science until after putting together a personal website and programming games on my calculator while bored in class.

And if I never explored, I wouldn't have had any career in video games. While it was how I initially started learning proper programming, I wasn't seriously considering that as a career for.

And if I never explored, I wouldn't have gotten into designing board games, which is basically just system design but a lot more fun.

And to get your games signed, you have to go to conventions and talk to publishers, so I got used to traveling and getting more into that too. At least before the pandemic.

Or learning languages, or playing tennis, or hiking, or learning musical instruments, or drawing, or making electronic music, or cooking, or photography.

And within those fields, without exploration, I wouldn't have gotten recognition for multiple different game designs, and I wouldn't be writing humorous fiction, and I wouldn't have come up with two new game designs (and a total overhaul for another design) that got me really excited.

College, at least in the US, seem almost designed to facilitate that exploration. The general education requirements let you have some exposure to other fields, and you can choose to further explore the field by taking more classes or even change your major if you wish. I think some people forget that it's important to do that after they finish college sometimes, and get stuck in a rut in life.

I am probably overdue for a new different hobby, myself. I did take an ESL tutoring course just before the pandemic, but the pandemic hit before I got assigned a student, so that's on hold. It was really interesting to discover how to teach someone that can't speak your language very well, though, and I think I can use those techniques for other things, like my game designs.

Probably my biggest problem is getting to a point where I can say something is finished and move on to the next thing. Because of my background in games, I want to make my game designs very polished, and get them developed by a publisher, and whatnot, but that process takes a lot of work and a lot of time to find a publisher for your designs.

Like I still only have one game signed, not even released, after 3 years of pitching, meanwhile I have about 60 playable prototypes, about 15 of those polished to the point where they almost could be finished products. Like I created art, wrote rules, sell sheets, videos, etc...not professional art, but some publishers have said "I would publish the game with that art" to a couple of the games, so apparently not terrible.

I might try going the Kickstarter or crowd-sale or route at some point, but that's a whole extra level of effort that I'm not sure I'm ready for.

<comment><AUTHOR> Yes, when I got that lecture, it made me think about my own life and made me wonder if I was just 'exploiting a local maxima' or if I was really on the right path for optimality. I figured that it was almost certainly sub-optimal, but without having many thousands and thousands of retries like an agent, what can you do?

My path to where I am today also has many little 'chances' where my exploration lead my in a completely different path that I wouldn't have been on today.

Like when I was a young teenager, and discovered a forum about a video game that I liked. From there, I picked up video game level design because I was inspired by a couple of the posters. After a while of that, I discovered game scripting, which lead me to pick up programming. When I entered Sixth Form at school, I picked up Electronics on a whim and ended up realising that I really liked assembly language. Things grew from there until I got to where I am today.

</comment></comment><comment><USER18> Good Farmers are great examples of these people. Just because random things break (mechanical) that they need to fix. Build buildings, inventing creative solutions to problems, manage a business, sometimes a large family, and animal care too.

</comment><comment><USER19> The odd thing is to choose a certain path in life because other people would be interested in reading about it.

</comment><comment><USER20> [https://en.wikipedia.org/wiki/Multi- armed_bandit](https://en.wikipedia.org/wiki/Multi-armed_bandit)</comment>


Show HN: PgTyped – Typesafe SQL in TypeScript and Postgres - <AUTHOR> https://github.com/adelsz/pgtyped <comment><USER3> There are some similar projects, like sqlx [1] for Rust. My problem with these is that they don't help to solve the actually hard problems.

While nice to have, preventing bugs with static SQL is usually easy to do by writing a few tests. Most of the SQL related bugs I have encountered were due to queries with dynamic/conditional joins, filters and sorting - and almost every project using a database needs those.

Approaches like this don't help there. That requires heavy-weight solutions that are more cumbersome to use and need a strong type system, like diesel [2] (Rust), Slick [3] (Scala) and some similar Haskell projects.

[1] [https://github.com/launchbadge/sqlx](https://github.com/launchbadge/sqlx)

[2] [https://github.com/diesel-rs/diesel](https://github.com/diesel-rs/diesel)

[3] [https://scala-slick.org/](https://scala-slick.org/)

<comment><USER4> > preventing bugs with static SQL is usually easy to do by writing a few tests

I've heard the same argument about TypeScript vs JavaScript and it's something dynamic typing proponents often say but in practice I find immense value in having the types autocompleted and checked in the editor - and I've worked plenty on both sides, current project is substantial RoR codebase, I've worked with Python and node.js backends on mature codebases. Eventually all these languages have some sort of static type hinting efforts to improve tooling - typescript being most successful.

The best thing I saw in this space was F# type providers which didn't require a pre-build step - the language had a mechanism for writing custom type providers that would look up the data source during compilation - unfortunately I didn't get to use it on any real world projects.

<comment><USER5> F# also has support for analyzers that can achieve similar functionality in case you don't want to take a dependency on a type provider.

[https://github.com/Zaid-Ajaj/Npgsql.FSharp.Analyzer](https://github.com/Zaid- Ajaj/Npgsql.FSharp.Analyzer)

[https://github.com/aaronpowell/FSharp.CosmosDb#fsharpcosmosd...](https://github.com/aaronpowell/FSharp.CosmosDb#fsharpcosmosdbanalyzer-)

</comment></comment></comment><comment><USER6> I really like the unique approach of the annotated SQL files and can definitely see some use cases where it would be good to declutter the SQL from the code. For me personally, I'd be hesitant to add another build tool to my already bloated toolchain. Could create a special Babel-style "import" type that automatically transforms your code (JIT)? It could remove some of the friction in adoption (for Babel users at least).

Another one in a similar vein with strict typing and really nice SQL interpolation for Postgres: [https://github.com/gajus/slonik](https://github.com/gajus/slonik)

<comment><USER7> I wonder if the JIT compiling will work asynchronously - from the readme it's getting the types from the live database schema.

<comment><USER7> Its actually doing the with what looks like a custom async messaging queu. Pretty cool.

</comment></comment></comment><comment><USER8> I came here to mention a similar approach, which last time I looked was a very compelling experiment[1], but its original author has actually built out a real library, Zapatos[2] which looks very very good.

[1]: [https://github.com/jawj/mostly-ormless](https://github.com/jawj/mostly- ormless)

[2]: [https://jawj.github.io/zapatos/](https://jawj.github.io/zapatos/)

<comment><AUTHOR> Looks like Zapatos still requires the user to manually specify param/result types for custom SQL queries?

<comment><USER9> Zapatos author here. Yes, it does. But for most of what you'd use an ORM for, you probably won't need custom queries.

<comment><USER8> Hey I'm not sure this is the best venue, but I'm trying to make the case for getting my org off of sequelize, and your library is right in line with my goals. The hardest sell is going to be publicly visible test coverage. Would you welcome a dedicated effort from an early adopter to introduce tests?

<comment><USER9> Yes, that would be very welcome. I suggest you keep me in the loop from the start to make sure we end up with something we're both happy with.

</comment></comment></comment></comment></comment><comment><USER10> Looks pretty cool. What I really want though is a library that let's me write plain SQL queries which are then mapped into nested objects in a smart way without too much manual work (I know Postgres can do JSON stuff, but the queries look pretty complicated for what little they actually do).

Say `SELECT * FROM user LEFT JOIN post ON user.id = post.id` would be mapped to `[{userId: 1, name: renke1, posts: [{postId: 2, title: "foo"]]`.

You probably need some kind of meta data to figure out how tables and thus objects relate to each other though.

Basically, I want to be able to leverage the full power of modern databases without being constrainted by typical ORM limitations. Also, I don't need features like lazy loading, sessions, caches and things like that.

A great advantage is that you can (provided you have some test data) easily test your queries while you develop a new feature (think IntelliJ IDEA where you can simply execute an SQL query on the fly).

<comment> timmy-turner Writing literal SQL in JS would IMO need more tools than just a preprocessor like you describe.

The few times I tried it (mostly in tests to check that the ORM is working properly) the #1 thing I was missing is a prettier-plugin that automatically formats SQL in the same way it currently works for `html` tagged templates.

I completely agree to the 'constrained by ORM' and 'useless features' part though. Postgres `json_agg` is a godsend and I love to be able to reason over simple joins and queries.

BTW, my own approach to use `json_agg`, `json_build_object` and json columns within a typesafe query-building DSL is this: [https://github.com/hoeck/typesafe-query- builder](https://github.com/hoeck/typesafe-query-builder)

But its mostly for replacing simple ORM fetches, it wont do complex analytical queries. For that I'd like to write SQL directly as query-DSLs tend to quickly stop being usable in that situation.

<comment><USER11> One of my favorite features of WebStorm is the (official) database plugin which highlights SQL queries inside JS strings AND has autocomplete and refactoring support that actually uses the live database schema.

<comment><USER12> But unfortunately returned values have no type definition unless manually provided.

</comment></comment></comment></comment><comment><USER13> As a maintainer of a similar project[0], it's great to see another entry in this space.

sqlc currently has great support for Go and experimental support for Kotlin. I'm planning on adding TypeScript support in the future, so it's great to see that others in the TypeScript community find this workflow useful.

[0] [https://github.com/kyleconroy/sqlc](https://github.com/kyleconroy/sqlc)

</comment><comment><USER14> Lots of comments here about similar projects in a different language, but the fact that this targets TypeScript is explicitly what makes it interesting to me. Using regular Javascript database libraries, even ones that have type definitions, require a lot of double typing.

I've been relatively satisfied with TypeORM, but one thing that's been a hurdle for me to some extent is its reliance on experimental decorators, and the resulting incompatibility with Babel - which in turn makes it harder to integrate with the wider ecosystem, e.g. Next.js.

As far as I can see on first glance, there's nothing here yet that makes it incompatible with Babel, so my tip would be to make it an explicit goal to keep it that way :)

<comment><USER15> Opening a can of worms for sure, but the reliance on Babel in the JS community is not a good thing to me. It's another reason why I prefer TypeScript, as in TSC, not whatever equivalent babel happens to support.

<comment><USER16> I do agree that sticking to TSC keeps things a lot simpler, and that should be the default setup.

Pandora's box has been opened though. Majority of the JS community seem to have adopted Babel in their workflow.

Even as I question it, I must admit it's pretty sweet to have a transpiler in the buid toolchain. It frees one from the browser/backward compatibility question, more or less, and opens up the language to be extensible - <USER2> better or worse.

For example, Babel macros ¹ is an interesting concept, using the language to extend the language during compile time.

To bring it back to the topic at hand (PgTyped, Typesafe SQL) - one thing that I'd like to see in TSC is a way to output type definitions (either inlined metadata or external JSON schema), to be consumed for run-time type checking. That would "complete the circle" for me.

TypeScript "compiler plugins" seem to be on the roadmap, or at least under consideration ². Some may see that as opening a proverbial can of worms, down a similar road to Babel. I wouldn't disagree, but it'd be so useful!

¹ [https://github.com/kentcdodds/babel-plugin- macros](https://github.com/kentcdodds/babel-plugin-macros)

² [https://github.com/Microsoft/TypeScript/issues/16607](https://github.com/Microsoft/TypeScript/issues/16607)

<comment><AUTHOR> You might find io-ts [1] interesting. It allows to write composable parsers that do both runtime checks and have correct result types.

Opt-in runtime checks for SQL queries are also on the roadmap for PgTyped. You are welcome to open an issue to track our progress there if you think this feature will be useful for you.

[1] [https://github.com/gcanti/io-ts](https://github.com/gcanti/io-ts)

<comment><USER16> Thank you - yes, I've dabbled with io-ts, though I'm still learning how to wield its power.

> Opt-in runtime checks for SQL queries

Ah right, I do see in the repo for PgTyped that it's on the roadmap. That does sound useful!

I'm hoping that one of these days, TypeScript will support a more generic runtime type check, somehow closer to the language/TSC-level rather than userland libraries, plugins/transforms, or a parallel compiler/build step.

At the moment, I use a fork of typescript-json-schema ¹ for my purposes.

¹ [https://github.com/YousefED/typescript-json- schema](https://github.com/YousefED/typescript-json-schema)

</comment></comment></comment></comment></comment><comment><USER17> Is there anything like this for Rust or C++?

I like the idea of code generation instead of doing the work at runtime (like in ORMs). This is like making your database schema the IDL spec.

<comment><USER18> There's Diesel[0] for Rust which is a full ORM. It's by Siân Griffin[1] who, as I understand it, is also behind a lot of how rail's ActiveRecord works.

0: [https://diesel.rs/](https://diesel.rs/)

1: [https://twitter.com/sgrif](https://twitter.com/sgrif)

<comment><USER19> Just to clarify a bit for other readers since I've worked with diesel for while, diesel isn't a "full" orm, as there are no real helpers provided to you outside of "we can map the result of a db query into a struct(s) that you specify" and some really nice guarantees for compile time queries. Other than that, your struct is a pretty dumb mapped representation and it's on the implementers of the application code to provide sugar for better access patterns. For people coming from something like active record, this is (in my opinion) closer to Arel than ActiveRecord, or closer to sqlalchemy core than sqlalchemy orm. As an example, you won't necessarily be able to do `MyStruct.join(OtherStruct)` and have it magically figure out how to query the database and map the results out of the box.

<comment><USER19> Clarification: compile time query building, not querying. Due to inlining from the compiler, you can almost entirely construct the query at compile time and shave it down to a few string concatenations.

</comment></comment></comment></comment><comment><USER20> My favorite SQL library has been Go-Jet in Go: [https://github.com/go- jet/jet](https://github.com/go-jet/jet)

It has a different approach from PgTyped, which generates type-safe TypeScript code from SQL, whereas Go-Jet generates type-safe SQL from Go code

I'd love to try something along the lines of PgTyped and see how the two solutions compare though

</comment><comment><USER21> Almost every top-level comment is someone shilling another project, usually in Golang as if that's even related.

Let's have some Show HN etiquette.

</comment><comment><USER22> This is similar to sqlc for Golang: [https://github.com/kyleconroy/sqlc](https://github.com/kyleconroy/sqlc)

If you're looking for the ability to generate type-safe SQL – given you write SQL correctly – this project is pretty good.

Aalso a fan of SQLBoiler ([https://github.com/volatiletech/sqlboiler](https://github.com/volatiletech/sqlboiler)) for Golang, for simple type safety:

`models.Accounts(models.AccountWhere.ID.EQ(id)).One(ctx, db)`.

Though SQLBoiler breaks with left joins, as it auto-generates your structs and maps results 1-1 with table definitions. In this case you have to custom type something, either using sqlc or squirrel.

</comment><comment><USER23> Looks cool! And the header image looks awesome! Did you use any tool to do it?

<comment><AUTHOR> Thanks! Not really, just basic vector shapes and an isometric projection grid to make sure perspective is right.

</comment></comment><comment><USER24> You might also want to check Kanel out! [https://github.com/kristiandupont/kanel](https://github.com/kristiandupont/kanel)

</comment><comment><USER25> Looks a little like the Typescript equivalent of Xo ([https://github.com/xo/xo](https://github.com/xo/xo)) for Go. Especially with Go, getting help with some initial scaffolding can be a huge timesaver. I'm assuming it's a similar gain for Typescript.

<comment><USER26> A better equivalent in Go is [https://github.com/kyleconroy/sqlc](https://github.com/kyleconroy/sqlc)

<comment><USER25> thanks! I'll try this - one of my pet peeves with Xo is handling nullable types and more advanced types like JSONB required editing the generated code significantly to make it work. Hopefully sqlc solves that.

</comment></comment></comment><comment><USER27> So basically Dapper TS? I'm very interested!

</comment><comment><USER28> I sort of have something like this for PHP and MySQL. [https://github.com/ellisgl/GeekLab- GLPDO2](https://github.com/ellisgl/GeekLab-GLPDO2)

</comment><comment><USER29> How is it different from Slonik? [https://github.com/gajus/slonik](https://github.com/gajus/slonik)

</comment><comment><USER30> It's cool, and I don't fault the author for working on something that obviously gives him joy, but save yourself a bunch of trouble and avoid this kind of thing. The queries showcased are the least interesting of the set of queries you'll ultimately end up with I'm a mature project.

</comment><comment><USER31> an other lib with light ORM: [https://www.npmjs.com/package/pogi](https://www.npmjs.com/package/pogi)

</comment><comment><USER32> lol. This reminds me Hibernate xml mappings :D</comment>


Secure online file shredder - <AUTHOR> http://cloudshred.in/

<comment><USER2> Genius! Finally, I have a place for my secret files!

</comment><comment><USER3> Beautiful. For the soul, mostly ;)

</comment><comment><USER4> can we have one drive for business integration?</comment>


We launched a free ad network to help publishers sell more Quality Ads - <AUTHOR> http://www.influads.com/blog/introducing-influads-2-0-a-free-ad-network-for-publishers-borderline-obsessive-about-quality.html

<comment><USER2> There's so much about this that I just don't understand. I'm wondering, OP, is English a second/third language for your team? Or was this written in a weekend sprint/hurry-up mode/contest? There's just a _lot_ on the home page alone that doesn't make sense.

"SELL QUALITY ADS & SPONSORSHIPS FOR FREE" - why would _I_ sell "for free"? Maybe you mean "commission free" or "without fees"? It's ambiguous. Oh sure, if I spend the time to think about it, I get it. But what percentage of your customers will spend that time? I'd say it's in the single digits...

"We are 100% FREE" - you aren't 100% free if I ever, in any circumstance during our relationship, pay you. It's either dishonest or misleading to say that you are 100% free and then, later in the ad copy, to say that there is a 6% fee.

"Our publishers own 100% of their quality, audience and value since we remove stuff that previously cannibalized their earnings." Your average visitor who spends 5 seconds on your page reads that and says to themselves, "What does that even mean?" Oh sure, if they think about it for 10-15 seconds, they'll understand your meaning but again: how many people will give you that time?

"DIRECT SALES ARE FREE. Sell and invoice on your own" - Ambiguous wording again. The average person thinks, "My direct sales are and have always been "free". I sold it directly, thus I made 100% of the profit."

"We introduced 100% optional pay-per-performance services: we only get paid when providing that extra value." - What does "100% optional" mean? Do I opt to pay 100%? Or is it a tipping system - it's optional that I pay you and at my discretion as to how much?

"Are you and Advertiser? Signup here!" - Just low rent and crappy to let your home page have a typo so blatant in your action text. Very poor show.

All in all, this is not a company I would do business with. Poor copy, no editing, ambiguous wording, and more unanswered questions than I can list all comes to mean that I'm closing the browser tab. Good luck to you - you have a lot to fix, I think, to make it "work". I hope it works out though - the world always needs new ideas and new executions on old ideas.

<comment><AUTHOR> second language, yes. Thanks for the feedback.

</comment></comment><comment><USER3> I don't want to be that guy but I used your network for two months and I was really disappointed. I quit your service in March and I hope you solved these issues by now. I was annoyed about the fact that the stats stopped to be shown to me after a month. I was just receiving money without knowing what clicks or impressions I had for the banners placed on my sites. Another thing that I disliked was that in the last month of partnership, there was only one advertiser in my banner cycle which meant that the variety of banners was low, leading to a decreasing number of clicks. I surely hope that by now you contacted more advertisers. Don't get me wrong, I'm not saying these things to give you bad publicity, instead I'm hoping that you solved/are solving these problems so that me along with other publishers will use your service again. For the moment, I'm using Adsense and I'm receiving more money than from influAds.

<comment><USER4> I've been using influads for 3 months now and haven't faced any of those problems. I can see my daily stats, and have a variety of ads served by them. And even though I didn't had a high traffic blog, still they accepted me, that means something to me.

Also, adsense may be a good chocie for you, but I'll perhaps never use it. I like to have a single tiny add on my website, which is atleast somewhat related to what I write. Besides, having larger ads, or too many ads, just spoils the reading experience. For me, providing a good reading experience to my readers is as important as making money from it.

Glad to know that adsense works great for you. It would never work for me. Just my 2 cents :)

</comment></comment><comment><USER5> The thing that's interesting about this format is that it seems to be an update to one of the more interesting ad platforms out there: The Deck.

(It's the ad platform Gruber and LaughingSquid, among others, use.)

The Deck is neat because it focuses less on the type of content and more on the quality of the publishers in the network. But the problem is, it's invite only. While there are other ad platforms that do similar things, what's nice about this is that it appears to treat the publisher as nice as the advertiser.

We need more networks where individual traffic is less important than the quality of the publisher and audience. This is a really good start on that front.

<comment><USER2> It's hard to manage "Quality" on any scale though. If 1000 "advertisers" signed up tomorrow, how would this company handle the quality control in a timely fashion? That's where the invite-only comes into play, I guess. You, the ad network, control how many and when advertisers enter your network.

<comment><AUTHOR> good point Scott. I guess we'll see. We're trying to consumerize the experience a bit (eg: <http://influads.com/andrewHyde>) and giving more power to the publisher's hands.

By default we'll be 20%-40% better than others since we're offering 20-40% less fees ;)

</comment></comment></comment><comment><AUTHOR> Hi Guys Anibal, Founder and CEO of InfluAds here.

We think that advertising is a bit evil by charging marketplace fees to Quality Publishers. Since are obsessed about Quality Ads and hate clutter _a bit_ , we decided to make a FREE ad network for those that care about Quality.

Publishers can sell any kind of digital ads & sponsorships in our marketplace including Web, RSS and Email Ads, Video, Podcasts and Syndicated&Promoted Content sponsorships.

Any thoughts?

<comment><AUTHOR> Link to the main site: <http://influads.com>

<comment><USER6> your website is way too confusing .... I'm sorry but you need to add a video about 'how it works' and include how you're different than other networks and where is the savings coming from and for whom (publisher or advertisers or both)....

also is it free for publishers or is it free for advertisers??? ... do u mean u dont charge fees or commission that other network charge to advertisers???

btw, if your basic service is free then there is no need to tell people that u charge for adding value because the subconscious mind doesnt accept that well .... so just create a comparison chart to show how your service is FREE compared to others and in 3rd column you add your value added service which in fact should be really something that others are not offering or its too expensive ....

Good Luck

</comment></comment></comment><comment><USER7> WE GET PAID ONLY WHEN ADDING VALUE: Our pay-per-performance model incentivizes us to help you since we only get paid when adding that extra help that you need.

Dude it's not free if you charge for it.

<comment><AUTHOR> hey dudus Actually, people can use us for free for ever without conditions. They only pay when asking for extra services. We have a few publishers that won't pay as a cent.</comment></comment>


How well do you know CSS display? - <AUTHOR> https://www.chenhuijing.com/blog/how-well-do-you-know-display/#=%B2 <comment><USER2> I love flexbox. But be aware what it's a beast which is not that super-well supported as you might think when you look it up in caniuse.

When I'm fixing cross-browser bugs nowadays it's mostly about flexbox. It's not very often and I can always fix it in a small amount of time. But it gives me an unpleasant but also nostalgic flashback of the old days in the 00s where I fixed more CSS than I originally developed.

So yes, from time to time I run into different and not so obvious problems. My holy grail to work with flexbox today is this list:

[https://github.com/philipwalton/flexbugs](https://github.com/philipwalton/flexbugs)

Two recent issues I ran into: There is a very nasty "bug" in the current Firefox browser. It's not a real bug- more a different interpretation of the standard which will hit any developer not working primarily with Firefox I guess. It's about the intrinsic size of a flex item in combination with fluid images. You have to apply min-width: 0 to the flex-item or you get a (very) wrong sizing in some circumstances. See [2] and [3]

And another one. Most of the time I think about IE11 that it's a mostly 'modern' browser and therefore supports flexbox very good. Yes it is good enough to use. But don't underrate the flexbox bugs (just glimpse through [1]). For example you have to set `min-height > 1px` on a flex container to prevent it from collapsing in some scenario (holy grail layout is a very common case). See here [4]

[1] [https://github.com/philipwalton/flexbugs](https://github.com/philipwalton/flexbugs)

[2] [https://bugzilla.mozilla.org/show_bug.cgi?id=1108514](https://bugzilla.mozilla.org/show_bug.cgi?id=1108514)

[3] [https://github.com/philipwalton/flexbugs/issues/41](https://github.com/philipwalton/flexbugs/issues/41)

[4] [https://github.com/Modernizr/Modernizr/issues/1301](https://github.com/Modernizr/Modernizr/issues/1301)

<comment><USER3> Good to know! How do you handle Safari 8?

<comment><USER4> Safari 8.1

</comment></comment></comment><comment><USER5> > Fun fact: the display values we use all the time are actually short-hand. > For example, `block` is actually short-hand for `block flow`. Refer to the > specification for full list.

\----

[https://drafts.csswg.org/css-display/#propdef- display](https://drafts.csswg.org/css-display/#propdef-display):

> The `display` property defines box's _display type_ , which consists of the > two basic qualities of how an element generates boxes:

> * the _inner display type_ , which defines [...] the kind of formatting > context it generates, dictating how its descendant boxes are laid out.

> * the _outer display type_ , which dictates how the box participates in its > parent formatting context.

...

> _< display-outside>_ = block | inline | ...

> _< display-inside>_ = flow | flow-root | table | flex ...

...

       Short `display` | Full `display`     | Generated box
       </comment><comment></comment><comment>----|</comment><comment></comment><comment></comment><comment>--|</comment><comment></comment><comment>---
       'block'         | 'block flow'       | block-level block container
       'flow-root'     | 'block flow-root'  | block-level block container that establishes a new block formatting context
       'inline'        | 'inline flow'      | inline box
       'inline-block'  | 'inline flow-root' | inline-level block container
       </comment><comment></comment><comment>----|</comment><comment></comment><comment></comment><comment>--|</comment><comment></comment><comment>---
       'flex'          | 'block flex'       | block-level flex container
       'inline-flex'   | 'inline flex'      | inline-level flex container

\</comment><comment>--

The advent of this kind of explicit systematic consistency in web standards is pretty much my favourite thing about living in the future. Every day I fall to my knees and cry with joy and gratefulness that I will only have spent this a small fraction of my professional engagement with web things in the abominable hellscape that was this world before CSS3 started being widely implemented.

<comment><USER6> Note that the split between inner and outer display type (which I presume is what it means by short-hand—a term normally defined as one property that sets multiple properties, rather than one property that takes multiple values) isn't implemented anywhere yet, as far as I'm aware.

<comment><USER5> It looks like there _were_ independent `display-inside/outside` properties, with `display` being a "one property that sets multiple properties" shorthand, in the first draft of the spec:

[https://www.w3.org/TR/2014/WD-css-display-3-20140911/#the- di...](https://www.w3.org/TR/2014/WD-css-display-3-20140911/#the-display)

\---

But that has since been changed to `display` being a "one property that takes multiple values" shorthand, in the current version of the spec:

[https://www.w3.org/TR/2015/WD-css- display-3-20150721/#change...](https://www.w3.org/TR/2015/WD-css- display-3-20150721/#changes)

> Changes since the 11 September 2014 Working Draft include:

> Removed `display-inside`, `display-outside`, and `display-extras` longhands, > in favor of just making `display` multi-value. (This was done to impose > constraints on what can be combined. Future levels of this specification may > relax some or all of those restrictions if they become unnecessary or > unwanted.)

\</comment></comment></comment><comment>--

But you're right. It's not even on caniuse yet (vote here: [https://github.com/Fyrd/caniuse/issues/2337](https://github.com/Fyrd/caniuse/issues/2337)).

But I'm stoked to even see these orthogonal axes and their domains officially laid out, and names given to concepts. Even just `display-inside` vs `display- outside`.

I've had discussions with professionals where no one was certain enough about the `display` mess to make any confident statements on the exact nature of the similarity between `flex` and `block`. Who knew if there were edge cases that made them not have (what I now have the words to describe as) the same `display-outside` behaviour? Thanks also to the crazy muddle of just-slightly- different behaviour the proliferation of other display options has scarred us all with, previously all sharing a single, very arbitrary-seeming, axis.

</comment><comment><USER7> At some point I really should just sit down, make, and then work through a bunch of box model excercises. After 8 years of trying to treat CSS display as a sensible thing, I've concluded that I really just need to learn it by rote.

Until then, I'll stick with flexbox. Someone has already made this excellent set teaching tool: [http://flexboxfroggy.com/](http://flexboxfroggy.com/)

<comment><USER8> After years of utter failure with CSS alignment, I have to admit that I still struggle with flexbox. Perhaps display:grid will finally save for me.

Granted, I've never sat down and systematically learned the foundations of CSS, but I also never did that with Python, Javascript, Clojure, Bash, PostgreSQL, etc. and yet with all of those, I've not had nearly the number of infuriating, soul-crushing marathon sessions of Googling, Stack Overflowing, grasping randomly in the dark, and making desperate prayers to the binary gods.

<comment><USER9> I found flexbox frog (despite the kind of 'for kids' feel) to be really helpful in elaborating on all the flexbox options. Get the frog to line up with the lily pad with flexbox.

[http://flexboxfroggy.com/](http://flexboxfroggy.com/)

</comment></comment></comment><comment><USER10> I know it pretty well. My stuff generally renders right after the 8th or 9th try / refresh!

<comment><USER11> And opening 3-4 Google searches.

<comment><USER12> 8th or 9th, only 4 searches. Damn, I need to study more.

</comment></comment></comment><comment><USER13> If you're building a web app, I have a suggestion to make your life much more pleasant. Go here [0], and set this as your default style. Then go here [1] and grab this style reset. And just use flexbox everywhere.

[0] [https://github.com/facebook/css-layout#default- values](https://github.com/facebook/css-layout#default-values)

[1] [https://github.com/necolas/react-native- web/blob/master/docs...](https://github.com/necolas/react-native- web/blob/master/docs/guides/style.md#reset)

</comment><comment><USER14> Weird SCSS that I have no idea why it's written like this? Seems to me like 3 exactly the same media queries with overwriting values for no good reason?

        @media screen and (min-width: 720px) {
          .th {
            font-size: 1.294rem;
            line-height: 1.6rem;
          }
        }

        @media screen and (min-width: 720px) {
          .th {
            font-size: 0.8rem;
            line-height: 1.6rem;
            font-family: "Roboto Slab", Rockwell, serif;
            font-weight: 700;
          }
        }

        @media screen and (min-width: 720px) and (min-width: 720px) {
          .th {
            font-size: 1rem;
            line-height: 1.6rem;
          }
        }

<comment><USER15> I'm sure someone will latch onto this as an example of why CSS sucks.

</comment></comment><comment><USER16> I think display:none is a regularly annoying design mistake. It would be better to separate the concepts of how the content should be displayed, and whether it should be displayed in the first place.

It causes issues such as:

\- The built-in rule for *[hidden] { display: none; } is often of no help as another css class may set display to something else, so from the developer's perspective the "hidden" attribute seems to be broken.

\- Often a CSS class sets display:none and another CSS class which merely wants to undo that sets display:block. This gets in the way of the developer if they really wanted to use another display type like flex. (one example: Bootstrap's tabs, .tab-content.active{display:block})

\- In both cases the fix gets ugly in cases where the problematic css which you want to override comes from parent classes elements, as in that case it is not sufficient to use a simple class like .display-flex{display:flex;} but you need complex rules to override specific cases of parent css.

<comment><USER17> > I think display:none is a regularly annoying design mistake. It would be > better to separate the concepts of how the content should be displayed, and > whether it should be displayed in the first place.

This is exactly what the proposed box-suppress property [1] does:

"The display: none value was historically used as a "toggle" to switch between showing and hiding an element. Making this reversible requires either setting up the CSS cascade carefully, or remembering what the display value was before it was set to none. To make this common use-case easier, this module introduces the separate box-suppress property to do the same thing, so that toggling whether or not an element appears in the formatting tree can now be done without affecting its display type when it is displayed."

[1]: [https://drafts.csswg.org/css-display/#propdef-box- suppress](https://drafts.csswg.org/css-display/#propdef-box-suppress)

</comment></comment><comment><USER18> Most people don't really know css that well, because you can quickly open a browser tab and fiddle around till you get it right. If it took half an hour to compile between changes I'm sure people would know CSS far better.

<comment><USER7> I think if it took a half hour compilation step, someone would have written a decent intro tutorial which taught a consistent and useful mental model of CSS. Either that or CSS would have just died off.

The fact that a lot of other people here are saying that they have to fiddle with CSS to get it right is making me feel a lot less shitty as a web dev.

</comment></comment><comment><USER19> It's amazing that TeX has basically boxes, glue, and two kinds of lists (vertical and horizontal) and does wonders. CSS, on the other hand...

<comment><USER20> Flexbox is basically boxes, glue, and two kinds of lists (vertical and horizontal). You can pretty much do all layout in flexbox these days, and all the other display properties are just for legacy compatibility.

</comment></comment><comment><USER21> In response to his "responsive numeric stepper," he could have substituted over 20 lines of CSS and eliminated the unsavory plethora of element-specific media queries if he'd just used non-breaking spaces (` `) to achieve the desired line breaks.

Better yet, he could have set `white-space: nowrap;` on `.passenger__label` instead and just thrown a `<wbr>` element before the first parenthesis.

<comment><USER22> I'll admit, I've been doing frontend for a while and I hadn't heard of the <wbr> element. Thanks for the pointer!

<comment><USER23> > [1] Support for the <wbr> tag was introduced in Internet Explorer 5.5, > though removed again in version 7.

probably the biggest problem with it.

<comment><USER21> Doesn't seem like a problem to me: [http://caniuse.com/#search=wbr](http://caniuse.com/#search=wbr)

<comment><USER24> Not supported in IE11, unfortunately, which is a deal-breaker for me.

It was hard enough to get permission to drop IE <10 at $EMPLOYER.

</comment></comment></comment></comment></comment><comment><USER25> Maybe this will come with practice, but I would love to understand, clearly, which use-cases are best fits for flexbox and grid respectively. With the very limited experimentation I've carried out on both, they each seem far superior to messing about with floats (hooray!), but I can't quite get a fix on their respective merits.

<comment><USER6> What use-cases work with which basically boil down to what you're trying to: flexbox does layout in a single dimensions, and grid does layout in two dimensions.

If you're trying to implement something with layout constraints in both dimensions, you want grid. If you're not, you can probably use grid, but flexbox is likely easier.

<comment><USER26> In addition, an important determination is not just if you want layout constraints in both dimensions but if you want/need source order independence in both dimensions.

With flexbox you get layout constraints in both dimensions with proper source nesting (rows inside columns or vice versa, ad infinitum) and you get source order independence in the "current direction" (within this row or this column), but not between rows/columns in the grandparent container (or the great-grandparent, etc).

With grid, you can have source order independence in both directions, very nice and easy.

(Source order independence matters for responsive needs where things reflow to different grid places/flex orders based on viewport width, media type or other factors. Source order independence can also be a big important factor for accessibility. The "semantic web dream" is kind of sort of dead or at least asleep these days, but source order independence is a huge win for the semantic web. Finally, source order independence is just nice for keeping HTML markup clean and minimal, which has long been the dream of CSS.)

</comment></comment></comment><comment><USER27> Just use flexblox on everything, and eat some macaronis. before flexbox it was very hard to me to understand css.

</comment><comment><USER28> Pretty interesting, I recently switched my nav-bar to display: flex and find it way easier.</comment>