News for hackers. Stuff that matters.
Re:Why I no longer use MVC frameworks by nostrademons on Tuesday December 15, 2015 @06:07PM (#10741139)
A lot of hate for this guy here that is, IMHO, unjustified. What he did isn't insane. It's not exactly what I would've done, but then, the meta-lesson from this post is that you don't have to do what everyone else is doing.

The comment here about the point of MVC frameworks being for communication is true. However, this guy isn't working on a frontend dev team. He is a consultant doing primarily server-side development, building a landing page for his business. The code he wrote in this entry probably took him all of about 15 minutes. Meanwhile, many of the comments here say that he should've used Jade, or Angular, or Knockout, or Flask, or Jinja. How long would it take him to get up-to-speed on that? That's time he doesn't get back, which won't be spent working on the things that make money for him.

I wrote a similar build script to try out different landing page concepts - in about an hour, I'd wired up Babel, PreCSS, and Marky-Markdown so I could write all my marketing text & tutorials in Markdown, my CSS in CSSNext, and have a common page layout for everything. It's a lot cheaper than the MVP generators on the net, it's easier to change and gives me more flexibility than Bootstrap, and it's a lot less code than writing everything from scratch in HTML. No, it bears no resemblance to any living framework, and no, it's probably not intelligible or sane to any other frontend developer. However, it doesn't have to be. If I get to the point where I'm hiring frontend devs, they'll be rewriting everything anyway in the framework of their choice, so my opinion doesn't matter anyways, and in the meantime, the landing page and product description helped me discover that I didn't need a frontend component at all, at least for an initial version.

Optimize for the problem you have, not for the problem other people have. And when other people come up with a solution that's different from what you would've done, try to see how their problem differs rather than saying they're stupid.

Re:Why I no longer use MVC frameworks by Lazare on Tuesday December 15, 2015 @06:24PM (#10741238)
> A lot of hate for this guy here that is, IMHO, unjustified.

I disagree; I don't think there's a lot of "hate" just some gentle mockery.

> What he did isn't insane. It's not exactly what I would've done, but then, the meta-lesson from this post is that you don't have to do what everyone else is doing.

The thing is, he did do exactly what everyone else is doing, just a bit worse than most of the popular solutions.

> And when other people come up with a solution that's different from what you would've done, try to see how their problem differs rather than saying they're stupid.

But his problem didn't differ. He had the same problem everyone else has, and ended up re-inventing the same solution everyone else is using.

If you're working on the web, you'll need to turn data into HTML, and his solution was a JS function to turn data into HTML; it's the single most common problem and the single most obvious solution pattern. The issue is that there are already good solutions for his exact problem, and his isn't one of them.

Re:Why I no longer use MVC frameworks by nostrademons on Tuesday December 15, 2015 @06:43PM (#10741334)
Say you have two options:

1. Spend an hour writing 50 lines of code.

2. Spend 3 hours identifying a framework that includes those 50 lines of code, reading the docs for it, finding exactly which call or combination of calls duplicates the functionality that you would've written yourself, writing code to that API, and then debugging where your mental model doesn't match the mental model of the framework authors.

Which of those is better?

I suspect most of the commenters here would say #2. My point is that the real answer is neither: it's "it depends". It depends upon who you're working with and what their background is; how long you expect the code to live; whether you expect to use additional functionality in the framework in the future; how well-documented the framework is; what fraction of the framework will be used in this solution; etc.

A lot of people, particularly more junior ones, look at an established framework like React and think "because it's supported by Facebook and thousands of people use it, of course you should too". I'm saying that it's not always that simple: sometimes it's appropriate, but sometimes, just rolling your own is fine too.

(My perception is colored because when I was at Google, I was frequently the one writing the software that everybody else assumed they should be using, and I was intimately familiar with all of the downsides and weaknesses of said software. I recall running into a post on servo-dev where someone proposed using the Gumbo HTML parser, which I wrote, for Servo's HTML parser. pcwalton's reply was "Just because Google released it doesn't mean that it's suitable for our purposes" - which is exactly correct, Gumbo was never meant to function as a browser engine.)

Re:Why I no longer use MVC frameworks by jqm on Tuesday December 15, 2015 @08:50PM (#10741842)
How many times are you going to be spending an hour to write 50 lines of code? Is the code going to stay at 50 lines? If the answer is "one or two or three" and "yes" than ya... do it however.
Re:Why I no longer use MVC frameworks by rambambam on Tuesday December 15, 2015 @07:04PM (#10741440)
Words of wisdom, especially your first and last paragraph. Besides upvoting your comment, I wanted to tell you that.

It's easy to get involved in the ratrace of using the whole shebang for your projects, how big or small these projects may be. I've used some frameworks in the past, but I eventually found out they added more distraction, took forever to learn and they crippled my flexibility. Good old HTML, CSS, PHP (I'm very afraid of saying this here out loud), Javascript and XML worked for me. And programming without a framework was more fun, like a completely blank canvas that makes it very clear that you are the one who has to do it.

Re:Why I no longer use MVC frameworks by jdubray on Tuesday December 15, 2015 @06:18PM (#10741203)
spot on! that's exactly who I am and what I do.