Hidden Beauties of Java Enums: The Not-So-Secret Weapon That Can Do A Lot More

  Рет қаралды 22,191

Frank Delporte

Frank Delporte

Күн бұрын

Пікірлер: 31
@TheKundan11
@TheKundan11 Жыл бұрын
Wonderful video Frank. Learned a new thing in Java. Please also make videos on JavaFX tutorials. There are very few JavaFX tutorials online. Please keep posting videos regularly.
@FrankDelporte
@FrankDelporte Жыл бұрын
Thanks for your kind words!!
@VerhoevenSimon
@VerhoevenSimon Жыл бұрын
Indeed some nice things to do with enums, and that customer state is indeed quite an apt example. And the code error was indeed spotted at the 12:04 mark. Thank you for the interesting video and blog post.
@FrankDelporte
@FrankDelporte Жыл бұрын
Thanks! And you watched attentively to spot the error... ;-)
@Manuel-oe4gv
@Manuel-oe4gv Жыл бұрын
I came from reddit ! Nice content I want to be good programmer like you one day !! I have 5 years of exp and it feels like I know nothing
@FrankDelporte
@FrankDelporte Жыл бұрын
I have 30 years of experience and still each day there are things I don't understand. That's how things work. Embrace it! It's an opportunity to evolve and learn continuously 😃
@enes1565
@enes1565 7 ай бұрын
thanks for good explanation❤
@FrankDelporte
@FrankDelporte 7 ай бұрын
You're welcome 😊
@Misa7531
@Misa7531 5 ай бұрын
Hey great overview of enum functionality, you could also show that an enum is basically a immutable class and can also implement interfaces, this could potentiality lead to interesting use cases like an light version of strategy pattern, also quick question, why you are doing Arrays.stream().sequential() is'n it sequential by default ? Other then this great video you got one more subscriber :D
@FrankDelporte
@FrankDelporte 5 ай бұрын
Thanks for your feedback! There is actually a lot more that could also fit in this video; maybe I need to create a follow-up... ;-)
@avalagum7957
@avalagum7957 7 ай бұрын
A few notes: - your project directory has an .idea directory but you open it with vscode. You don't want to show people your IntelliJ? :) - you're using java 17, aren't you? If yes, your switch (...) { case ...: return 1; ... } doesn't look very nice as there are a lot of return's in there. - you use jband EnumExtended.java instead of java EnumExtendec.java. What's the advantage of using jbang over java?
@FrankDelporte
@FrankDelporte 7 ай бұрын
Hi, thanks for your feedback! 1/ I use both Visual Studio Code and IntelliJIDEA, normally I add the .idea directory to gitignore, but probably forgot it here... Check out my other videos, you'll see I definitely do show it :-) 2/ Yes switch/case can be further improved with newer Java versions, good remark! 3/ When you don't use dependencies, java can handle it. But I do prefer JBang as it has a way to define dependencies inside the file and you don't need a full Maven or Gradle project. See pi4j.com/examples/jbang/ for more info.
@duta.9100
@duta.9100 Күн бұрын
I guess the only new thing I discovered here is JBang :)
@FrankDelporte
@FrankDelporte Күн бұрын
Good thing! It's confirmed you are using enums the right way, and you learned something new :-)
@donwinston
@donwinston 9 ай бұрын
I fail to see any benefit of enums over: final String[] values = { "X1", "X2", ..., "Xn" };
@luquillasnano
@luquillasnano 9 ай бұрын
I'm with you. It's even more verbose for me than working with old plain arrays. I'd really like to understand all the enthusiasm with them, but I just can't 🫤
@mrshahcloud
@mrshahcloud 9 ай бұрын
Because you can share it on multiple class, easy to document on openapi etc
@donwinston
@donwinston 9 ай бұрын
@@mrshahcloud You can "put public static final MyEnum = { "X1", "X2", "X3" };" in a static class and make it part of a library.
@mrshahcloud
@mrshahcloud 9 ай бұрын
@@donwinston of course you can, there are many ways to skin a cat. We could also create a complete large program using only the main class and opt out of using oop in java. Whichever suits the use case.
@donwinston
@donwinston 9 ай бұрын
@@mrshahcloud No. the point is the enum feature has little to nothing to offer.
@yaroslavpanych2067
@yaroslavpanych2067 6 ай бұрын
1. "Enum members are instances of the enum type" ehm, yeah. Surprise. It is the case since forever. It is not hidden, always been there. "Enum type much like any class can have fields and methods, including constructors". Yeah, nothing new really, nothing hidden either! 2. Also, cringe using java instead of normal javac->java sequence. You are targeting pupils, students, newbies! Don't teach them bad!
Java Reflection Explained - bɘniɒlqxƎ noiɟɔɘlʇɘЯ ɒvɒᒐ
20:07
Coding with John
Рет қаралды 189 М.
Java. Enum на примерах.
18:34
Sergey Arkhipov Java Tutorials
Рет қаралды 10 М.
They Chose Kindness Over Abuse in Their Team #shorts
00:20
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН
The IMPOSSIBLE Puzzle..
00:55
Stokes Twins
Рет қаралды 153 МЛН
Players push long pins through a cardboard box attempting to pop the balloon!
00:31
This Game Is Wild...
00:19
MrBeast
Рет қаралды 114 МЛН
My 10 “Clean” Code Principles (Start These Now)
15:12
Conner Ardman
Рет қаралды 277 М.
JWT авторизация. Основы JWT - механизма.
6:45
Хочу вАйти
Рет қаралды 16 М.
The KEY To Thinking Like a Programmer (Fix This Or Keep Struggling)
10:39
BEST WAY to make Desktop Applications in C++
26:00
The Cherno
Рет қаралды 934 М.
Java Enums Explained in 6 Minutes
5:58
Coding with John
Рет қаралды 269 М.
🚀  TDD, Where Did It All Go Wrong (Ian Cooper)
1:03:55
DevTernity Conference
Рет қаралды 567 М.
Beginners Should Think Differently When Writing Golang
11:35
Anthony GG
Рет қаралды 121 М.
They Chose Kindness Over Abuse in Their Team #shorts
00:20
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН