Live data from Hacker News

Why I Hate Frameworks (2005)

factoryfactoryfactory.net

391–400 of 407 posts

Re: Why I Hate Frameworks (2005)

#391

Earlier quoted context omitted.

Yeah... That's not wrong. On the other hand, those kind of "fake" internships are rampant here in France, specially with smaller companies or startups. From personal experience they don't bother checking their work. And how could they, the other employees are interns too.

Same in Poland - none of my friends who did their required internship at studies was ever actually taught anything. It was always just "do your job, don't cause problems". And for free. Of course. My uni literally bans us from being paid. If we do, they won't acknowledge it as internship.

"My uni literally bans us from being paid. If we do, they won't acknowledge it as internship. "

Could there be any explanation for such a rule, that is not corruption and exploitation? I cannot think of any.

Re: Why I Hate Frameworks (2005)

#392

Earlier quoted context omitted.

Not all appearances are front-page appearances. And my very quick & dirty shell one-liner requires precise text matches. "Why I Hate Frameworks" does appear six times on the front page, though with case and phrasing variants which mean that an exact text match won't pick it up: Why I Hate Frameworks Why I Hate Frameworks Why I hate frameworks (2005) Why I Hate Frameworks [dupe] Why I Hate Frameworks (2005) Why I Hate…

And the updated list, 5+ appearances: 1 14 I'm Peter Roberts, Immigration Attorney Who Does Work for YC and Startups. AMA 2 11 Richard Feynman and the Connection Machine 3 10 Openssl Security Advisory 4 10 The TTY Demystified 5 8 Why GNU Grep is Fast 6 7 Cool URIs Don't Change 7 7 How to Read Mathematics 8 7 The Architecture of Open Source Applications 9 7 You and Your Research 10 6 -2000 Lines of Code 11 6 A Primer…

NB: I've further tweaked my scripts (and titlecasing) which results in a few minor changes to the results, though the above list remains highly illustrative.

I think I've spammed this thread enough for now ;-)

Re: Why I Hate Frameworks (2005)

#393
post #292

Earlier quoted context omitted.

Sounds like you haven't really understood the benefits of polymorphism, encapsulation etc. The general idea is to compartmentalize your logic and only expose the important parts like if you need to generate pdfs from html you may need to use a lot of moving parts to make that happen but you hide all of it and only expose an interface with a single action that takes html and returns a pdf. If you later need to change…

I think the simpler solution is to design the code around some kind of pdf generation library that is linked to, instead of making a heavily abstracted mini-framework to squat on the application.

Yeah that's one of those aforementioned "moving parts". You design the interface with a single action taking html and returning pdf. That way it doesn't matter how you change these moving parts, you can replace this pdf library easily and as long as you find another way to make this thing take html and return pdf you're golden, none of the code using your pdf generator ever needs to change no matter how much you need to change this service. Unless you change its entire purpose - converting html (and maybe other stuff) to pdf - none of its consumers need to change.

That's the idea. You define a clean and well-defined interface beyond which everything is hidden. This keeps the code simpler because you can focus on one little part and know nothing you do will change anything anywhere else. Its purpose is well defined.

As an example of a less well defined service I'm currently working on a class DiffService which has a method which gets data from a DB, then it gets data from another DB, then it gets data from an API and then it checks for differences between the two db datasets and uses the api data in the process somehow, I can't remember atm. In my opinion there should be one class where all the data is put together, then it should send the data into a different method in a different class where the only concern is taking the data and combining it in the required way.

This way the actual logic is separate from the data collection. It sucks trying to test this logic because I have to mock a bunch of different services and then test the logic. If the concerns were separated I wouldn't even have to unit test the data collection service - it's just calling some data collection methods and sending the data on to this new service which I could then easily test without mocking anything. I might also separate the part with that api call to yet another place if I can. That way I can have a completely dedicated DiffChecker with super simple and understandable logic, a SomethingDoer which takes that api data and does whatever it needs to with that, and a more general service class tying all these parts together. I can also use these parts in a different part of the code that does almost the same thing instead of having the logic duplicated.

I don't really need any new interfaces for this refactor - abstraction isn't exclusive to interfaces. The code will be more spread out so that does take a toll in terms of mental load but I think that is alleviated entirely by the simplicity of the new components - DiffChecker checks for diffs in provided data, it doesn't do anything else. SomethingDoer does some specific little thing I can't remember at the moment but it'll be equally simple in principle. DiffService ties the whole system together and provides an easy way to get the difference - just like it used to before. It'll just be easier to test, the new tests will be clearer which allows them to more clearly convey the purpose of the code they're testing, the new code will be reusable and allow me to easily perform a similar refactor of a similar system and reduce the total amount of code.

Some people will probably say I'm overdoing it, I think they're wrong. I think a class with one method that does one simple thing is extremely easy to conceptualize, allowing you to stop worrying about what's inside it. Meanwhile the existing solution is extremely difficult to completely wrap your head around. It gets all this complicated data, then it does multiple different operations on it before it returns a result. I have worked with this code for a bit, I've read this method at least 20 times trying to fit everything in my head and it's a struggle. It may sound simple but every part has complexity and nuance in the way they're put together and it adds up. To me it becomes much easier to fit everything in my head when I compartmentalize it into small simple parts that are easy to understand and are put together in a clear and cohesive way.

var dataA = db.GetDataA();

var dataB = db.GetDataB();

var diff = diffFinder.Diff(dataA, dataB);

var apiData = apiClient.GetData();

var enrichedDiff = diffEnricher.EnrichSomehow(diff, apiData); // This would have a more descriptive name

return enrichedDiff;

This is what I want my code to look like. This is already plenty busy, there's a lot of stuff happening here. It'll also have logging. Imagine trying to read it if it was 100+ lines because everything was written directly in this one method.

Re: Why I Hate Frameworks (2005)

#394

Earlier quoted context omitted.

And the updated list, 5+ appearances: 1 14 I'm Peter Roberts, Immigration Attorney Who Does Work for YC and Startups. AMA 2 11 Richard Feynman and the Connection Machine 3 10 Openssl Security Advisory 4 10 The TTY Demystified 5 8 Why GNU Grep is Fast 6 7 Cool URIs Don't Change 7 7 How to Read Mathematics 8 7 The Architecture of Open Source Applications 9 7 You and Your Research 10 6 -2000 Lines of Code 11 6 A Primer…

NB: I've further tweaked my scripts (and titlecasing) which results in a few minor changes to the results, though the above list remains highly illustrative. I think I've spammed this thread enough for now ;-)

Nice work! Thank you for taking my feature requests to heart :)

Re: Why I Hate Frameworks (2005)

#395

I will give a counter point. I love well-designed opinionated frameworks. Whenever I want to do something simple, I agree that a framework may be overkill. A micro-framework is nice for those scenarios though. However, whenever I build a project that will be maintained or extended by many people, opinionated frameworks give me the advantage that they force you to do things in a particular way. Django is a perfect exa…

Strongly agree. For me the mark of a useful framework is that is reduces the complexity of the task you are trying to do. If it increases the complexity of the task, it isn't the right tool for the job! Choosing the right level of abstraction is the most important part of software engineering.

If all you need is HTTP routing, then Flask is great, but every time I tried to use it for the kinds of things Django is great at (databasing, templating, forms), I had to effectively roll my own crappy version of Django. (Something something every sufficiently large C++ program has a poorly implemented version of LISP embedded into it.)

I saw this dramatically demonstrated by an enormous Flask installation that would have greatly benefited from a little imposed structure. I bounced hard from that gig after being shown the code because it was going to be a massive pain to understand the poorly designed abstractions. But it wasn't even the maintainer's fault - it was pretty good code but it had only been designed by one person, both the abstractions and the business logic. And the abstractions were leaky simply because abstractions are difficult to design.

The framework allows you to completely offload the architectural decisions underneath the framework to many person-years worth of design, bug squashing, and security fixes. How do I add headers to a request? Django has one opinionated way. Where do I put my database models? models.py and if you put them there you don't have to do any connection fiddling.

The ideal of a framework is that if you release attachment to how things you don't actually care about anyway are done, you get thousands of free high quality lines of code.

I learned a lot from Sandi Metz about the costs of "The Wrong Abstraction" https://www.youtube.com/watch?v=8bZh5LMaSmE

Re: Why I Hate Frameworks (2005)

#396
post #318

Earlier quoted context omitted.

Dare I suggest that it is possible that the nimble startup was moving quickly not necessarily because of tool choice, but because of the small team size and because the appropriate amount of complexity was introduced? And conversely the inflated team was slow exactly because it was inflated and complexity was introduced? This effect happens with or without bringing third-party or in-house tooling/frameworks into the…

The speed difference boils down to flexibility and tool usage. In the startup, I could swiftly create a new service, harness Kubernetes for deployment, and seamlessly integrate it into the existing architecture. Data computation used tools like Airflow/BigQuery, storing results in production PostgreSQL. In contrast, with a Golang monolith, service integration often involved complex, time-consuming conversations due t…

I think there's too many red flags there to chalk it up to a single problem: time-consuming conversations, rigid abstractions, resistance to changes, demanding PMs, total overhauls needed, more bureaucracy on change approval, you also complained about fixation on code quality.

Saying that it's all up to the one single difference even though there's so many ancillary issues screams of "I've found a silver bullet syndrome" to me.

Re: Why I Hate Frameworks (2005)

#397

Earlier quoted context omitted.

Who is going to maintain the React app in 3 years? Who is going to work with the various "repairments" made to get normal browser behavior back into a SPA? History, back button, forward button, bookmarkability, context menu (if modified). The original developer will have moved on to the next gig. Are you going to rebuild, or pay even more for the next developer with more experience, to subject themselves to work with…

> Who is going to maintain the React app in 3 years? Uhm, developers? Using projects documentation? > Who is going to work with the various "repairments" made to get normal browser behavior back into a SPA? History, back button, forward button, bookmarkability, context menu (if modified). I never had to manually “repair” any of that. Most often you just don't need them. Why would you use a back button in an image edi…

> Uhm, developers? Using projects documentation?

You mean the documentation that was never written, because the developer thought: "Ah but this is just the usual usage of the framework I am using. I don't need to write anything about that."

> I never had to manually “repair” any of that. Most often you just don't need them. Why would you use a back button in an image editor or an IDE?

Well, on most SPAs you would need them, because people build SPAs all the time without caring, whether they are actually building an app or are actually building a website. So what you get are things that would be a normal website, but implemented using SPA frameworks and then have broken browser functionality. An IDE or an image editor would probably be OK examples for SPA, but the reality unfortunately is very different.

> What your are talking about seem to be simple CRUD apps. I have built those with server-rendered templates, yes (here's a takehome for some company from a couple of years back: https://github.com/golergka/url-shortener).

Exactly! I am talking about the cases, when people take out the sledgehammer, where a screwdriver would have been appropriate.

Re: Why I Hate Frameworks (2005)

#398

Earlier quoted context omitted.

And the updated list, 5+ appearances: 1 14 I'm Peter Roberts, Immigration Attorney Who Does Work for YC and Startups. AMA 2 11 Richard Feynman and the Connection Machine 3 10 Openssl Security Advisory 4 10 The TTY Demystified 5 8 Why GNU Grep is Fast 6 7 Cool URIs Don't Change 7 7 How to Read Mathematics 8 7 The Architecture of Open Source Applications 9 7 You and Your Research 10 6 -2000 Lines of Code 11 6 A Primer…

NB: I've further tweaked my scripts (and titlecasing) which results in a few minor changes to the results, though the above list remains highly illustrative. I think I've spammed this thread enough for now ;-)

A list with a link to the most-commented post would be really cool for, uh..., other people who might not have seen them all.

Re: Why I Hate Frameworks (2005)

#399
post #277

Earlier quoted context omitted.

Laravel is prime example of a bad framework trying to reinvent the language, educating young developers to use it and its ecosystem and to never get out of the stranglehold. I'm not sure what made you think it's an "appropriate" framework, it's literally antipattern on antipattern and it's not even the worst thing, neither is the fact it's 10x slower than anything else out there - what's worst is the blatant lying, b…

What's a good framework from your point of view? Or do you prefer to not use any framework and instead write your own one on the fly because you're probably going to do it a lot better with all the best practices and no bugs and great documentation?

Why would you imply I tried to say anything against frameworks in general? My comment was specifically about Laravel because it was singled out as a great framework.

To indulge you, about good frameworks: Symfony, Aphiria. Aphiria in particular because it's small, cuts down on repetitive tasks and doesn't reinvent the language with things like "Macros" or abuse of Reflection or mishandled patterns like singletons - all of which Laravel gets wrong.

Symfony because of active development. Every large tool is bound to be bad at something. Symfony is no exception, however it's not an advertising platform - and Laravel is an advertising platform. Sane choice is to use the tool with maximum benefit and least negative impact.

Re: Why I Hate Frameworks (2005)

#400
post #194

Earlier quoted context omitted.

The carpenter doesn't need a degree. The architect and structural engineer do. If you plan to be a programmer all your life, and a journey-man one at that, then feel free to learn-programming-in-21-days. If you're planning a career in software, then I think understanding fundamentals (database normalisation, the Order of a solution, the ideas of Coupling and Uncoupling, memory usage versus performance, the impact of…

The carpenter absolutely should have some education, certification, and especially apprenticeship. A certified carpenter has more trade-specific information than your average dev out of a great Uni. It'd be positive if there were some degree of institutionalization of software.

FYI, you're shadowbanned. Mail the admins.
Post reply on HN