Hidden Beauties of Java Enums

  Рет қаралды 9,745

Frank Delporte

Frank Delporte

Жыл бұрын

This video shows some code examples of what can be done with Java Enums.
NOTE: there is actually an error in one of the code examples, just to check if someone notices ;-)
Around 12'-13' the code "class Customer() {" should not have the "()".
The blog post is available here:
webtechie.be/post/2023-03-22-...
And the sources here:
github.com/foojayio/getting_s...
Other links mentioned:
* api.pi4j.com/web/
+ library github.com/Pi4J/pi4j-board-info
* lottie4j.com/
+ library github.com/lottie4j/lottie4j/...
* 4drums.media/
* www.jbang.dev/
* foojay.io/today/controlling-e...

Пікірлер: 22
@TheKundan11
@TheKundan11 10 ай бұрын
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 10 ай бұрын
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 11 ай бұрын
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 2 ай бұрын
thanks for good explanation❤
@FrankDelporte
@FrankDelporte 2 ай бұрын
You're welcome 😊
@avalagum7957
@avalagum7957 Ай бұрын
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 Ай бұрын
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.
@donwinston
@donwinston 3 ай бұрын
I fail to see any benefit of enums over: final String[] values = { "X1", "X2", ..., "Xn" };
@luquillasnano
@luquillasnano 3 ай бұрын
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 3 ай бұрын
Because you can share it on multiple class, easy to document on openapi etc
@donwinston
@donwinston 3 ай бұрын
@@mrshahcloud You can "put public static final MyEnum = { "X1", "X2", "X3" };" in a static class and make it part of a library.
@mrshahcloud
@mrshahcloud 3 ай бұрын
@@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 3 ай бұрын
@@mrshahcloud No. the point is the enum feature has little to nothing to offer.
@yaroslavpanych2067
@yaroslavpanych2067 22 күн бұрын
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
Рет қаралды 168 М.
100😭🎉 #thankyou
00:28
はじめしゃちょー(hajime)
Рет қаралды 23 МЛН
NO NO NO YES! (50 MLN SUBSCRIBERS CHALLENGE!) #shorts
00:26
PANDA BOI
Рет қаралды 102 МЛН
Follow @karina-kola please 🙏🥺
00:21
Andrey Grechka
Рет қаралды 26 МЛН
КАК СПРЯТАТЬ КОНФЕТЫ
00:59
123 GO! Shorts Russian
Рет қаралды 2,7 МЛН
How To Call a REST API In Java - Simple Tutorial
29:14
Coding with John
Рет қаралды 252 М.
Java Enums Explained in 6 Minutes
5:58
Coding with John
Рет қаралды 241 М.
How the haters saved my game
9:00
samyam
Рет қаралды 11 М.
Java Functional Programming | Full Course
2:22:15
Amigoscode
Рет қаралды 554 М.
15 crazy new JS framework features you don’t know yet
6:11
Fireship
Рет қаралды 392 М.
Java Builder Pattern Explained in 3 Minutes
3:19
Jack Hodkinson
Рет қаралды 11 М.
Windows all blue screens 1 to 10
4:01
MafBaman
Рет қаралды 713
Abstract Classes and Methods in Java Explained in 7 Minutes
7:00
Coding with John
Рет қаралды 470 М.
Waiting for target Germany Sniper #movies #film #short #sniper
0:34
Fans Movie Recap
Рет қаралды 9 МЛН
小丑的家庭地位?#天使 #小丑 #超人不会飞
0:39
超人不会飞
Рет қаралды 4,2 МЛН
Funny kid and Dad #shorts #funny #viral #comedy #youtubeshorts
0:15
mountainlion5
Рет қаралды 11 МЛН
ЗаМЫШляют злодейства … 🐭 #симба #дымок #симбочка
0:57
Симбочка Пимпочка
Рет қаралды 2,8 МЛН