I'm the Lead Java Developer Advocate at JetBrains. I love the combination of solving technical problems and working out the best way to teach other developers techniques that will make their lives easier. I'm a leader of the Sevilla Java User Group, and a key member of the London Java Community. In 2014 I became a Java Champion, and I'm the co-editor of 97 Things Every Java Programmer Should Know.
Stats
Reputation: | 2812 |
Pageviews: | 2.1M |
Articles: | 40 |
Comments: | 51 |
Comments
Jun 14, 2023 · Trisha Gee
That's an approach which works well too. The "short-lived" being key!
Jun 12, 2023 · Trisha Gee
It's not that different. The main difference is you HAVE to regularly merge.
Sep 30, 2020 · Peter Connelly
That's true actually, and an excellent point
Dec 19, 2019 · Lindsay Burk
Dec 10, 2019 · Lindsay Burk
Let me check with my organisation. I would love to have it translated but we might have a prefered way to get things translated.
May 07, 2019 · Lindsay Burk
Yep this is totally true, and something even Oracle admits may have been a less-than-great decision.
May 03, 2019 · Lindsay Burk
Which is why the "major" releases are the LTS releases every three years.
Android is also built off OpenJDK, so it's going to be important to look at how they change in response to the new cadence.
Sep 01, 2018 · Maryna Ivakhnenko
See http://www.javaperformancetuning.com/news/qotm042.shtml
Sep 01, 2018 · Maryna Ivakhnenko
Because the JVM can optimise the code as it runs, creating more efficient native code than most programmers would produce, and doing it based on real runtime usage rather than theoretical performance optimisations
Aug 31, 2018 · Maryna Ivakhnenko
It's unfair to say Java has poor performance. Many banks and financial exchanges use Java in the back end because it's usually very fast, and also the code is optimised at runtime which other "fast" languages like C cannot do.
Poor performance usually comes from poor coding and a poor understanding of the technology and the hardware, this would apply to any language.
Jun 09, 2018 · Michael_Gates
Fair point. I assumed it was self explanatory but I see it makes it hard to run.
Jun 09, 2018 · Michael_Gates
It's a user-defined enum (i.e. it's not part of any library).
Sep 21, 2017 · Michael_Gates
I'm not sure what you mean by point 1? Generally I was trying to avoid breaks at all, but the only one that remains is stubbornly hard to remove or move into a different location.
With regards to point 2, I have another refactorinig on the backlog to deal with these, um, interesting validation situations.
Sep 15, 2017 · Michael_Gates
Yes, and this was discussed in a previous article. This is a first step towards a more domain-driven design.
Sep 15, 2017 · Michael_Gates
I did not make it up, it's a real method from an open source project (not a JetBrains one).
Aug 17, 2017 · Michael_Gates
Yes, but if this method had been created after Java 8 this would have returned an Optional. But the language developers can't change the return type of an existing method without breaking backwards compatibility, so it retains the old contract.
Aug 17, 2017 · Michael_Gates
Agreed. Like many people I thought Optional was the answer to all null problems, but actually it's for a very very small subset of problems, and needs to be used with care.
Aug 17, 2017 · Michael_Gates
Yes, the problem with this particular code is that the design goals (if there were any) have been lost over time, and it has been maintained by a number of people, most of whom never worked together (so could not communicate their intentions via anything other than code). However, this is the reality of lots of existing code. If we chose to write this project now from scratch, I have no doubt the code would be cleaner and contain far fewer hacks. This is why full re-writes are always so tempting for a new developer on a project.
Aug 17, 2017 · Michael_Gates
Avoiding null as much as possible is definitely a good way to avoid having to reason about it.
Aug 17, 2017 · Michael_Gates
It's true that dealing with nulls is a design decision, because the design should determine what null represents in each case. The problem comes when the design is unclear, or the original design goals are lost in the depths of time, which is generally the case in any system that's been around for a while, particularly if the original team members have moved on. The best way to prevent the loss of these decisions is to somehow explicitly put them in the code, which is what Optional and the NotNull/Nullable annotations can do, if used correctly. Unfortunately that doesn't cover all the cases.
Jul 29, 2016 · Duncan Brown
That's very interesting! I did a similar performance test to check Optional in my own app, and found a significant cost (the orange bars include creating an Optional object but no other additional computation).
b) is definitely applicable if you have no control over the code. But for fields, generally speaking, you'll know if the value is allowed to be null or not, and a null check is no more lines of code than an isPresent(). I tried using Optional for fields where I had extensive null checking, but in my case it just didn't give me anything.
But of course the point of these discussions is to see different use cases and see that there definitely is no "one size fits all", it's just a case of what works best in your code.
Jul 29, 2016 · Duncan Brown
I first thought Optional as a field was a great idea, particularly for Builders (for example) where the fields can be null by design. But a) the cost of wrapping everything in an Optional and b) the boilerplate of checking the value all the time gave me very limited value when I tried to use it that way. When constrained within a class, you should know whether a field can be null or not, so you can do appropriate checks (and not incur the performance hit of an additional object). Optional is really most valuable as a return type as it specifically shows that a value could be present or not.
Jul 29, 2016 · Duncan Brown
Indeed it is. It was first published on the JetBrains IntelliJ IDEA blog, and was written with that aim in mind. What DZone chooses to publish is down to them :)
Jul 29, 2016 · Duncan Brown
This article was first published on the JetBrains IntelliJ blog, hence the focus on IntelliJ features.
Oct 26, 2015 · Matt Werner
Java 6 and 7 are getting critical security updates, and if you've paid for support from Oracle you will continue to get support and updates. But for general use, Oracle stopped posting public updates to Java 7 in April 2015: https://www.java.com/en/download/faq/java_7.xml. This is something that many developers (and support staff) are not aware of, which is why it's highlighted in the article.
It is difficult for organisations to update to the latest version, for very good reasons, but the lack of public updates is a bit of a stick to drive people to a more recent version.
Sep 06, 2013 · William Beckelman
Oh you're right! Looks like it got moved. I'll try and get the article updated, but in the meantime your link is the correct one.
Sep 06, 2013 · William Beckelman
Oh you're right! Looks like it got moved. I'll try and get the article updated, but in the meantime your link is the correct one.
Sep 06, 2013 · William Beckelman
Oh you're right! Looks like it got moved. I'll try and get the article updated, but in the meantime your link is the correct one.
May 22, 2013 · Tony Thomas
Well the good news is that we've been talking to J. K. Green over the last month or so. We havne't forgotten Morphia, we want it to work for you guys.
May 22, 2013 · Tony Thomas
Well the good news is that we've been talking to J. K. Green over the last month or so. We havne't forgotten Morphia, we want it to work for you guys.
May 22, 2013 · Tony Thomas
Well the good news is that we've been talking to J. K. Green over the last month or so. We havne't forgotten Morphia, we want it to work for you guys.
Oct 24, 2012 · Matt Lambert
Oct 24, 2012 · Matt Lambert
Oct 24, 2012 · Matt Lambert
Oct 24, 2012 · Matt Lambert
Jul 01, 2012 · Jacobs kerala123
Jul 01, 2012 · Jacobs kerala123
Jul 01, 2012 · Jacobs kerala123
Mar 23, 2012 · Chris Collins
Mar 23, 2012 · Chris Collins
Mar 23, 2012 · Chris Collins
Mar 23, 2012 · Chris Collins
Jan 07, 2012 · Brian Broom
Jan 07, 2012 · Brian Broom
Jan 07, 2012 · Brian Broom
Aug 10, 2011 · Joachim Van der Auwera
Aug 10, 2011 · Joachim Van der Auwera
Aug 10, 2011 · Joachim Van der Auwera
Aug 10, 2011 · James Sugrue
Aug 10, 2011 · James Sugrue
Aug 10, 2011 · James Sugrue