5 ms·
Does anyone who has been following this in more detail have a summary of the sort of benefits developers 'at the coal face' will see from this change? I've rea
by michaelt 9y ago
Does anyone who has been following this in more detail have a summary of the sort of benefits developers 'at the coal face' will see from this change?
I've read a few articles and they've left me very confused.
Is this about parts of the Java standard library (like the mentions of SQL and logging imply) and meaning it's only relevant for people targeting small devices?
Does it replace JARs, like the mentions of 'JAR hell' imply?
Does it add a maven-style package manager that can resolve dependencies by downloading code from the internet, like the mentions of npm imply?
Or are the changes / benefits something else entirely?
- moomin 9y agoIt does quite a lot. I suspect it basically breaks Maven, since Maven jars aren't valid for Jigsaw. It also breaks code that does things like poke private member variables in other people's classes. I think the breakage will be significant. I also think it'll be worth it.
- TeMPOraL 9y ago> It also breaks code that does things like poke private member variables in other people's classes. > I also think it'll be worth it. Yeah, it's fun to stick to abstract design principles, until an important dependency in your project refuses to play ball, in a way that cannot be trivially fixed by simply subclassing something and calling it a day. In a language like Java you essentially have three options - submit an issue and wait months (or years) 'till it gets resolved, fork the project now (if open source) and deal with costs of supporting your own version, or just poke at an appropriate private static variable somewhere and have a working version deployed in an hour. I know which one I prefer.
- kpil 9y agoSeems like the least important thing to plug. Everyone that do this knows they're in deep shit anyway, but this is taking away their paddle.
- didibus 9y agoBut why take away my paddle? Let me have a working solution right away, and when you push an update that breaks my code, let me also deal with fixing it. I'm not dumb, I understand the risk of depending on private APIs.
- lomnakkus 9y ago> But why take away my paddle? Because there are upsides -- a major one being proper implementation hiding and (not sure if this made it in:) "classpath" isolation. > I'm not dumb, I understand the risk of depending on private APIs. Well, you knew the risks, so I'm not sure why you're so upset that Java 9 precludes you using what were ultimately private APIs. It's not possible to have it both ways.
- kpil 9y agoI understand that it's impossible to both implement a rule and not implement a rule, but what is actually the benefit of disabling this? All nerd sleeps safe at night confident that no one changes their private variables? Does this mean that things like jmockit's deencapsulation stops working?
- moomin 9y agoI think the answer is that it allows them to optimise libraries.
- didibus 9y agoThere is none, appart from making the Oracle employees life easier. They don't have to deal with the backlash of breaking customers by accident when touching private APIs, so it gives them more liberty. They decided to take the blow in one go, instead of spread over time. Now, the blow was bigger then they thought, so they've retracted and spread the change over Java 9 and 10, by making 9 an optional setting, and saying 10 will be the cutoff. In an ideal world, it makes sense. This is defensive programming, they're protecting themselves against unplanned usages of their libraries. That's always good when you're a maintainer. You know how annoying it is when you're trying to change and improve things and you realize you can't because someone was using your stuff in a completely dysfunctional way and now you'd break them if you proceeded. But in a practical world, the world of business especially. You should also know that part of the popularity of your software comes from all those use cases users have managed to somehow satisfy without you explicitly planning and building them. Take those away, and your software also loses a lot of value, until you reimplement all these use cases in a more sane way. Tjis will take time, and your customers might move on to something else. We'll see how this impacts Java.
- vbezhenar 9y agoI think you can always extract module in question into your module. Might be just an additional step during the build.
- rictic 9y agoIt just occured to me that the second and third options are more similar than they initially appear. In both cases you've taken responsibility for the library in a new way. It's no longer a breaking change for the library authors to break you if you're messing with private state, so you'll need to do some vetting of all changes to the library.
- x0x0 9y agoTrue, but generally you can pin a dependency version in a way you can't pin a jdk version, because people expect your code to run on the latest jdk.
- pbh101 9y agoSince it can be disabled at the command line on JVM startup, I don't think the breakage will be that painful.
- emidln 9y agoI, for one, enjoy when my language's runtime is broken by default.
- needusername 9y ago> I suspect it basically breaks Maven, since Maven jars aren't valid for Jigsaw. What do you mean by that? Maven JARs are just normal JARs downloaded with Maven. They are therefore valid in both the classpath and the module path (as automatic modules). Jigsaw modules are just normal JARs with a module-info.java, there is nothing preventing you form managing them with Maven. In fact in already have several of them in Maven Central, they went through the SonaType quality check without issues. In fact the compiler plugin will detect if a dependency in a modular JAR and if so put in the module path rather than the classpath (the javadoc plugin does not yet).
- pbh101 9y agoNo, no, and no. ETA: That being said, I think those who campaigned the hardest against Jigsaw with technical arguments were wrongheaded (e.g. "Just do it like OSGi, it works fine.")
- didibus 9y agoIt won't change anything for you most likely. The module system is taking the place of whatever you were previously using to order your dependencies on the classpath. Now, instead, the module files list the dependencies of a module and, Java does a resolution of all of them to determine the dependency graph. So the order of modules on the module path doesn't matter, unlike the classpath. The only advantage I know of is that the standard lib has been split in over 92 modules. So if you don't use everything, your resulting Jar will be smaller. Basically, making Java more modular in the sense that packages are now grouped into smaller Jars. Now Java 9 has some other features, one of them is to prevent reflection access of non public methods. This was made optional for Java 9. But might be made default in 10 and mandatory in 11. This is the biggest issue people have with Java 9 modules, because it will not be backwards compatible, and certain code can't even be ported, since no public APIs exist for certain things. Finally, most programmer at the cast, like me and you, we're hoping that modules would be version aware, and allow multiple versions of the same module to coexist, but they didn't do that unfortunately.
- zokier 9y ago> So if you don't use everything, your resulting Jar will be smaller I'll admit that I'm not super well-versed in Java packaging, but I kinda assume that typical jars do not include any bits from standard library, so modularizing standard library wouldn't have any impact on jar size. I'd imagine that the effect would be instead visible for self-contained distributions, like e.g. docker containers.
- needusername 9y ago> but I kinda assume that typical jars do not include any bits from standard library, so modularizing standard library wouldn't have any impact on jar size. That is correct. > I'd imagine that the effect would be instead visible for self-contained distributions, like e.g. docker containers. In theory. In practice you need to build a JDK contains only the bits you need. Sounds great in theory, you can get rid of the CORBA and GUI modules, that should save you a lot of disk space. In practice the CORBA module is only 2.7 MB and the desktop module is 14 MB and almost every framework indirectly requires the desktop module because Java Beans are in there.
- navalsaini 9y agoModules add another layer above the current access control constructs in Java world (public, private, etc). There are several benefits to them, like discovering a missing dependency much earlier on (statically), not importing the code we are not using, avoiding cyclic dependencies between modules, etc. More importantly it enforces better design and provides some tooling to have a better 10000-feet view of your project. I think its going to come in very handy in managing larger codebases. You could visit these links to know more from a web-dev backend point of view. * https://www.oreilly.com/ideas/modules-vs-microservices https://www.oreilly.com/ideas/modules-vs-microservices * https://www.youtube.com/watch?v=fDoiydWS3D4 https://www.youtube.com/watch?v=fDoiydWS3D4 * https://www.youtube.com/watch?v=O77777Zy_HE https://www.youtube.com/watch?v=O77777Zy_HE Ps... I created a library in Nodejs that implements concepts of modularity in JS codebases. Its known as archiejs (on github). I think modularity is a very useful feature that lot of people are going to want to use in Java (and also other programming languages).