r/javascript • • Sep 23 '19

You might not need a framework

https://medium.com/@pljeskavicica/you-might-not-need-a-framework-79444bda50d2
70 Upvotes

129 comments sorted by

View all comments

Show parent comments

26

u/name_was_taken Sep 23 '19

As a Junior dev, I wrote that framework. It fit me like a glove, and I couldn't understand why others couldn't understand it, even after I explained it to them. 1 other guy was able to get things done with it, but other devs in the company either couldn't or wouldn't. It's what happens when you hire a "junior developer" and then tell him to rewrite the entire admin system. It worked well, and for years, but it was nearly impossible for anyone other than myself to maintain.

I was *so* happy that they ended up deciding to rewrite the entire system, and I ended up leaving right as they were finishing that project. If it was still running, I'd be ashamed it of every time I thought of it.

10

u/Silhouette Sep 23 '19

But the problem there wasn't writing the framework, it was asking someone junior to write the framework. We were all juniors once, but you don't ask the newbie to do build some of the most important and long-lived aspects of an important system -- unless they have enough help from more skilled and experienced mentors, so it can also be a learning experience for them while still getting decent results.

11

u/name_was_taken Sep 23 '19

I think they were *both* problems, the junior-ness and the custom framework.

A framework is something that needs a *lot* of thought put into it to make sure that it's easy, powerful, and intuitive for most developers. I don't think it's likely that a single person will produce a framework like that, and I think it's only slightly more likely that a small team will do that.

There are so many *great* frameworks now that I'm firmly of the belief that a team should use an existing framework and create addons for it to customize it to their needs unless they have very, very specific and hard-to-accomplish needs.

2

u/Silhouette Sep 23 '19

A framework is something that needs a lot of thought put into it to make sure that it's easy, powerful, and intuitive for most developers.

That depends on the scope of the framework. If you're talking about something with

  • a suitable data model separated from presentation

  • rendering various data from (or derived from) that underlying data model

  • a suitable event model to support interactions

then that's not necessary very complicated at all. You can write a simple implementation of those things at the start of a new project, tailored to that project's specific requirements, in a few hours right at the start, and that includes clean and fully documented interfaces, a matching structure for your test suite, and getting everyone on the project up to speed on the parts they weren't writing themselves.

IME for front-end web work it's often worth using a declarative rendering library these days for the actual DOM updating stage. There might be a few other go-to dependencies as well if we're doing things like i18n or manipulating tricky data like dates and times.

I'll note that at this point we're getting into semantics without defining our terms, so there is a risk of talking at cross-purposes here. Maybe what you expect in something that you would consider a framework is a lot broader in scope than my equivalent and that's where the different perspectives come from.

I don't think it's likely that a single person will produce a framework like that, and I think it's only slightly more likely that a small team will do that.

Whereas I have seen quite a few examples of both of those things happening, often with excellent results and with no significant problems, and in some cases maintained successfully for many years afterwards. The risks so often described by framework advocates in discussions like this rarely manifested in practice.

There are so many great frameworks now that I'm firmly of the belief that a team should use an existing framework and create addons for it to customize it to their needs unless they have very, very specific and hard-to-accomplish needs.

The trouble with that argument is that large, long-lived projects often do end up with specific needs and those often can become hard to accomplish within the structure dictated by the framework.