HNHacker News
TopNewBestAskShowJobs

catwind7

208 karma · joined February 16, 2017

submissionscomments
catwind7··on Stimulus.js 2.0
Yeah, I also want to emphasize (again) that none of this is a criticism of stimulus - the key words / phrases they used two years ago and continue to use are things like "modest" and "augmenting html". Our needs were very different then. I'm not complaining that my hand saw isn't doing the same amount of work as a chain saw.
catwind7··on Stimulus.js 2.0
I don't know enough about which parts of the site you're referring to to say for sure, but stimulus / stimulus-like approaches are perfectly fine for most display-only views even if they're fairly complex.

There are pages in our app where stimulus works great and the UI is fairly complex from a standpoint of the number of strictly user facing behavior (click this, show X, Y, and Z).

The complexity involved in handling form UI is just not very suitable for stimulus from my experience. That said, you can still do a lot in terms of following good programming practices to create something that looks and works great and is reasonably maintainable.

It ultimately comes down to your (and your teams) tolerance and business needs - there's no hard reason we need to stop using stimulus, we've just decided that there are parts of our app where we could make leaps in developer productivity by using something else.

catwind7··on Stimulus.js 2.0
Sure!

One typical example is a component that collects (and displays) education history provided by the user. I'll list out just a few key UI behavior:

* A "read" view which represents a list of containers with titles that show each instance of a users answer (for example, if you provided 5 sets of answers, such as 5 universities you attended, we need to show those 5 in some sort of preview form on the page)

* A button that when clicked opens up a modal which contains multiple "steps" - each step is a small set of form inputs that range from simple ones like date to more complex ones involving search / autocomplete or file uploading.

* A button inside the modal that lets you navigate through the various steps / groups of form inputs.

* A "save" button inside the modal that persists your answers. This closes the modal and shows your set of answers as an instance in the list view (see the first bullet).

* In-line validation errors as the user is filling out each step of the modal

* Messages to notify the user that a modal needs to be opened and completed (Like if the user closed the modal before filling everything out, we want to let them know it's not fully completed).

Where some of the biggest complexity crop up:

* Form input data handling and general state management. As I mentioned, we can have upwards of maybe 20 controls in this component. At minimum, we need to write code to listen to input changes and make sure this new information is kept in sync with both internal component state and other parts of the UI. If you gave us a valid answer, we need to make sure to update the UI to show a checkmark (in the simple case). We also have controls that show or hide based on your answers to other form controls, so we'll need to handle inputs by potentially hiding or showing other inputs.

* Ok, so what if we need to write some UI updating code? Well, updating any part of the UI requires manual DOM manipulation. At minimum, this can be something simple like toggling visibility of an element by adding or removing a class. At worst, this involves appending html template strings (like if we need to show a list of errors on top of the modal) when the user attempts to save bad answers.

* Cross-component communication is difficult. Want to add a subcomponent? And it needs to communicate with the parent? For example, each step in our view is sort of a "sub form" and it needs to talk to the parent "modal" to keep global state - you'll need to roll some basic event handling code between the two.

* Testability. All these DOM changes - how do we test that our component is behaving? At the time we adopted stimulus, there wasn't a standard way of testing our stimulus controller so we've mostly leaned on (expensive) UI integration tests.

Some of this complexity is sort of inherent to forms - forms are complex UI components. There are hosts of libraries in other frameworks for dealing with form inputs alone (in order to cut down on the boilerplate you have to write). For example, formik in react helps cut down on a ton of boilerplate you have to write in order to wire the form control DOM state to react state.

Some of this complexity is also our own doing - we keep A LOT of state in the DOM. If a user blanks out an answer, we need to update the DOM with an additional form control whose value will get passed back to the backend to persist the change in the DB. Moving over to ReactJS won't help us here - this will require changes to our backend vs frontend API's.

However, having to handle the bulk of those DOM changes yourself requires a lot of code, is pretty error prone, and quite hard overall to maintain (as anyone who has rolled apps using vanilla javascript can attest to). StimulusJS doesn't offer many facilities for changing your UI in a declarative way.

Finally, cross-component communication is very common and while there is a number of ways to pass data back and form between stimulus controllers, there isn't really a nice way to do it outside of passing events. This is fine for simple cases, but error prone for our use cases. In reactjs, invoking callbacks that change parent state feels much more straightforward and has been easier to test.

Hope that helps

catwind7··on Stimulus.js 2.0
We adopted stimulusjs a couple of years ago for adding some basic interactivity on our pages and it was a decent tool, but we quickly grew out of it once we started adding more complex (form based) front-end behavior involving lots of state changes. We're currently trying to migrate a significant amount of stimulus code over to react.

Not knocking on stimulusjs, but just be wary that it does not grow well with increasing client side complexity. You'll end up writing a lot of javascript boilerplate / DOM manipulation code / custom state management components. From my experience, it's a nice lightweight tool for when you:

1. Just need to add some light interactivity (toggling visibility of components, any basic view filtering) that do not involve a lot of logic 2. Don't need j.s unit tests (stimulus has not been the most testable tool - we lean mostly on integration tests).

catwind7··on Blogging vs. Blog Setups
Hahahaha and here I'am, writing my own static site generator this weekend. I promise I'll use it to write more!
catwind7··on Ask HN: Essential skill needed to be a programmer?
I think this is exactly why "communication" crops up so often and why "talk to your customers" is the number one advice for founders.

I think it's a really underrated / underinvested skill in the industry (from my experience) with a lot of complexity. For example, there's so many levels of listening. It's one thing to understand what someone is saying but yet another to pick up on meta messages (facial expression / body language) that signal true thoughts / feelings.

catwind7··on Ask HN: Essential skill needed to be a programmer?
Yeah - I think that drive to learn and improve also directly relates to what peter norvig touches on.

I think a big part of _keeping_ that drive if you have it (or cultivating that drive if you don't) requires a sort of being able to experience delight / happiness from learning new things. Even the little things.

Like today, I learned a tiny shortcut in writing rails routes. Not a huge game changer obviously, but little things like that make me smile!

catwind7··on Ask HN: Essential skill needed to be a programmer?
I had a friend who said he would never consider this type of work because there's way too much sitting... and I'm like wow that's actually one of the _easiest_ problems to solve!
catwind7··on Ask HN: Essential skill needed to be a programmer?
Yeah, there are so many different motivators for work. I really enjoy programming as a hobby, but I also wish we would stop treating that as if it's a pre-req to doing good work.

You can't be effective at your job if your manager sucks and you work with rude coworkers.

catwind7··on Ask HN: Essential skill needed to be a programmer?
I've noticed myself scrolling farther and farther down search results. There's so much SEO'd garbage at the top of the fold now.
catwind7··on Ask HN: Essential skill needed to be a programmer?
Ah, I see. Thank you for clarifying that. That book sounds interesting, I'll check it out.

Thanks for taking the time to engage! I've also learned quite a bit reading through everyone's responses.

catwind7··on Ask HN: Essential skill needed to be a programmer?
There's also another side of disgust that motivates you to improve things. Some of my favorite work were born out of sheer anger
catwind7··on Ask HN: Essential skill needed to be a programmer?
> remind myself I've been able to solve pretty much any problem I've faced.

I think this confidence is really important and part of it seems to come from having solved lots of problems in the past / working through frustrating periods. That's why "write lots of programs" is still my favorite piece of advice because it's a lot like "show up to the gym" if you want to get stronger.

catwind7··on Ask HN: Essential skill needed to be a programmer?
Put another way, it's easier to write a throwaway program that works once but how do you make it continue to work and serve needs over some period of time? I think part of it is knowledge of principles like you said, but I also don't think there's a substitute for experience because the real world is messy and principles sometimes need to be intentionally broken.
catwind7··on Ask HN: Essential skill needed to be a programmer?
This is so easy to forget. I think when we're in the trenches it's quite hard to pull back and view what you're doing as means to an end and the means (libraries, frameworks) change constantly.

I think it's also difficult in practice because it feels good to master things in general. It's a nice feeling to know that you know a system inside and out, so detaching from that is going to be hard no matter what especially if you've invested quite a bit of your life into it

catwind7··on Ask HN: Essential skill needed to be a programmer?
I totally agree - I think I'm probably coming off as disagreeing with you though.

I think the difference for me is that the importance of communication for solo programming is a bit of a sliding scale depending on what your goals are. There aren't many exceptions when you work on a team. When I use the word importance, I'm tying it to a notion of necessity in relation to some goal. Team goals trump individual goals in organizations.

if you have no intention of making your code available for someone else to read / use / modify, the benefit for having readable code is really for yourself in six months and nobody else.

you also don't need to tell anyone what you're doing, so being able to clearly / succinctly explain what it is and why it's useful isn't a necessity. Does that make it an unimportant skill? No, it's just that the goals are different

catwind7··on Ask HN: Essential skill needed to be a programmer?
i've come to appreciate how useful it is to just remember basic stuff from stlib instead of having to look things up. Makes getting into flow much easier.
catwind7··on Ask HN: Essential skill needed to be a programmer?
I think some of my favorite programmers exhibit this quality in spades
catwind7··on Ask HN: Essential skill needed to be a programmer?
when I get frustrated that's often a cue for me to take a break haha. It's been a nice way to deal with frustration for me.
catwind7··on Ask HN: Essential skill needed to be a programmer?
reminds me of http://threevirtues.com/
catwind7··on Ask HN: Essential skill needed to be a programmer?
I intended it to be pretty open ended. Mostly interested in skills that are useful for _both_ solo and team work. I agree that there are some things that can be very useful for team work that are not as essential for solo work when it comes to programming. For example, being able to justify technical decisions to higher ups. Lots of communication skills are essential for teamwork.
catwind7··on Ask HN: Essential skill needed to be a programmer?
literally true!

I agree - so much of our time is spent coming up with working models of systems

catwind7··on Ask HN: I'm a terrible developer, what now?
> I've come to realize I'm not very good at it and thats unlikely to change.

I may be wrong here but my impression from this comment is that you _want_ to improve, have a sense of where you can improve, but you have not found an improvement plan that works for you.

I can relate to the frustration of seemingly not being able to move the needle for your skills. One thing that has helped me over the years is adopting more effective learning strategies.

I highly recommend the books "A Mind for Numbers" by barbara oakley and "5 elements of effective thinking" (don't remember the authors) for some ideas on how to deepen your knowledge (so that you don't just feel like you possess purely surface level knowledge).

catwind7··on Is TDD Dead? (2014)
> One of the biggest problems with TDD is that it kind of relies on having clearly defined specifications

That's very true. I think it's an easier sell when you have a relatively stable set of specifications (accounting software core logic) where the rate of change is low but the cost of regressions is high. But I think you can tackle the same problem space with good unit tests instead of enforcing a test-first mindset.

In situations where work is vague, spending more upfront time thinking about architecture is much more useful (design docs?) imo. Having a set of units for a crappy, entangled system is pretty costly.

catwind7··on Is TDD Dead? (2014)
I've found that the strictness imposed by TDD (write test first) has been valuable in learning how to write good tests and understanding the concept of "testability".

If you've never tried TDD for a real project, I still highly recommend it for those reasons alone. It may not be your cup of tea and it may end up being extremely unproductive for you, but hey at least it'll give you some experience-backed opinions for this never-ending debate :)

catwind7··on Developer won’t get hit by a bus, they’ll get hired by Netflix
I've been meaning to checkout rust/golang for some time now - might pick up a book on it. I've worked primarily with rails the past few years and at times it feels like some of our biggest maintainability issues are the direct result of certain third party packages we reached for to solve boilerplate.

Not to knock on using libraries or anything like that, but we've definitely felt the pain of putting tools / convenience ahead of architecture.

catwind7··on Developer won’t get hit by a bus, they’ll get hired by Netflix
> Everything gets a lot easier if you select the right software and framework, primarily if you use Ruby on Rails. Rails itself is a full-stack framework that has a best practice for every piece of a web application. If you are committed to doing things “the Rails way,” you cut the total cost of ownership by A LOT.

Rails has an incredibly large community but I think this statement would be equally true for any tool you're well versed in

catwind7··on First Ever Image of a Multi-Planet System Around a Sun-Like Star Captured by ESO
yikes - that's true, we could still move life beyond earth and still never meet another civ. I didn't realize this at first but I was conflating the two
catwind7··on First Ever Image of a Multi-Planet System Around a Sun-Like Star Captured by ESO
that's really sad :(. 300 light years ... gonna take a while. maybe the filter is space travel - no civilization is able to amass enough energy to go those distances
catwind7··on First Ever Image of a Multi-Planet System Around a Sun-Like Star Captured by ESO
that said, the likelihood of there being _no_ filter is still lower than the others.

if we detect life so near to us and _yet_ we still have yet to encounter life from another planet means there's likely still _some_ kind of filter. So I don't think the likelihood of no filter is high if we detect life

← PreviousPage 2 of 4Next →