Live data from Hacker News

Software development topics I've changed my mind on

chriskiehl.com

491–500 of 788 posts

Re: Software development topics I've changed my mind on

#491
post #457

Earlier quoted context omitted.

If there is anyone here who has time to explain to me (or link articles about) why functional components and hooks are considered to be better than class components, please enlighten me. Up until roughly 4-5 years ago I was doing small front-end React apps on the side (I'm a backend engineer) and was feeling very productive with class components. They made sense to me, concerns were nicely separated, and I felt I cou…

I only knew React until my current job, which uses Vue. I'd strongly recommend trying a framework other than React for your next project. After you're past the learning curve, it's much more intuitive.

> I'd strongly recommend trying a framework other than React for your next project.

This gave me a good chuckle (if you read it as next.js)

Re: Software development topics I've changed my mind on

#492

> Frontend development is a nightmare world of Kafkaesque awfulness I no longer enjoy > Objects are extremely good at what they're good at. Blind devotion to functional is dumb. Blind devotion to anything in engineering is dumb, but if you go full functional on the frontend it’s definitely not “Kafkaesque”

> if you go full functional on the frontend it’s definitely not “Kafkaesque”

This has been my experience too. Elm on the frontend is easy and delightful.

Re: Software development topics I've changed my mind on

#493
post #478

Earlier quoted context omitted.

This. Engineers are hired to solve problems. Sometimes beautiful code and clean architecture are part of the requirements to solve the problem at hand. Sometimes… they aren’t.

Beauty is in the eye of the beholder. I would argue you didn't use design patterns enough. Beautiful code and clean architecture is a rabbit hole. Code should be clean enough to communicate. As long as team understand and accepts the risk, it is good enough.

I equate design patterns with language deficiencies, so not sure what to answer. I know 'beautiful' won't be part of the response, though.

Code is a liability, unless you're selling it. The less you have of it, the better off you are in the long run. That doesn't mean I don't agree that it should be clean, as an engineer. As a customer making a decision whether to buy a product or not, I couldn't care less. If you're hunting for product-market fit, you can do it with clean code, nothing is stopping you, except perhaps if there's enough runway to make paycheck.

Re: Software development topics I've changed my mind on

#494
post #168

>Frontend development is a nightmare world of Kafkaesque awfulness I no longer enjoy As a backend/systems engineer I recently had to look at a React + Typescript + MobX app from 2019/2020. It is true that that some things, especially the webpack config and Typescript loading, were outdated but the overall design and architecture of the app was still understandable and modern. With some help from ChatGPT it took very…

If there is anyone here who has time to explain to me (or link articles about) why functional components and hooks are considered to be better than class components, please enlighten me. Up until roughly 4-5 years ago I was doing small front-end React apps on the side (I'm a backend engineer) and was feeling very productive with class components. They made sense to me, concerns were nicely separated, and I felt I cou…

> If there is anyone here who has time to explain to me (or link articles about) why functional components and hooks are considered to be better than class components, please enlighten me.

Static evaluation of which instance properties are being used in a class instance is much harder than evaluating which variables are being referenced in a function. There's no need to worry about calling context or binding instance methods. Functions minify much better because you don't have to worry about preserving long property names like componentDidUpdate. With class components, sharing logic involving state between components required either functions taking a state setter and whatever slice of state you needed, or--more commonly--higher order components. With function components and hooks, the code responsible for initializing and updating state isn't tied to an instance. Now you can share that code with a plain function without needing to pass an entire slice of state and an update function into it. Instead of needing to shove all your update-related code into the same componentDidUpdate or componentWillUnmount methods, you now split them into different calls to useEffect.

> Suddenly everything is intermingled in one function and we're using side effects to react to changes and manipulate state. I could no longer understand when which code was executed, and especially following and manipulating state became impossible for me.

If you're talking about using useEffect to respond to changes by setting state: that's almost always a code smell and sounds like trying to sync state with props. This was an anti-pattern long before hooks, and was called out explicitly in the docs.

Having worked on a lot of class components and function components, class components offer a lot more opportunities for bugs which can't be statically prevented. On the other hand, most of these bugs can be caught in function components and hooks by a linter, or are just prevented entirely by the design. A frequent question which came up during the class component era was what code belonged in the class's constructor, componentWillMount, or componentDidMount methods. This always came with caveats, because generally component initialization isn't something developers should be thinking about because it can happen many times before anything appears on screen. Function components offer fewer opportunities for this. The useEffect hook forces people to think purely in terms of running effects in response to changes in variables which have been closed over, and about what things need to be done to clean up after the effect has run. Responding to user events (e.g. onClick) is almost exactly the same as it's always been other than cosmetic changes.

I'm not sure how everything being in a single function offers worse organization than everything being within a class. Instead of instance properties you have variables. Instead of methods you have inner functions.

Re: Software development topics I've changed my mind on

#495
> ORMs are the devil in all languages and all implementations. Just write the damn SQL

What are the main issues people run into with ORMs? I've used Django ORM for years and written some relatively large applications using it without much problems. Complex queries and aggregations can result in quite hairy code though.

Re: Software development topics I've changed my mind on

#496

> Most programming should be done long before a single line of code is written Nah. I (16+ years developer) prefer to iteratively go between coding and designing. It happens way too often that when you're coding, you stumble across something that makes you go "oh f me, that would NEVER work", which forces you to approach a problem entirely differently. Quite often you also have eureka moments with better solutions th…

> I (16+ years developer) prefer to iteratively go between coding and designing

I have an extra ten years on you and couldn't agree more.

There are two jokes:

- A few months of programming can save weeks of design.

- A few months of design can save weeks of programming.

Inexperience is thinking that only one of these jokes is grounded in truth.

Recognizing which kind of situation you're in is an imperfect art, and incremental work that interleaves design with implementation is a hedge against being wrong.

Re: Software development topics I've changed my mind on

#497
post #317

"93%, maybe 95.2%, of project managers, could disappear tomorrow to either no effect or a net gain in efficiency. (this estimate is up from 4 years ago)" This made me laugh it is so true. My last big project at "Big Co" ( Knee surgery robot ) My small group went through 4 project managers - just for our small team. The entire project had probably 20. While a few where enjoyable to work with, there was very little val…

At $PREVIOUS_JOB, the team I was on worked the best when we had no manager. Or rather, we had a director (who should not have been managing us directly) meet with us once a week to tell us "here's what we're headed ... good?" and let us go work in quiet until the next meeting (or meet with us sooner if something really important cropped up).

Re: Software development topics I've changed my mind on

#498
post #83

> People who stress over code style, lining You can do it whatever way you want but match the style of the project. I've worked on too many projects where someone decides their way is best and you end up with a mix of everything. If you want to change the code style, okay, but change it everywhere and don't forget to test everything you've changed. > Frontend development is a nightmare But is it weird I kind of enjoy…

I've grown to be a big fan of opinionated linters like gofmt, rustfmt, black etc. They avoid so much time spent disagreeing about code formatting and personal preferences. Instead engineers can do mutual grumbling sessions about weird formatting choices they see it do, and move on.

If I didn't want to have opinions, I would join a cult.

Re: Software development topics I've changed my mind on

#499
In response to "There is no pride in managing or understanding complexity.", I posit the following based on my experience:

Understanding and managing complexity is one of the first steps required in order to eliminate complexity. Some of the greatest achievements in my software development career have been instances where I carefully pulled apart inscruitable solutions, often short-term and built in desperation, and re-constituted them into well tested and much less complex solutions which were more understandable by devs and users.

I agree with most of Chris' observations and enjoyed reading his insights. Makes me want to do the same!

Re: Software development topics I've changed my mind on

#500
post #168

>Frontend development is a nightmare world of Kafkaesque awfulness I no longer enjoy As a backend/systems engineer I recently had to look at a React + Typescript + MobX app from 2019/2020. It is true that that some things, especially the webpack config and Typescript loading, were outdated but the overall design and architecture of the app was still understandable and modern. With some help from ChatGPT it took very…

While I completely understand OP's sentiment, after literal decades of web/front-end development, I never quite grasped the depth of disdain for Javascript or CSS until being on a team where more than the same 2 or 3 people were actively coding in them.
Post reply on HN