(评论)
(comments)

原始链接: https://news.ycombinator.com/item?id=43514433

Hacker News 的一篇帖子讨论了 Andrej Karpathy 对现代 Web 开发复杂性的看法。评论者们就当前的生态系统是否过于复杂展开了辩论,争论诸如 Supabase 和 Vercel 等众多工具和服务的必要性,这些工具和服务可能导致重大更改和高昂的维护成本。 一些人提出了“原生”方法,质疑框架的附加值,并建议使用更简单的解决方案。另一些人则认为框架提供了经过预先测试和强化的代码,尤其是在安全性方面。有人建议前端使用纯 HTML、CSS 和 Javascript,后端使用 Jinja 模板等组件的模块化方法。 这场辩论还围绕着什么是“Web 应用”展开,一些人认为 Karpathy 的观点涵盖了典型的 Web 开发之外的功能,例如监控和 CI/CD。另一些人指出,他的论点主要针对大型、可扩展的、可用于生产环境的 Web 应用。普遍的共识是,选择合适的工具集取决于项目需求,一些人倾向于简单性,另一些人则接受成熟框架的优势。

相关文章
  • (评论) 2024-02-08
  • (评论) 2023-11-13
  • (评论) 2023-12-03
  • (评论) 2024-05-05
  • (评论) 2023-12-03

  • 原文
    Hacker News new | past | comments | ask | show | jobs | submit login
    Andrej Karpathy on the State of Web Development (twitter.com/karpathy)
    24 points by mg 1 hour ago | hide | past | favorite | 13 comments










    Well, what's a web app? A lot of stuff on that list exceed what's usually thought to be part of the actual web app, like monitoring, CI/CD/staging, payment. If you use something like Django, Laravel, Rails a lof bases will be covered including frontend, backend, auth, social logins, email, basic analytics etc. Choosing a framework, library, CMS also depends on the level of customization you need or want to do.


    To me web development is the one place where I do feel like there's a lot that "just works". If I had to make a native mobile app I would feel overwhelmed and confused. I wonder if this really just comes down to familiarity. It seems strange to me to assume a given domain should be easy.


    I would say the even bigger problem is that the pieces you stitch together to make a web app will rot rather quickly.

    He mentions supabase and vercel. It will only take so long, until the supabase code or the vercel service will have a breaking change. And those breaking changes add up throughout the stack. Making the cost of running a web app much higher than it would have to be.



    This leads to an obvious question: why not do it old-school?

    What's the actual value-add of all this stuff?

    People have been pushing back against JS frameworks with vanilla, what about vanilla-everything-else?



    Because eventually you end up rewriting a more brittle version of an established framework. Plus someone else may have to maintain it. Working out how your vanilla code works is worse than learning a framework because there's no help.

    I lived this with an app made in 2012 that was all custom JS.

    Plus how far do you want to take it? Write your own security modules? Create your own anti SQL injection code? The benefit of frameworks is you get free hardened code tested by millions.

    But yes, I get it, gluing together Frameworks is depressing too. It just isn't fun.



    JavaScript, HTML, and CSS have changed a lot since 2012.

    I think the problem is folks tend to think like engineers with all their widgets (e.g desktop development in the browser). Even Microsoft is going full TypeScript mode.

    Web development is DESIGN first. Think of it like a design project and suddenly the entire workflow changes.

    The CSS spec today makes all this stuff super easy people just don’t spend the time actually learning.

    In my opinion the Laravel and Rails developers get this right.



    I think it is a balance. My current view on this is:

    For the frontend, everything but plain HTML, CSS, JS is too much.

    For the backend, an opinionated framework like Django is too much.

    Even a less opinionated framework like Flask is too much.

    Using modules that Flask uses - like Jinja templates - is the right choice for me. This way, I don't have the overhead of a full framework, but also don't have to write basics like a template engine myself. And I have the benefit that other developers (and AI) easily understand my code, as it has many similarities to a Flask project.

    So instead of going for Flask when I need templates, all I do is

        import jinja2
    
        env = jinja2.Environment(
            loader=jinja2.FileSystemLoader('templates'),
            autoescape=jinja2.select_autoescape(['html', 'xml'])
        )
    
        def template_data(template, data):
            tmpl = env.from_string(template)
            return tmpl.render(data)
    
    And I have a function I can use to template my data.


    The tweet is over generalizing things. It says "The reality of building web apps ...", but what he really is talking about is building a serious, scalable, production ready web app. Blob storage, email, background jobs, analytics, monitoring? Come on, you are taking about building a web based product that is often managed by several people, and if you are creating something that is serious enough to require analytics, you might as well actually understand what you are doing.

    This isn't about what most people consider "web development" or "building web apps", too much a stretch.



    The responses are the usual "just use this thing I'm familiar with and it's really easy" nonsense.


    *familiar with / founded / financially incentivized to promote


    To be honest for most of our selfhosted needs, all we need is python and sqlite.


    And that covers:

        - frontend / backend (e.g. React, Next.js, APIs)
        - hosting (cdn, https, domains, autoscaling)
        - database
        - authentication (custom, social logins)
        - blob storage (file uploads, urls, cdn-backed)
        - email
        - payments
        - background jobs
        - analytics
        - monitoring
        - dev tools (CI/CD, staging)
        - secrets
    ?

    Or are you importing a hundred different modules, using a bunch of different services, and just reproducing the IKEA-like system Andrej is complaining about in a language you happen to like?



    Vibes only go so far, I guess.






    Join us for AI Startup School this June 16-17 in San Francisco!


    Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact



    Search:
    联系我们 contact @ memedata.com