Better HN
topnewbestaskshowjobs
Log inSign up

hakunin

2,515 karma · joined Mar 4, 2010 (16y ago) · 549 submissions

https://max.engineer, mastodon:ruby.social/@maxim, x.com/hakunin, bsky.app/profile/max.engineer

meet.hn/city/43.1009031,-75.2326641/City-of-Utica

---

Submissions

comment 3y ago · link · parent

Arguably, the opposite is true. The view is more washed out across the stack if back-end supplies generic fields, and front-end decides how to use them. Now you no longer know who is responsible for which decisions, and have to look for them everywhere in the stack.

If back-end provides the entirety of data to build the page, then you limit front-end decisions to UX based on the specific data, and no longer allow them to pull in new functionality or foundational business logic over to their side.

comment 3y ago · link · parent

In case of a complete redesign, yes you're right. With a generic API you will have about as much trouble writing the redesign as you did the original design.

In practice, a complete redesign is an incredibly rare event, and a good problem to have. Usually design of individual pages and layouts undergoes gradual, incremental changes, driven by real needs.

A redesign that requires front-end restructuring to such an extent that the data supplied is no longer sufficient should probably involve backend collaboration. Otherwise, you're tasking your backend team with building a generic site builder, which is much harder than a specific backend for your frontend.

comment 3y ago · link · parent

The article doesn't disagree with your second paragraph. It encourages to treat each "page" as a unique snowflake, including forms in it. I should probably do a better job to discourage consistency and standardization of these json structures. This is addressed in another one of my comments if you search for "my bad".

comment 3y ago · link · parent

The whole point is that when you need companyName for another thing, you should create a parameter `anotherThing` and backend will set companyName into it as well. It's designed to make it very weird to _not_ do that, so that you don't do that.

comment 3y ago · link · parent

In a way, this article tries to bring the alignment between the frontend and backend closer to the full stack days, while also acknowledging the increased complexity of the front-end, that may be deserving of its own team focused on great UX.

comment 3y ago · link · parent

While this may be true to some extent, I think front end has plenty to deal with even if you do ship them the exact data they need.

Primarily, this philosophy encourages you to maintain a strict connection between needed use cases, and the code that enables them. Once that connection is severed, your code expands beyond the required use cases, and you end having to maintain support for phantom/theoretical use cases.

comment 3y ago · link · parent

It may totally be my bad for not making this part clearer in the article, but these structures are never meant to be fed into something that can automatically produce a UI. They are not meant to be consistent.

The way I've been describing this lately — the json structure should come from you squinting at the page and seeing approximately what needs to be on it, and creating as-flat-as-possible way of sending it over, that makes it clear enough what each field is for, but not so granular as to be automatable.

If you have a designer in your company, I've been increasingly preferring to use their terminology to name fields. If page has "cards", "navigations", "banners" whatever designer calls them, call them the same way in JSON. This is a good middle ground. It makes sure that back-end passes what front-end needs, while at the same time making sure that front-end doesn't get the wrong idea that their framework can dictate and accept this json structure directly.

So if a full JSON-based language would allow you to customize every page element in any way you like, this approach only lets you to send over decisions about this page, using a json payload specifically for this page and the ways it can change, no more no less. You cannot add an arbitrary box or an arbitrary section in json, and expect it to appear.

comment 3y ago · link · parent

> This article advocates for another extreme that I've also seen at work. They invented some UI language in JSON

This is called server-driven UI, and not what the article is advocating. I try to make that distinction by calling the whole practice server-informed UI, rather than server-driven UI. The article is meant to be advocating almost exactly what you wrote in the 3rd paragraph.

comment 3y ago · link · parent

One extra thing I have confirmed after writing this article: it's usually a bad idea to reuse back-end data in multiple places on the front-end.

If you think about functions or object constructors in general, it kind of makes sense. One of the most important architectural practices I've ever discovered is: don't pass in the parameters that you have, pass in the parameters that the function needs. So if you have companyName, and you are constructing a page that has a title, you shouldn't pass it companyName: companyName, you should pass it pageTitle: companyName (parameter name: parameter value). It's crucial that the parameter is named after what is needed, not what you have. This is kind of the essence of what the article is suggesting.

If your front-end is reusing a lot of fields from back-end, it's likely that you're passing it what you have in your database/resources, and not what it needs — fields for constructing the UI, configuring the views. Moreover, I rarely see front-end going through the exercise of defining exactly what they need. The article encourages more of that.

Once the front-end starts reusing the generic back-end fields everywhere, you lose track of your use-cases. Everything you ship from the back-end becomes potentially important for mysterious reasons that not even front-end can easily understand anymore. Front-end already built complex dependency trees based on these generic fields. If you actually untangle these trees, it might turn out that your front-end can only exist in 5 different "modes", but you can no longer see that in the tangled mess. You can no longer streamline and optimize these 5 configurations.

So to summarize: pass what is needed, not what you have is a good general architectural rule that's also applicable between back-end and front-end.

comment 3y ago · link · parent

Author here.

We do this for SPA. The POST can be supported just like you explained. Then you can either reload the "page" to see that the checkbox is checked, because backend will include that as part of the page, or (as an optimization) reload just that checkbox if you created a specialized resource for it. The entire page is still there for you to fetch upon transitions.

Among pages, you will still need a few individualized resources sprinkled around for optimizations/reloads/fragment-paginations. The difference between that and a complete API is that they will be entirely design driven. If a table needs paginating, and is built with data from multiple resources, you will not provide 2 resources, and expect front-end to paginate and glue them together. Instead, you provide a complete paginated resource for this table, where data is ready to be displayed as-is.

comment 3y ago · link · parent

I find a big iPad Pro comes pretty close to the same effect.

comment 3y ago · link · parent

Are you asking for good faith, or just faith? A million debunkable/explainable-with-something-else cases is equivalent to zero cases. I mostly see people ask for one, single, hard piece of evidence. In all of the millions. Something that can't be explained much more plausibly.

comment 3y ago · link · parent

I agree with this, and some of this does come up in code review questions (point #4). Sometimes you can already predict a question or predict a mistake someone is likely to make, especially knowing your colleagues/context. In those cases a preemptive comment makes sense, but only if you couldn't somehow define that mistake/misconception out of existence in the code itself.

comment 3y ago · link · parent

…then I would suggest altering the code to speak for itself. If you can't do that any further, refer to the 4 reasons to leave a comment.

comment 3y ago · link · parent

Pasting again my 4 reasons to leave a code comment:

1. An odd business requirement (share the origin story)

2. It took research (summarize with links)

3. Multiple options were considered (justify decision)

4. Question in a code review (answer in a comment)

And the article on how/what/why in code: https://max.engineer/maintainable-code

comment 3y ago · link · parent

https://max.engineer

Hosted by amazingly convenient https://blot.im.

Articles on software architecture. I'm also looking to make new friends to discuss these topics. Working remotely in my 30s from a not-major-city makes this difficult. In my blog there's a place to leave your email if you'd be up for it.

comment 3y ago · link · parent

This doesn’t work in practice due to typically severe time constraints. You cannot expect a business that has 6 days of life left to wait for such an approval process. These things never happen fast.

comment 3y ago · link · parent

It does, but you have to pick up a lot of library-specific knowledge to use it. Here the idea is that you can learn one keyword, and use plain ruby.

409.

Adventures in Ruby-esque type enforcement(max.engineer ↗)

2 points · by hakunin · 3y ago · 2 comments

comment 3y ago · link · parent

Just an anecdote for those curious about a specific experience.

This time I used VSCode for nearly 2 months. Thought it's the end of an era, I'm not coming back to Sublime Text. I decided to push through and customize the configs just right for me, it was really becoming comfortable. Main reason why I wanted to switch is more active dev, more active extension community, and well integrated modern (some ML-backed) code writing and navigation tools.

I was wrong. After all the painstaking customization to bring it close to my ideal experience, while also getting used to things I didn't want to fight, I still had a bad time.

For one, the tab/cursor focus keeps going into weird places. I press a button, like ESC to switch to normal vim mode, and instead it does nothing, or something different, because turns out I'm not in the editor anymore. Keeps happening, maybe my own fault. The nifty AI tools integration is more of a nuisance — they jump in at bad times (with a delay), and their tab/enter functionality is weird, can never get it right. Most of my autocompletes have been unintentional. Maybe my own fault again, but felt super awkward. There is still no good vertical align plugin, despite such an active community (Sublime doesn't have one either, although they have one that gets me a bit closer). The language server stuff that worked badly in Sublime for my language also works badly in VSCode. The extensions, while numerous, are of questionable quality. I tried to stick to just a few well known ones.

After all the effort, I slowly came to realization that I'm back to not really using anything unique to VSCode, sacrificing more than I gained, being surrounded by lots of small moving details everywhere in the UI that make my experience more awkward than helpful, and occasionally getting my cursor stuck in weird parts of UI. I went back to Sublime.

411.

Smart home company Eve bought by multibillion-dollar automation giant ABB(9to5mac.com ↗)

4 points · by hakunin · 3y ago · discuss

comment 3y ago · link · parent

In the beginning of your career, I do think well-timed jumps are very effective. But overall yes, in capitalism (whether you like it or not, this is what we got) the most important skill is getting people to agree/compromise with you. And for people who (for perfectly valid reasons) can't develop this skill, we have institutions such as unions and recruiters that help delegate it somewhat. I don't think standardized non-negotiable tiers of deals are as helpful to us as we seem to think.

comment 3y ago · link · parent

> Lots of big companies have very well-defined salary bands

It's true, but I'm not sure that it's good. That's going back to salary being weird. They are making themselves deliberately inflexible, locking themselves out of potentially good agreements (probably in response to public pressure). Perhaps big names can get away with it. Worth noting that the same "bands" probably don't apply to hiring consulting businesses. Ask yourself why, and how's that different from striking a deal with an individual.

> Companies already know how much they want to pay you

That's not true. They don't know how much they want to pay _you_. They know how much they want to pay an average abstract employee doing the job they vaguely envision in a satisfactory manner. Then when the actual _you_ come in, that abstract employee becomes a concrete advocate for themselves. They'll have to think about you specifically now, and it changes the whole calculus.

comment 3y ago · link · parent

What I saw happen is “we can’t afford you”, not “we can’t go over the number we posted”. I think that’s fine.

comment 3y ago · link · parent

I agree that senior experience is probably important, but also it’s knowing how to negotiate.

What does it mean to be negotiated “fairly”? If you don’t like the rate, you come with a counter proposal, for which ideally you have leverage. The leverage is another job offer you found. If you don’t have leverage, you could negotiate a few other ways but they’re less effective. In the end, if you feel you can’t get a competing offer and you can’t wait, essentially you have to accept the terms, but also you can continue the search, and quit when you find something better. This is why companies don’t like to lowball you - they don’t want you to come in with one foot out the door. So one of those “less effective” ways is to explain honestly how their offer might not be sufficient for you to be able to focus on your work without worrying about rent and food. It’s in the best interest of both of you for you to focus on work.

comment 3y ago · link · parent

That's probably more true for simple products like toasters. For products where each one is almost always unique (has tons of optional choices, details) you can't easily shop around and compare apples to apples. You end up narrowing down to a few _mostly acceptable_ products in your vicinity, and then negotiating among those few.

To add: it's already difficult for a dealer to overcharge because even for complex/unique products we do have stats.

I just don't like the circular dependency of it. Companies follow an industry-wide stat to push all the people into preset salary tiers. The industry-wide stat is based on these same companies. The only way out is when some "rogue" companies allow some "rogue" employees to negotiate, and push the industry upwards.

comment 3y ago · link · parent

I see your point, but not sure if a number up front would be honesty, seems more of a gamble. They need to find a number that's not too low, not too high, for an abstract average human. I've managed to detect a lowball danger fairly early on in my past negotiations, but can't claim that it's easy. That said, maybe knowing their "hedge rate" is a useful tell, even if you don't entirely trust it.

comment 3y ago · link · parent

This is probably going to be controversial.

I find salary to be really weird for many reasons. One of them is that I just can't imagine a sustainable world where salary is proactively offered, raised, etc. I think it necessarily must be negotiated. I say this as a person who spent most of my 20y career negotiating for my salary and hating the process.

It feels attractive on the surface to see a concrete number, kind of like coming to a car website and seeing cars sold at a fixed price, no bargaining. Or kind of like searching for loan refinancing and seeing a bank website show you the standard menu of rates they offer. You just pick from the menu.

However, the issue is that you're probably overpaying for the car, and getting a bad refinance rate every time. And your blanket "salary tier" is probably some safe hedge for the worth you may or may not be bringing. An estimation of vague plans they might have on where you may help.

Shouldn't this be reversed? Shouldn't it be you to tell them what you can do, the plans, explain how much you're worth? How can they know your salary if you haven't told them this stuff yet? Aren't you supposed to be an expert at something? That's just one of a few weirdnesses about salary.

Maybe it depends on a job, and some jobs are really _that_ predictable, but feels like in software dev industry it doesn't add up, except maybe for junior positions.

I used to be in the opposite camp, but nowadays every time I see a concrete salary range listed, it makes me feel silly. We all know that humans running the place can probably decide to pay whatever they want based on how they feel. I can't imagine a situation where they go "sorry, we really think we need you, but our job listing only goes up to this number, oops".

419.

Adventures in Ruby-esque type enforcement(max.engineer ↗)

2 points · by hakunin · 3y ago · discuss

420.

Adventures in Ruby-esque type enforcement(max.engineer ↗)

4 points · by hakunin · 3y ago · discuss

1
131415
19