News for hackers. Stuff that matters.
Re:Advice to my younger self: become allergic to the churn by umvi on Thursday August 08, 2019 @09:23AM (#20644256)
The piece reads like a Unix pastor's pulpit preaching

"Great nutritious technologies to use: Make, Emacs, Lisp, CLI"

"Bad unwholesome technologies to use: JavaScript, Ruby, IDEs, Graphical User Interfaces"

I personally hate Make, it's burned me too many times. Now I use CMake, and I haven't been burned in years.

And is it candy or an olive that I like VSCode and not Emacs (not that I've ever tried Emacs, I just don't feel like investing in that ecosystem)?

I agree the front end web framework churn is out of control; hopefully it will stabilize over time. But come on, don't just rip on random scripting languages that have been around for 25 years

Re:Advice to my younger self: become allergic to the churn by rxhernandez on Thursday August 08, 2019 @10:58AM (#20645158)
I mean I haven't been a professional for multiple decades but I've written professionally in a very wide range of fields in C, Matlab, Java, Python, Verilog, Assembly, Fortran, and Javascript, and, there is no language that I've seen that has more hair pulling, braindead I just learned to program yesterday type programming nearly as much as I've seen in Javascript.

(I've worked intimately with decades old scientific programming codebases where the scientists didn't give a single damn about writing cleanly and even that was an order of magnitude more readable than the willy nilly, consistency be damned crap I've been seeing in Javascript)

(I feel like I could describe a small portion of hell for me and it would include Javascript)

Re:Advice to my younger self: become allergic to the churn by IggleSniggle on Thursday August 08, 2019 @12:03PM (#20645737)
It's all about who is writing it and why they are writing it, not the language. Well ok JavaScript has some legacy warts, but ECMAScript 2019 enables a variety of very well written code in a variety of styles, and TypeScript is icing.

As for me, I've only recently entered the JavaScript game, but the php I've seen has been much, much worse. I find the quality of JavaScript I typically encounter is on-par with typical Python code, and a fair bit better than the Frankenstein monsters of dev-ops code that often has a different convention for each line of bash (with attendant third-party applications) mixed in with inscrutable environment states as you shift in and out of various orchestration layers that have zero sense of application hierarchy or even running processes.

I've seen scientific codebases too, but the thing you're getting there is an authorship that is often small-team (1 or 2) and very slow to shift, with highly enculturated domain context. Of course JavaScript code is going to be a mess in organizations where you have devs coming from vastly different contexts and staying a max of 2 years with a team where all you care about is getting the pretty graphic on the screen.

Re:Advice to my younger self: become allergic to the churn by fao_ on Thursday August 08, 2019 @02:11PM (#20647000)
> It's all about who is writing it and why they are writing it, not the language.

But who is writing it and why they are writing it are inextricably linked with the language. Every language has a culture and a reason for existing, those are pressures that bear as much on the person writing the language and the code produced as much as the person writing the code does on the code and the language.

Whether or not say, modern Java encourages good code is neither here nor there, as not only is there resistance to learning new things there is resistance to using the new things properly. Java has a history of bloated, inefficient code for a reason, and when you use Java, the abstractions you use will alter the code that you write. It's impossible to get away from 'bad code' without rewriting things, and then you're not coding your new project you're rewriting someone else's. It's also 'good practice' to use x y z language idioms, but there are cases when such idioms make the code much harder to read and much less clean.

As an example from C: I like POSIX, but dirname and basename are two ridiculously shit functions. If I choose to use them, the rot starts infesting my code, and everything that deals with them has to account for that, which itself causes a bias towards more obtuse code.

Re:Advice to my younger self: become allergic to the churn by Xelbair on Friday August 09, 2019 @05:38AM (#20652736)
>It's all about who is writing it and why they are writing it, not the language. Well ok JavaScript has some legacy warts, but ECMAScript 2019 enables a variety of very well written code in a variety of styles, and TypeScript is icing.

Good languages kinda enforce some kind of basic rules, and prevent developers form making silly mistakes - because we all do them all the time. Those languages usually trade off the performance for safety though.

We should pick the safest language, that prevents errors and mistakes as long as we stay within allowed performance bounds.

JavaScript can be performant, but most of the times it isn't and it isn't safe at all. At least we have typed variants of JavaScript.

JavaScript by design was meant to fail gracefully - in the background - so the site works fine. Sadly nowadays sites are so JavaScript heavy that it isn't helping at all.

I generally prefer statically typed languages just because there is less ambiguity and function definition can help you greatly - you know what you put it, and what it returns.

With dynamic typed languages unless documentation is pristine(and in JavaScript ecosystem it is pretty varied from package to package) you are out of luck unless you look at the implementation.

bash and devOps code has their own special place in hell. bash has only one advantage - it works on any linux distro out of the box, and that's it. It is unreadable untyped mess.

Re:Advice to my younger self: become allergic to the churn by test6554 on Thursday August 08, 2019 @12:20PM (#20645888)
Seconded on php. I have used php, I can use php, I just choose not to any more if I can help it.
Re:Advice to my younger self: become allergic to the churn by iratewizard on Thursday August 08, 2019 @06:26PM (#20649507)
Smart choice. I opted to stop accepting php jobs several years ago and life has never been easier.
Re:Advice to my younger self: become allergic to the churn by tomgp on Thursday August 08, 2019 @11:52AM (#20645636)
I have a similar set of experiences but have a feeling that it's at least partly down to the sheer number of people writing Javascript and the very public nature of much of that code that so much of it is a mess. I don't think there's anything inherent in JS that make is produce messy code other than the fact that it's easy for amateurs to get results (thanks to the fact it runs in a browser and there's lots of easily available code samples).
Re:Advice to my younger self: become allergic to the churn by tenaciousDaniel on Thursday August 08, 2019 @12:02PM (#20645729)
I'm a JS dev and I love it, but JavaScript is to programming languages what the electric guitar is to musical instruments.

It's the thing that attracts a lot of new beginners who may or may not be interested in the more serious theory that makes programming what it is.

Re:Advice to my younger self: become allergic to the churn by _bxg1 on Thursday August 08, 2019 @01:41PM (#20646685)
Agreed. I've gotten to where I don't like it as much for really large projects - TypeScript helps a bunch but is inherently limited by aspects of JS itself - but there is absolutely no language I'd rather sketch something out in.

The core data types actually strike a really excellent balance between representing the major distinct paradigms (named collections, unnamed collections, strings, numbers, booleans) while giving you maximum flexibility within them. Its standard library - array functions in particular - has become very mature. FP and OOP concepts are both quite well-supported, and doing async stuff (client or server or otherwise) with promises just smashes every other language I've used in terms of ergonomics.

Much of the above could be said about Python too, but regardless.

Re:Advice to my younger self: become allergic to the churn by tenaciousDaniel on Thursday August 08, 2019 @01:51PM (#20646781)
Yeah definitely, it's amazing for scratching together ideas. Though at a certain scale, it starts to feel pretty fragile. I don't have much experience with other languages but the explicit interface/implementation paradigm that Objective C used was so amazing to me (as someone who started out in JS). I find myself missing it every now and then, especially for large projects.
Re:Advice to my younger self: become allergic to the churn by rxhernandez on Thursday August 08, 2019 @12:05PM (#20645756)
Have you worked in other languages for substantial amounts of time?
Re:Advice to my younger self: become allergic to the churn by filoleg on Friday August 09, 2019 @01:59PM (#20656805)
Yep. Python for many years, Java+TurboPascal+C# for a couple of years, C+Matlab for a bit under a year, and a few other ones that I wouldn't list simply due to how little work I've done in those.

TypeScript and Python (with typehints) are the current favorites. Golang seems to be getting up there for me too, but I don't have enough experience with it to actually be able to say that.

Re:Advice to my younger self: become allergic to the churn by celim307 on Thursday August 08, 2019 @01:17PM (#20646417)
I used kotlin, golang, and ruby for multiple. not a huge sample of languages but i still like es6 javascript the best
Re:Advice to my younger self: become allergic to the churn by tenaciousDaniel on Thursday August 08, 2019 @12:22PM (#20645913)
I did Objective C for about 1-2 years, and a bit of java over the years. But no, not really.
Re:Advice to my younger self: become allergic to the churn by rxhernandez on Thursday August 08, 2019 @01:13PM (#20646380)
Fair enough. Thank you for taking the time to a question that, in retrospect, sounds antagonistic (apologies for that).
Re:Advice to my younger self: become allergic to the churn by tenaciousDaniel on Thursday August 08, 2019 @01:34PM (#20646600)
Nah, I didn't take it that way
Re:Advice to my younger self: become allergic to the churn by marshray on Thursday August 08, 2019 @01:51PM (#20646793)
Also, it's used with high levels of added distortion.
Re:Advice to my younger self: become allergic to the churn by LargeWu on Thursday August 08, 2019 @03:21PM (#20647675)
I agree that there's nothing inherent that makes it produce messy code, but it also doesn't really promote good code either.

There's half a dozen different syntaxes for importing/exporting functions, creating functions, creating objects, etc., and it's all fair game. Then there's the asynchronous nature, so sometimes it's async/await, and sometimes it's promises, and sometimes it's callbacks, sometimes all happening in the same function.

And then on top of that there's all the front-end web frameworks which are like, totally un-opinionated, man, except for the parts where they're implicitly super opinionated.

Re:Advice to my younger self: become allergic to the churn by imesh on Thursday August 08, 2019 @02:19PM (#20647097)
I have made a few Wordpress sites for customers that required me writing Javascript and PHP code as I learned them for quick features and fixes. In other words, I had to write Javascript and PHP code before I even considered myself a programmer, I basically copy-pasted and edited until it worked.

I imagine that accounts for a lot of bad Javascript and PHP code. By the time I wrote any C++ or Python professionally I had a CS degree and a decade of programing experience.

Re:Advice to my younger self: become allergic to the churn by MiroF on Thursday August 08, 2019 @12:07PM (#20645775)
what killed Javascript for me (and I think many others) is that there is no idiomatic way of writing Javascript. There is no "javascript"-y way of doing things (unless you count callback hell).

I'm not saying that a language should only offer one approach to a problem, but there should be general guardrails and guidelines. A shared vocabulary. None of that exists in modern JS

Re:Advice to my younger self: become allergic to the churn by _bxg1 on Thursday August 08, 2019 @01:35PM (#20646611)
The same criticism (which is a valid one) is doubly true of Lisp, but Lisp doesn't take half the flak that JavaScript does.
Re:Advice to my younger self: become allergic to the churn by marshray on Thursday August 08, 2019 @01:54PM (#20646825)
"There are only two kinds of languages: the ones people complain about and the ones nobody uses."

- Bjarne Stroustrup

Re:Advice to my younger self: become allergic to the churn by vkou on Thursday August 08, 2019 @01:54PM (#20646817)
That's because there's three or four orders of magnitude more JS code out in the wild, then there is Lisp code.
Re:Advice to my younger self: become allergic to the churn by bobthepanda on Thursday August 08, 2019 @04:45PM (#20648528)
The problem is that the original paradigms were pretty terrible but JS has to keep (as much as reasonably possible) backwards compatibility to not break the web. If you forked JS and made changes to clean it up that weren't backwards compatible, you'd have a hard time convincing browsers to take it, making the whole exercise sort of moot.

The fact that we have things like the Wayback Machine is a testament to how this approach, while terrible for developers starting out or working in a legacy codebase, has enabled us to preserve what is now a significant portion of contemporary cultural history. AFAIK there is no similar archive of programs for, say, Java or C.

Re:Advice to my younger self: become allergic to the churn by mceachen on Thursday August 08, 2019 @01:41PM (#20646680)
"Standard" [1] and "Airbnb" [2] seem to capture some amount of sensible guidelines. Adding Prettier [3] gets you something akin to gofmt, and adopting standard eslint rules [4] can help too.

[1] https://standardjs.com/ [2] https://github.com/airbnb/javascript [3] https://prettier.io/ [4] https://eslint.org/

Re:Advice to my younger self: become allergic to the churn by MiroF on Thursday August 08, 2019 @02:26PM (#20647166)
You're talking about style, I'm talking about idioms. Those aren't the same thing!
Re:Advice to my younger self: become allergic to the churn by mceachen on Thursday August 08, 2019 @07:05PM (#20649807)
I think idioms and style have some level of overlap.

Semicolons could be considered idiomatic or stylistic, for example. Requiring strict equality operators feels more of an idiomatic way to avoid bugs, rather than simply whitespace. Eslint certainly has a number of rules that are more idiomatic than stylistic.

If you're touching on the lack of consistency in, say, open source javascript, I agree, code is all over the place. Also, I think you're looking at a language that has had dramatically more evolution (especially in recent time) than most other popularly used languages. Old code without promises and suffering from callback hell feels archaic.

However, I think if you look at, say, TypeScript repos (which is cheating, I know, it's not javascript), there is more homogeneity, at least from what I've seen.

Re:Advice to my younger self: become allergic to the churn by heavenlyblue on Thursday August 08, 2019 @07:40PM (#20650057)
>> language that has had dramatically more evolution

Of course it evolved. It’s easy to evolve if it was literally nothing in the first place.

Re:Advice to my younger self: become allergic to the churn by vinceguidry on Thursday August 08, 2019 @12:49PM (#20646147)
The only thing JavaScript was ever even barely good for was that which it was designed to do, be the programmable interface for a browser. Why anyone would want to do anything else with it simply boggles my mind.

It's like if someone took the BASIC my calculator offered back in the day and turned it into a general purpose programming language.

Re:Advice to my younger self: become allergic to the churn by heavenlyblue on Thursday August 08, 2019 @01:13PM (#20646371)
But JavaScript's got asynchronous!
Re:Advice to my younger self: become allergic to the churn by robocat on Thursday August 08, 2019 @04:14PM (#20648202)
A race to the "promised async hell".

I wonder how many devs are struggling to debug and fix bad code written using Promise and async features. With care you can use these features safely and productively, but it is also very easy to make subtle mistakes that cause intermittent faults or strange corner case errors.

Re:Advice to my younger self: become allergic to the churn by heavenlyblue on Thursday August 08, 2019 @07:42PM (#20650068)
The comment is a reference to a phrase “It’s got electrolytes!”.
Re:Advice to my younger self: become allergic to the churn by andrewprock on Thursday August 08, 2019 @02:14PM (#20647039)
So was Windows 95.
Re:Advice to my younger self: become allergic to the churn by ourlordcaffeine on Thursday August 08, 2019 @12:14PM (#20645850)
For me, R probably has a worse rate of churn than javascript in the case of breaking changes. Javascript is full of hyped frameworks, but R is the only language I've used where a minor update to a package caused an entire project to break (because the package author had changed its api)
Re:Advice to my younger self: become allergic to the churn by bsder on Thursday August 08, 2019 @05:44PM (#20649142)
> there is no language that I've seen that has more hair pulling, braindead I just learned to program yesterday type programming nearly as much as I've seen in Javascript.

I would argue that anything for phones is similarly braindead.

While the languages are okay, the API's, UI idioms, and general ecosystem seem to have a half-life of about 6 months. If you step away from programming phones for 18 months, it's like you're learning everything from scratch.

(Side note: All right, Groovy should be taken out and shot and the idiot who foisted it on the Android build system needs to be taken to the woodshed and beaten severely.)

Re:Advice to my younger self: become allergic to the churn by zmmmmm on Thursday August 08, 2019 @11:44PM (#20651177)
> Groovy should be taken out and shot and the idiot who foisted it on the Android build system

I think your beef there should really be with Gradle, or at least, how it is using Groovy. The way Groovy is implemented as a DSL for Gradle is, in my view, toxic. Almost everything is implicit behavior, crucial aspects rely on totally incidental "magical" features that just make things happen when you invoke some cryptic incantation that has an unobvious connection to its context.

Groovy itself is pretty good and IMHO much better than Java for most purposes.

Re:Advice to my younger self: become allergic to the churn by heavenlyblue on Thursday August 08, 2019 @07:45PM (#20650083)
Idk - there is definitely a difference between learning about React and a completely different way to do programming.

If you were any good 12 months ago - you will pick up any of the trends quite easily in a week or so (partially because you have also predicted the future).

Re:Advice to my younger self: become allergic to the churn by mighty_bander on Thursday August 08, 2019 @12:23PM (#20645920)
It's such a shame! JS could be a concise little language with a lot of power (in terms of being able to ignore types until they matter), but instead you end up transpiling unusable garbage with 10MB string manipulation libraries that release breaking changes as patch versions. Python is what JS is supposed to be, although I do feel like Bart Simpson in front of the blackboard every time I write `lambda x:`.
Re:Advice to my younger self: become allergic to the churn by bro25 on Thursday August 08, 2019 @04:20PM (#20648258)
Being a small language would be irrelevant to JS. The web could benefit from a sound type system built into browsers (aka typescript in the strict mode), but it's not like anybody complains about python lacking the type system, right? What web really needs is a way to write highly modular apps and let the browser download only relevant modules, with caching, prefetching and so on. None of the attempts have worked so far. If you look an any app today, it looks like the main module that has static deps on other modules that deoent on other modules and so on. When everything is linked together, we get this 50MB binary. Not a big deal for native apps or services, but it's a big deal for web apps that need to download all this mess and maybe actually use 20%. There is no way today to conveniently write a web app that would pull only necessary modules at runtime. It's not just that the language is missing some keywords, it's about the entire web world is designed around static linking: we'd need to redo existing non modules, existing frameworks, upgrade to http2 for batching multiple requests to download a bunch of small modules and so on. That's a lot of work that needs a lot of expensive devs and the returns of that work are non existent: there's no profit to be made there. That's why it'll stay this way: bloated web apps with thousands of unused deps.
Re:Advice to my younger self: become allergic to the churn by nesadi on Friday August 09, 2019 @07:33AM (#20653321)
> anybody complains about python lacking the type system.

Well, Python does have strong typing. It's just dynamic, not static, and I've seen enough criticism about it to say that it isn't as unimportant as you make it out to be. JavaScript gets a lot of criticism for having dynamic and weak typing. And I think both forms of criticism are valid, though not everybody agrees, which is fine too.

Re:Advice to my younger self: become allergic to the churn by bro25 on Saturday August 10, 2019 @03:53PM (#20664162)
What makes webapps bloated is the require-at-the-top pattern. Type system makes no difference here. What most devs don't realize is that if their precious app written in holy C plus plus or Java got compiled into a standalone binary that could run on any device inside a browser, it would be a 150 MB mess that wouldn't even boot. All these nice frameworks, libs and utils would need to be downloaded before the app can start. We'll see this soon with wasm, btw.
Re:Advice to my younger self: become allergic to the churn by Crinus on Thursday August 08, 2019 @10:05AM (#20644681)
You may hate Make and it is certainly far from ideal (tab-based syntax was a mistake) but the thing is, Make has very simple rules that haven't changed for decades and Makefiles generally keep working (and when they break it isn't the fault of Make itself but of something else that isn't as stable/backwards compatible as Make).
Re:Advice to my younger self: become allergic to the churn by kabdib on Thursday August 08, 2019 @11:20AM (#20645361)
Common make fail #1

The project you landed on has been using some souped-up supermake with a ton of features (which were used with wild abandon) and some subtly different semantics for (say) macro expansion and variable assignment (and these are really difficult to determine the dependency scope of). The build system has grown to a recursively gnarly Turing-complete mess.

So when you go to update the tooling, you find out that this supermake is (a) a commercial project, (b) the company has gone out of business, or adopted a predatory per-seat licensing scheme, or no longer supports your platform, or has changed the product so significantly that you might as well port everything to a different version of make anyway.

Never happened to me.

Common make fail #2

I was regularly dealing with bugs in multi-million-line makefiles. Make, you see, has no debugger; you can't step through things to find out what's going on. To debug an issue you insert print (echo) statements and look at output, and/or gronk through many, many lines of make's internal structures. Why didn't file A compile, and why file B compile twice? It could take a long time to figure out.

Common make fail #3

"Builds are too slow, we need to speed them up."

So you go parallel. Hey, this is easy. Except for those libraries there (they need to be done first). And those headers are generated, so those need to come first, but first first. And everything depends on these libraries getting built, so need to wait for the linker here, here and here. Pretty soon you have a dependency hairball that nobody understands and that people are afraid to change because things always break. Eventually you get to a point where "yeah, building twice usually seems to fix that issue..." and that's when you know the project has grown too damned big for its shell again.

Common make fail #4

You die a little each time that you get screwed by tab-versus-space. And cross-platform . . . umm, what year is it? Then someone smugly mentions some XML-based tool to you, and you snap because that tool is worse in every single measurable dimension and a few more besides but the developer in question doesn't question things because the tool uses Holy XML and Blessed Java (well, some version of Java, anyway, you can probably still download it from somewhere) and who cares if it's just the same set problems with a different color paint slapped on top and the usual Reddit community dedicated to the elimination of all heretical views. Support? Who needs that, just read the source.

Seriously, I haven't seen any build tools in the past 30 years that have done a great job and that were a joy to use. CMake, Ant, Gradle, make-of-the-month-club, whizzy vendor-locked tools, bespoke in-house constructions, they have all been terrible. I see little hope, entropy has won this one.

Re:Advice to my younger self: become allergic to the churn by hedora on Thursday August 08, 2019 @12:48PM (#20646141)
Common make fail #0

Not starting by reading the manual, and then writing an idiomatic make file.

Once you understand how to use auto generated .d files, you’ll never have a multimillion line make file.

Once you understand the built in lex and yacc rules, you can generalize them to whatever code generator you are using.

The remaining thing (not spelled out in the manual) is to avoid recursive sub make, and to use the include directive instead. “Recursive submake considered harmful” is a helpful paper, but it should have had the subtitle “a practical alternative”, because people cite the title without reading the whole paper.

Re:Advice to my younger self: become allergic to the churn by penagwin on Thursday August 08, 2019 @11:31AM (#20645448)
>I was regularly dealing with bugs in multi-million-line makefiles.

I've personally only used make for a few projects, and might not be "in the know" about how to best use make, but isn't a multi million (!?) line makefile a sign you should probably break it into peices, or use a different solution?

Multi-million just seems insane to me

Re:Advice to my younger self: become allergic to the churn by Gibbon1 on Thursday August 08, 2019 @02:22PM (#20647127)
It sounds like something that was auto generated by a brain dead script at one time. And then later hand modified to 'get things to work' which then meant there eventually was no way to regenerate it from scratch.

Personal feeling is you should have a way of regenerating makefiles.

Re:Advice to my younger self: become allergic to the churn by Crinus on Thursday August 08, 2019 @11:58AM (#20645691)
Sorry i do not understand, is this post a joke? I mean it literally because of the "never happened to me", then the multimillion line makefile doesn't sound real but then you do write something that sounds like someone who has issues with makefiles could say (build order, though common that isn't make's fault - at least as much as isn't a programming language's fault that a program has bugs). So i'm not sure how to take this comment.
Re:Advice to my younger self: become allergic to the churn by kabdib on Thursday August 08, 2019 @01:37PM (#20646631)
The multi-million line makefile is real. I wish it hadn't been. That was a terrible time.

I guess my point is that make doesn't scale, and unavoidably gets messy over time as each project solves the same problems over and over in different, buggy ways.

make solves problems you get early in a project ("let's get this handful of files automatically built") and doesn't even try to address issues of modern software development, like build parallelism and dependency management. Its facilities for debugging problems are laughable.

Re:Advice to my younger self: become allergic to the churn by fao_ on Thursday August 08, 2019 @02:15PM (#20647050)
> make solves problems you get early in a project ("let's get this handful of files automatically built") and doesn't even try to address issues of modern software development, like build parallelism and dependency management. Its facilities for debugging problems are laughable.

Go look up plan9's mk. It's a remake of the program written by the designers a few decades later with everything they learned from it. Not only are the variables idiomatic, and the spaces problem fixed, but you can ask for output at each stage and (IIRC) view the graph that it builds.

Re:Advice to my younger self: become allergic to the churn by deng on Thursday August 08, 2019 @02:21PM (#20647110)
> The multi-million line makefile is real

Of course you quickly get to million-line Makefiles in bigger projects. In C++, if you depend on stuff like Boost, a single file can easily depend on thousands of header files, and every single one must be tracked by Make.

But of course, nobody in his right mind would write these dependencies by hand. At my dayjob, the core Makefile is 700 lines. These 700 lines do cross-compilation with gcc/clang for various platforms, unit testing, valgrind, cppcheck, clang-tidy, coverage, and several other things. It is completely non-recursive, runs in parallel without problems, tracks all dependencies, and also works on Windows.

Of course this stuff is complicated. Make is very low-level compared to a build-generator like CMake. But if you want a bespoke build system for your project which lets you control every last detail of your build, it is still a good choice.

Re:Advice to my younger self: become allergic to the churn by nesadi on Friday August 09, 2019 @07:39AM (#20653358)
Do you know any resources on how to use Make in a sensible/sane way?
Re:Advice to my younger self: become allergic to the churn by lioeters on Thursday August 08, 2019 @06:41PM (#20649619)
As far as rants go, this one was a joy to read. Then I wept for the state of affairs in build tools. I'm not even close to familiar with so many as you've listed, but I never experienced one that didn't eventually turn into a Rube Goldberg contraption (if it didn't already start out that way).

> grown to a recursively gnarly Turing-complete mess

> gronk through many, many lines of make

Thank you for my new word of the day. It describes exactly how I feel sometimes, dealing with technical debt accumulated over years, Frankenstein's systems where parts are always churning - often for no good reason at all, new but worse in most aspects - it can be exhausting gronking through the layers of complexity.

Re:Advice to my younger self: become allergic to the churn by mighty_bander on Thursday August 08, 2019 @12:39PM (#20646058)
Once upon a time, .net code would just build. You had a nice list of project dependencies and references, and you could throw it all into a nice MSI installer that anyone off the street could use without being told how. It would plop debug builds in one directory and release builds in another.

Then Microsoft got rid of it because InstallShield gave them money. Now you need the super-extra-professional edition of Visual Studio to have anything but the most basic installer, and you need to hire a guy to write InstallShield scripts while he's taking a break from contemplating just how tough it would be to get by on pogey alone, and God forbid you need to change anything because the guy is on a different floor because he's not a real developer, etc. etc.

Re:Advice to my younger self: become allergic to the churn by User23 on Thursday August 08, 2019 @01:12PM (#20646369)
> Seriously, I haven't seen any build tools in the past 30 years that have done a great job and that were a joy to use. CMake, Ant, Gradle, make-of-the-month-club, whizzy vendor-locked tools, bespoke in-house constructions, they have all been terrible. I see little hope, entropy has won this one.

Have a look at redo[1].

[1]https://redo.readthedocs.io/en/latest/

Re:Advice to my younger self: become allergic to the churn by marcosdumay on Thursday August 08, 2019 @02:09PM (#20646985)
Well, your make failure #1 is not using make?

Also, #3 is what make excels in. I'm still to see another tool that is more fit to that kind of thing.

At the end of the day, I don't like make. It's for reason #5: there's no project introspection, you can't group tasks into high level values, update your graph on the fly, or add anything to your target except at the source level. I see this one didn't make into your list. This is one of the reasons those multi-million makefiles exist.

I'd rather deal with a small shell script, or a larger Python one if it can't be small. Yet, autotools are great for system programming.

Re:Advice to my younger self: become allergic to the churn by dwheeler on Thursday August 08, 2019 @12:37PM (#20646044)
It's true that you can screw up the use of make in multiple ways, but that is true of any programming system. I find make to be a useful tool.

The most common mistake, by far, is trying to use make recursively (where make calls other makes down a directory hierarchy). That's typically where "builds are too slow" come from, because you end up with a hairball of complex workarounds because no one make invocation actually has the correct dependency data.

I just create a single makefile and treat it like any other program: Add carefully, ensure that the text is clear, etc.

Re:Advice to my younger self: become allergic to the churn by snazz on Thursday August 08, 2019 @11:30AM (#20645445)
It feels like most every build system is either super over engineered or just arcane. I like that Go keeps its build system integrated with the language and that its build system is overall pretty simple and easy to grok.
Re:Advice to my younger self: become allergic to the churn by kabdib on Thursday August 08, 2019 @11:57AM (#20645686)
Go's build system is pragmatic and simple and hasn't let me down yet, but I'm still working on projects at fairly small scale, and the Go build system doesn't do much for other languages, so I didn't mention it.

I think that we're going to see more languages with built-in build systems from early-on in the language's development, but that is a doubled-edged sword (works great for your version of WHIZBOL, doesn't work great if you need to interop with other things).

Re:Advice to my younger self: become allergic to the churn by Crinus on Thursday August 08, 2019 @12:00PM (#20645707)
Make is also very easy to grok though, at its core is just a series of "i want this file, it depends on these files, use these shell commands to produce it".
Re:Advice to my younger self: become allergic to the churn by snazz on Thursday August 08, 2019 @12:02PM (#20645726)
I’ve seen a lot more monstrosities created with Make, but if it’s controlled then yes, it’s not too complex.
Re:Advice to my younger self: become allergic to the churn by rosser on Thursday August 08, 2019 @01:47PM (#20646746)
Honestly, more than anything, this reminds me of the time Uber flounced off PostgreSQL because its performance sucked when used incorrectly.

When you (the general "you", please) use a tool wrong, you can look kinda a fool for blaming the tool.

Re:Advice to my younger self: become allergic to the churn by yellowapple on Thursday August 08, 2019 @02:08PM (#20646979)
Make is the worst build system... except for all the others.
Re:Advice to my younger self: become allergic to the churn by MiroF on Thursday August 08, 2019 @12:09PM (#20645790)
> multi-million-line makefiles

Is this a copypasta?

Re:Advice to my younger self: become allergic to the churn by kabdib on Thursday August 08, 2019 @01:37PM (#20646637)
Nope.
Re:Advice to my younger self: become allergic to the churn by vinceguidry on Thursday August 08, 2019 @09:32AM (#20644356)
Rake, the Ruby version of Make, is rock-solid, dependable, and crazy-powerful. Don't want a Turing-complete language in your build automation? Don't use it, the rule syntax works just fine. But it's there if you want it, and oh god is it great.
Re:Advice to my younger self: become allergic to the churn by nathell on Thursday August 08, 2019 @11:09AM (#20645266)
> Rake, the Ruby version of Make

That's a common misconception, but people often don't understand what make is. Contrary to the intuition, make is _not_ a build system (like, say, cmake), although build systems can be (and often are) implemented on top of make; nor is it a task runner (like rake).

At its core, make is a declarative expert system (with a very sane design and a very quirky rule syntax). Its area of expertise is updating files. I urge every user of make who hasn't read "Recursive Make Considered Harmful"[1] to do so.

[1]: http://aegis.sourceforge.net/auug97.pdf

Re:Advice to my younger self: become allergic to the churn by ummonk on Thursday August 08, 2019 @02:46PM (#20647350)
Yup, and a common modern use case of make is to call in to other language specific build systems.
Re:Advice to my younger self: become allergic to the churn by cjfd on Thursday August 08, 2019 @10:35AM (#20644966)
There is something extremely weird about the idea of having a build system for a particular language. It is not uncommon for a project to have multiple languages and it is also possible that some of the source code in one language is generated by an executable in another language. Because of this and because of compatibility issues the correct number of build systems to exist is 1. If there is more than 1 in a single project it will be the case that sometimes more is rebuilt than necessary.
Re:Advice to my younger self: become allergic to the churn by vinceguidry on Thursday August 08, 2019 @11:06AM (#20645224)
Yes I wouldn't ever want more than one build system. I use Rake to build Crystal, and haven't even bothered to investigate Crystal's offering.
Re:Advice to my younger self: become allergic to the churn by regularfry on Thursday August 08, 2019 @01:16PM (#20646403)
Rake isn't for Ruby any more than Make is for C. It comes from that ecosystem, but you can use it for anything. If you've got a system ruby installed, you've probably also got rake.
Re:Advice to my younger self: become allergic to the churn by davidjnelson on Thursday August 08, 2019 @01:52PM (#20646797)
Exactly. Remember in 2010 before grunt a lot of us were using maven to build single page JavaScript apps? That was pretty funny in retrospect :-) The creator of angular created the precursor to the karma test runner, called jstestdriver, which was a maven plugin ;-) It worked though! We built a single page app with tdd using it at Autodesk.
Re:Advice to my younger self: become allergic to the churn by yogthos on Thursday August 08, 2019 @11:10AM (#20645269)
You don't have to throw the baby out with the bath water to have sanity. Clojure targets both the JVM and Js runtimes, and you can leverage all the existing ecosystem while using a much better language and tooling. You can even use VS Code for Clojure development, it works great. Here's what this all looks like in practice

https://github.com/ClojureTO/JS-Workshop

Re:Advice to my younger self: become allergic to the churn by mighty_bander on Thursday August 08, 2019 @12:20PM (#20645897)
Having started with the MS stack way back in the old days of their Hegemony, I always felt like make was doing something that I shouldn't have to think about.

I'm curious about VSCode - why that, and not Visual Studio or another full-featured IDE? I've gone from IDE to vim and back, and I have to admit with great sadness that the various little gimmicks an IDE provides (without hand-configuring the damn thing!) make it worth it, particularly since they all allow for vim keybindings to one degree or another.

Re:Advice to my younger self: become allergic to the churn by galangalalgol on Thursday August 08, 2019 @12:46PM (#20646125)
I have developed c++ with vim and visual studio for a couple decades. I recently made the switch to vscode from vim and i like it even better than studio. Its snappier and it integrates with my vim workflow well so i dont have to do either or.
Re:Advice to my younger self: become allergic to the churn by wolco on Thursday August 08, 2019 @01:33PM (#20646578)
I don't see the benefit of switch from sublime to vscode. What am I missing? Does vscode offer something different?
Re:Advice to my younger self: become allergic to the churn by umvi on Thursday August 08, 2019 @03:15PM (#20647611)
Better git and debugging integration, mainly. I use VSCode with the Sublime Text extension[1] and honestly it feels almost exactly like sublime, but with better git and debugging integration.

[1] https://marketplace.visualstudio.com/items?itemName=ms-vscod...

Re:Advice to my younger self: become allergic to the churn by mighty_bander on Thursday August 08, 2019 @02:46PM (#20647353)
I'm not a sublime user, so I can't say why, but a couple of JS devs in my office switched from sublime to VS Code. I'm a little surprised by this to be honest, and I haven't interrogated them too thoroughly about why, since I'm not especially interested in either; you might want to give it a try, however.
Re:Advice to my younger self: become allergic to the churn by SomeOldThrow on Thursday August 08, 2019 @10:21AM (#20644832)
> don't just rip on random scripting languages that have been around for 25 years

Where do you see that?

My point being: I imagine you could avoid this just fine with javascript. I don’t see this as a technical issue so much as a cultural one—we gave up on vetting our dep trees.

Re:Advice to my younger self: become allergic to the churn by kd5bjo on Thursday August 08, 2019 @09:39AM (#20644416)
>I personally hate Make, it's burned me too many times.

I’d be interested in hearing about the problems Make has caused you— Whenever I’ve needed to write or edit a makefile, it’s been a pain looking up the relevant details in the manual, but nothing as severe as what you seem to be implying. Have I just been lucky, working with less complicated projects, or something else?

Re:Advice to my younger self: become allergic to the churn by umvi on Thursday August 08, 2019 @09:52AM (#20644534)
> I’d be interested in hearing about the problems Make has caused you

The main problem that kept burning me was that I'd have a "dirty" build when I thought I had a clean one or an incorrect one when I thought I had a correct one. It was super hard to get the dependency graph correct because developers were creating files left and right but would only update the Makefile just enough to get it building (and forget to add new header files to the list of headers, etc) so I had little confidence in incremental builds and was always building from the ground up.

CMake's generated build systems always have correct dependency graphs (i.e. it will only rebuild the bare minimum when you touch a given file) and I've always had complete confidence that my build is clean (since I just created a fresh directory) and that my incremental builds are correct.

Re:Advice to my younger self: become allergic to the churn by deng on Thursday August 08, 2019 @10:29AM (#20644904)
> and forget to add new header files to the list of headers

This is why gcc/clang have the option to generate Makefiles for the header dependencies for you. Maintaining these yourself is a hopeless effort.

Re:Advice to my younger self: become allergic to the churn by kd5bjo on Thursday August 08, 2019 @10:00AM (#20644630)
That makes a lot of sense. Setting up automatic dependency detection is what finally made Make click for me, and it’s not the most straightforward process to get right. How does CMake detect the files that a given product depends on; does it have language-specific dependency detection or something else?
Re:Advice to my younger self: become allergic to the churn by umvi on Thursday August 08, 2019 @10:29AM (#20644911)
> How does CMake detect the files that a given product depends on; does it have language-specific dependency detection or something else?

Well actually, CMake is a build system generator - and the default build system it generates is Unix Makefiles. So I assume CMake generates Makefiles with the appropriate automatic dependency detection baked in, I'm not sure.

The important part was that it eliminated human error on our team and we haven't had dependency graph problems since.

Re:Advice to my younger self: become allergic to the churn by deng on Thursday August 08, 2019 @10:50AM (#20645091)
CMake has its own dependency scanner for C/C++. Look for a file 'depend.make' and you'll see the header dependencies that CMake has detected, minus the headers that CMake thinks are system headers.
Re:Advice to my younger self: become allergic to the churn by leggomylibro on Thursday August 08, 2019 @09:44AM (#20644469)
Sometimes you can make mistakes which delete files, but you should keep development files backed up in some capacity. Still, spot the bug here:

    AS_SRC = main.S util.s
    OBJ = $(AS_SRC: .S=.o)
    [...]
    clean:
        rm -f $(OBJ)
Re:Advice to my younger self: become allergic to the churn by kd5bjo on Thursday August 08, 2019 @09:54AM (#20644563)
The source files with a lower-case extension aren’t getting their file names translated and are passed straight through into OBJ unchanged.

Granted, knowing that there’s an error here helped greatly in spotting it; there’s a good chance I would have run the incorrect makefile at least once before investigating.

Re:Advice to my younger self: become allergic to the churn by rootlocus on Thursday August 08, 2019 @09:48AM (#20644504)
Whatever the bug, git reset is the solution.
Re:Advice to my younger self: become allergic to the churn by msluyter on Thursday August 08, 2019 @11:08AM (#20645255)
Not the original parent, but the problem I've noticed most recently with make is when people use it to orchestrate building/running docker containers. I've seen several cases where containers will be pulled/rebuilt on every invocation (even if they don't need to be) because there's no file based dependency to indicate they're actually up to date. While docker's layer caching helps with this, it still can add a fair bit of time in some cases.

I've worked around that in the past by creating empty "target files" that are created when a given target is built and which dependencies rely on, but it's not a perfect solution.

I've looked around for a make alternative, but although I like rake, I don't really use Ruby these days, and so dealing with RVM/rbenv and whatnot is sort of a pain and not worth the effort over make.

Re:Advice to my younger self: become allergic to the churn by mijoharas on Thursday August 08, 2019 @03:22PM (#20647682)
> I personally hate Make, it's burned me too many times. Now I use CMake, and I haven't been burned in years.

Could you elaborate on how you've been burned by make? Because my experience is the exact opposite of yours. I shudder to remember some of the cmake I've had to deal with.

Re:Advice to my younger self: become allergic to the churn by meuk on Thursday August 08, 2019 @11:29AM (#20645437)
Hm, I'm not a fan of Cmake. I like how simple and clean Make is. In my experience it works more often than Cmake, and if not, I can usually debug it. Cmake seems like an overengineered beast to me. But I probably haven't 'grokked' it yet.
Re:Advice to my younger self: become allergic to the churn by umvi on Thursday August 08, 2019 @11:58AM (#20645700)
I'm not a huge fan of CMake's syntax, but the thing that sold me (i.e. the "killer feature") was how easy it was to setup out-of-source builds[1].

The ability to have the entire build/build artifacts in a directory completely standalone from the source directories was a huge win.

Because for me, that meant I could have 3 separate build directories - one for my optimized ARM builds, one for my debug (-g -O0) ARM builds, and one for my x86 unit test/coverage builds.

If I modified one file, I didn't need to re-spin 3 clean builds - I just could hop into the one or more build directory I was interested in and incrementally update the builds. Plus, out-of-source builds make building clean as easy as `rm -rf build/` instead of hoping that `make clean` has all the right pattern matching and subdirectory listings to truly scrub the build artifacts.

[1] https://cgold.readthedocs.io/en/latest/tutorials/out-of-sour...

Re:Advice to my younger self: become allergic to the churn by babyloneleven on Thursday August 08, 2019 @10:00PM (#20650729)
VSCode (and Atom) feels like an Emacs with Javascript instead of Lisp anyway