Java EE or Python Django?

Considering the upcoming advancements in AI, which programming language would be more beneficial to learn for the next 10 years: Java EE or Django if you want to integrate AI into web development?

13 points | by ganeshdole 165 days ago

11 comments

  • aristofun 165 days ago
    I will never get tired to repeat this:

    There is nothing worse than bet your engineering career choices on some current hot bell & whistle or even maximizing salary.

    First, you can't possibly know what will be next big thing in 10 years.

    Second, your main skill that you sell is not a specific language expertise (except maybe few niche cases) - but your engineering skill (surprise surprise), not coding per se.

    To become good at engineering requires a lot of time and effort, it is hard, it challenges your motivation.

    To keep as much motivation as you can - you need to choose areas, domains and environments that you personally like, enjoy working with.

  • bjourne 165 days ago
    Java EE is everything that is wrong with modern software development packaged into one framework. :) It's not something you'd use voluntarily (unless the salary is really good).
  • bjw181 165 days ago
    I'd say Django. Its fast to get things running, security and CSRF out of the box. Very mature framework with a huge following.
  • 62951413 165 days ago
    Even people with 20 years of Java experience stay clear of JEE. I imagine the closest to Django on the JVM would be the Spring framework anyway. As of now, ML/AI is synonymous with Python so it could be your hint.
  • sgt 165 days ago
    Java EE is pretty much dead in the traditional it was marketed and spoken of. Trendy things in the Java ecosystem nowadays are frameworks such as Spring Boot and MicroProfile (which took the good stuff from the old Java EE. Think JAX-RS for REST API's etc).

    Django works with Python and in the AI space you'll want to iterate as quickly as possible, so I think that's probably going to be the preferred choice for beginners.

    • adamredwoods 165 days ago
    • sgt 165 days ago
      ... AND experienced folks too. You just have to manage your expectations in terms of pure performance. Python will always be slower than Java, and mostly that is fine.
      • manfre 165 days ago
        When focusing on AI, it doesn't really matter much with Python being little more than glue to a lot of compiled libraries.
  • wiwoworld 162 days ago
    Depends on the career that you wanna build. Or more specifically the clients that you want to have working for.

    JEE is more enterprise oriented, used in lots of big companies.

    I personally would recommend you Django, it's more flexible in my opinion.

    Also I prefer Python 100 times over Java, but that is very biased on my side :)

    P.S. I am mostly using React + NodeJs (ExpressJS), again personal preference here :)

  • NoCoding_Life 164 days ago
    While Java EE can certainly be used for web development and has its strengths in certain enterprise contexts, Python with Django offers a more streamlined and accessible approach for integrating AI into web applications, thanks to Python's rich AI ecosystem and Django's ease of use and flexibility. So I'd vote for Python Django.
    • adfm 164 days ago
      Django + htmx
  • octo-andrero 162 days ago
    Considering the upcoming advancements in AI, the more beneficial will be to give a hard focus to software engineering fundamentals: object oriented programming design patterns, domain driven design, system design etc. I personally expect that the number of required "coders" will decrease, whereas the software engineers will be always in demand.

    Regarding an exact programming language, it really depends on what exactly you want to do. If we're talking about web development, Java as a language has one dishonest advantage: a very mature open source eco-system supported by the biggest world enterprises. They invest a lot there, because often Java is a heart of their internal systems. Sometimes I think, that in Java world there's at least 10 years old and very stable library for any feature I need: caching, object-relational mapping, validations, logging etc. When I say Java, I don't necessarily mean the Java EE. Spring or Micronaut also perfectly do the job.

    If we're talking about AI world, the things become more complex. Python is widely spread for data analytics and experiments in the ML. Main reason for this is that there are lot of libraries to prepare data before you feed it into the model for learning. But if we're talking about libraries that actually do all the math under the hood or run neural network at scale, most of them are implemented with system-level languages, like C/C++. Mainly, because of speed. And in Python, you have only bindings, that allows you to call that native binaries from Python code. Same bindings exists for many other languages. As an effect, the python code for ML / Data analytics tasks resemble more procedural C code, for some weird reasons written inside python files, rather than nice object-oriented code you may face during web-development for python.

    So, if you want to do machine learning and the web development, I would suggest you to think of them as about two very separate skills, that have nothing in common. If you want to do both, learn both independently.

  • randjoe 165 days ago
    I'd go Django, even if it's just to prototype the system. If you need to microservice out a django install, just grab all the views and turn each into it's own flask instance with the rest being a collective lib. Coming from a sysadmin perspective, python apps require slightly less resources than a java apps do. Plus, like someone else said in the thread, it'll be easier to onboard developers at any knowledge level so it's great for beginners and advanced users.
    • manfre 165 days ago
      It's even easier to go from plain Django to django-ninja when you want less HTML and more json api. Avoids needing to migrate from Django's ORM to sqlalchemy.
      • randjoe 164 days ago
        Nice. Thanks. I never thought of that.
  • throwayasdf2342 165 days ago
    You can use anything as long as there are sdk's available in your preferred language.
  • ActorNightly 165 days ago
    Id go with Fast API in Python over Django.
    • winrid 164 days ago
      Fast API isn't a replacement for Django. It's a replacement for like 5% of Django.
      • the__alchemist 162 days ago
        Concur. It's a Flask replacement. Ie, for adding HTTP communications to a program. Django is for websites.
      • ActorNightly 164 days ago
        True but the other 95% of stuff in Django can be replaced with other libraries out there to make the code way more modular.
        • winrid 164 days ago
          Which sounds terrible. Why have one dependency with things that work well together when we could have 100 things to maintain and keep updated?

          I wouldn't do this unless I absolutely had to.

          • ActorNightly 162 days ago
            1) You don't have to keep 100 things maintained. Upgrading packages is not something that you are going to do that often, and really, you shouldn't even worry about upgrades unless there is a security problem.

            2) Having modular code means that things are isolated when you DO need to upgrade.

            • winrid 162 days ago
              That's bad advice, given how expensive it is to upgrade later.

              You aren't gonna convince people familiar with Django that your API library is a Django replacement. That's like saying Express.js replaces Spring. Well, no...

              • colesantiago 162 days ago
                Also in my experience Django is extremely slow generally than Flask or FastAPI.

                Even placing a CDN in front of Django doesn’t help in that regard.

                With that being said, not many people upgrade their dependencies that much anyway for Flask / FastAPI.

                • winrid 162 days ago
                  > Also in my experience Django is extremely slow generally than Flask or FastAPI.

                  Nobody cares. Seriously. I can handle 100rps on a $5 server for most of the pages on my Django sites. Do you know how many $100m+ ARR businesses I've worked for that never hit 100rps on a regular basis? Most of them.

                  > for Flask / FastAPI

                  What about the dozen other dependencies you now need to use? and now you need to test those upgrades carefully, because python.

                  • colesantiago 162 days ago
                    > Nobody cares... Seriously. I can handle 100rps on a $5 server for most of the pages on my Django sites. Do you know how many $100m+ ARR businesses I've worked for that never hit 100rps on a regular basis? Most of them.

                    I dunno, my clients paying my business care, speed is important in certain sectors such as mine.

                    I run and own a pest control SaaS on Flask that pulls in $1.7M+ ARR, when you're an upstart, speed is an advantage, I would imagine the $100m+ ARR business you worked for would be slow anyway.

                    > What about the dozen other dependencies you now need to use? and now you need to test those upgrades carefully, because python.

                    I just pin my dependencies, and since I'm making money it just runs itself really.

                    • winrid 162 days ago
                      I should have rephrased it as "nobody picking Django cares". People pick Django because of how quickly you can build something valuable. Everyone knows it's slow IMO.

                      > when you're an upstart, speed is an advantage,

                      Yes, this is kind of the whole point of FastComments :) but still, the SLAs are like 30ms for most endpoints. I wouldn't use Django for this - but I wouldn't (didn't) choose Python either.

                      > I just pin my dependencies, and since I'm making money it just runs itself really.

                      Pinning is good. Never updating them is bad, gets a lot harder later.

    • saasjosh 164 days ago
      I agree with this. Fast API provides a better developer experience because of how simple it is, and it's also more performant.
    • abyesilyurt 165 days ago
      Why?
      • ActorNightly 165 days ago
        Python is gonna be slower than Java and other compiled languages. Thats the price you pay for fast development. While most of your speed is going to be bottlenecked by network, there is still value in getting some optimizations to being able to handle more load.

        Fast API is basically async implementation of your standard API coding on top of uvicorn (which is a web server), which is built on uvloop, which is a faster event loop.