![Will Tollefson](/img/default-banner.jpg)
- Видео 69
- Просмотров 82 232
Will Tollefson
Добавлен 12 дек 2022
Hello! My name is Will Tollefson, and I'm a software engineer who enjoys learning and teaching others! I've been programming for over a decade now; the field of computer programming is continuously evolving, requiring even the most experienced programmers to acquire new skills. Whether its website design, artificial intelligence, or mobile app development, knowledge of computer programming opens the door to jobs in the tech sector, new hobbies, or impressing your grandma with your savvy computer skills! I've created this channel for beginning to expert programmers alike as a resource for learning and staying on the edge of programming.
Are You Using This NEW Java Feature?
In this video we'll cover the STRING TEMPLATES feature in JDK 22. One immediate benefit of this feature is that it better streamlines string interpolation, but these NEW JAVA TEMPLATE EXPRESSIONS can do A LOT more than that!
I'm Will Tollefson, a guy who loves to NEVER STOP LEARNING and teach others what I've learned. If you're enjoying the content, please LIKE, SUBSCRIBE, and SHARE!
LINKS:
JEP 459: openjdk.org/jeps/459
VIDEO CHAPTERS:
0:00 What is String Interpolation?
1:00 Why Should I Use String Templates?
1:33 Readability Improvements
4:11 Embedded Expressions
7:24 Text Blocks
9:13 Template Processors
15:31 JEP 459
17:39 Closing Thoughts
I'm Will Tollefson, a guy who loves to NEVER STOP LEARNING and teach others what I've learned. If you're enjoying the content, please LIKE, SUBSCRIBE, and SHARE!
LINKS:
JEP 459: openjdk.org/jeps/459
VIDEO CHAPTERS:
0:00 What is String Interpolation?
1:00 Why Should I Use String Templates?
1:33 Readability Improvements
4:11 Embedded Expressions
7:24 Text Blocks
9:13 Template Processors
15:31 JEP 459
17:39 Closing Thoughts
Просмотров: 424
Видео
Socket Programming with Java NIO - Channels, Selectors, and Buffers
Просмотров 1,1 тыс.3 месяца назад
In this video we'll cover SOCKET PROGRAMMING using the JAVA NIO library. We'll make an example client/server aplication where the server only requires one thread to handle multiple client connections! In the process we'll touch on CHANNELS, SELECTORS, and BUFFERS, and why byte order and ENDIANNESS matter in computer networking.Network byte order is BIG ENDIAN, but you should always confirm byte...
Java Network Sockets + Virtual Threads = Cool!
Просмотров 1,1 тыс.4 месяца назад
In this video we'll cover SOCKET PROGRAMMING in JAVA. We'll touch on both SINGLE and MULTITHREADED server applications that have server sockets waiting for client connections. Java sockets are built upon TCP, but the API also provides DatagramSocket, a UDP based implementation sometimes used in particular applications. Also be sure to stick around till near the end where we talk about the Java ...
Operator Overloading in Kotlin
Просмотров 1784 месяца назад
In this video, we'll cover how to perform OPERATOR OVERLOADING IN KOTLIN. We'll go through a few examples of operators such as addition, comparison, and indexing. I'm Will Tollefson, a guy who loves to NEVER STOP LEARNING and teach others what I've learned. If you're enjoying the content, please LIKE, SUBSCRIBE, and SHARE! VIDEO CHAPTERS: 0:00 Introduction 1:11 Addition 4:36 Prefix and Postfix ...
Scoped Values in Java 22
Просмотров 8685 месяцев назад
In this video we'll cover SCOPED VALUES IN JDK 22. We'll talk about what a ScopedValue gets you vs prior ThreadLocal code examples and why you should probably migrate to ScopedValue especially int the context of virtual threads and structured concurrency. Scoped values address some of the main problems with ThreadLocal such as UNCONSTRAINED MUTABILITY, UNBOUNDED LIFETIMES, and EXPENSIVE INHERIT...
Inheritance and Solving the Diamond Problem in Kotlin
Просмотров 1845 месяцев назад
In this video, we'll cover HOW INHERITANCE WORKS IN KOTLIN. We'll go into a little bit of POLYMORPHISM as well with METHOD OVERRIDING, using the SUPER keyword and a couple corner case situations. I'm Will Tollefson, a guy who loves to NEVER STOP LEARNING and teach others what I've learned. If you're enjoying the content, please LIKE, SUBSCRIBE, and SHARE! VIDEO CHAPTERS: 0:00 Introduction 0:46 ...
Structured Concurrency in Java 21
Просмотров 1,5 тыс.5 месяцев назад
In this video we'll cover STRUCTURED CONCURRENCY IN JDK 21. We'll talk about some of the differences between ExecutorService and StructuredTaskScope as well as touching on things like impacts to THREAD DUMPS. I'm Will Tollefson, a guy who loves to NEVER STOP LEARNING and teach others what I've learned. If you're enjoying the content, please LIKE, SUBSCRIBE, and SHARE! LINKS: JEP 453: openjdk.or...
Kotlin Classes and Constructors - Primary vs Secondary
Просмотров 3356 месяцев назад
In this video, we'll cover how to MAKE YOUR OWN KOTLIN CLASS, including methods for customizing this with PRIMARY AND SECONDARY CONSTRUCOTRS. We'll also touch briefly on the FOUR VISIBILITY MODIFIERS IN KOTLIN. I'm Will Tollefson, a guy who loves to NEVER STOP LEARNING and teach others what I've learned. If you're enjoying the content, please LIKE, SUBSCRIBE, and SHARE! VIDEO CHAPTERS: 0:00 Int...
The Abstract Factory Design Pattern In Java
Просмотров 1,1 тыс.6 месяцев назад
There are multiple variants of the FACTORY DESIGN PATTERN IN JAVA. In this video, we'll go through the ABSTRACT FACTORY PATTERN, which is a continuation of the FACTORY METHOD PATTERN with additional factory methods used to create groups of like objects. This pattern, while more complicated, can have some real benefits down the road for extendability and testability. I'm Will Tollefson, a guy wh...
Kotlin Avoided a $1,000,000,000 Mistake
Просмотров 6976 месяцев назад
Kotlin was designed with NULL SAFETY in mind, which largely allows it to avoid the major issue of unexpected null pointer dereferencing. In other programming languages, this has caused numerous issues over the years, in my opinion easily culminating in over $1,000,000,000 in costs. In this video I'll go over different aspects of Kotlin's null safety approach including the SAFE CALL OPERATOR, EL...
Virtual Threads in Java 21
Просмотров 4,4 тыс.6 месяцев назад
In this video we'll cover a relatively new feature to the Java language, VIRTUAL THREADS. We'll talk about some current BEST PRACTICES of using them and cover SIMPLE EXAMPLES of how you can use them in your code. I'm Will Tollefson, a guy who loves to NEVER STOP LEARNING and teach others what I've learned. If you're enjoying the content, please LIKE, SUBSCRIBE, and SHARE! LINKS: JEP 444: openjd...
Collections In Kotlin: Intro to List, Set, and Map
Просмотров 2377 месяцев назад
Some of the fundamental building blocks of Kotlin are the language's builtin COLLECTIONS: LIST, SET, and MAP. In this video we'll go through how to make these collections and talk about some of their similarities and differences. We'll also talk about MUTABLE vs READ-ONLY variants of these collections. I'm Will Tollefson, a guy who loves to NEVER STOP LEARNING and teach others what I've learned...
The Factory Design Pattern In Java
Просмотров 1,7 тыс.7 месяцев назад
There are multiple variants of the FACTORY DESIGN PATTERN IN JAVA. In this video, we'll go through the two most common adaptations, the SIMPLE FACTORY PATTERN and the (regular) FACTORY METHOD PATTERN. If the regular FACTORY PATTERN doesn't quite scratch your itch, I'd recommend you look at the ABSTRACT FACTORY PATTERN I'm Will Tollefson, a guy who loves to NEVER STOP LEARNING and teach others w...
Getting Started With Kotlin: The Basics
Просмотров 5247 месяцев назад
Let's write our FIRST KOTLIN PROGRAM! In this video, we'll make a KOTLIN HELLO WORLD program and then introduce concepts like VARIABLES and KOTLIN's TYPE INFERENCE, also scratching the surface of Kotlin's powerful STRING TEMPLATES. I'm Will Tollefson, a guy who loves to NEVER STOP LEARNING and teach others what I've learned. If you're enjoying the content, please LIKE, SUBSCRIBE, and SHARE! VID...
The Singleton Design Pattern In Java
Просмотров 7147 месяцев назад
Have you ever had to write a SINGLETON IN JAVA? They can be hard to get right - I had a few coding bugs while filming the video! There are also multiple different types between ENUM SINGLETONS, LAZY VS EAGER SINGLETONS, MULTI-THREADED DOUBLE CHECKED LOCKING SINGLETONS, the list goes on. Then there's the problem of preventing this design pattern from being broken, typically via REFLECTION. In th...
How to Create Your First Maven Java Project
Просмотров 6378 месяцев назад
How to Create Your First Maven Java Project
Java Just Got Easier to Learn and Teach | Java's New Hello World
Просмотров 1,1 тыс.8 месяцев назад
Java Just Got Easier to Learn and Teach | Java's New Hello World
Are You Using Java's Parallel Streams Correctly? - Java Programming
Просмотров 4,9 тыс.8 месяцев назад
Are You Using Java's Parallel Streams Correctly? - Java Programming
Countdown to Christmas Java Application Full Walkthrough - Java Programming
Просмотров 3748 месяцев назад
Countdown to Christmas Java Application Full Walkthrough - Java Programming
Java Annotations and How to Build Your Own Runtime Annotations - Java Programming
Просмотров 1,2 тыс.9 месяцев назад
Java Annotations and How to Build Your Own Runtime Annotations - Java Programming
How to Use JDBC to Read From a MySQL Database - Java Programming
Просмотров 6769 месяцев назад
How to Use JDBC to Read From a MySQL Database - Java Programming
Java Optionals, a Practical Walkthrough - Java Programming
Просмотров 8039 месяцев назад
Java Optionals, a Practical Walkthrough - Java Programming
Coding a Java Sudoku Solver - Java Programming
Просмотров 2,6 тыс.9 месяцев назад
Coding a Java Sudoku Solver - Java Programming
How to Really Debug Java Streams - Java Programming
Просмотров 8889 месяцев назад
How to Really Debug Java Streams - Java Programming
Reflection in Java: The Fundamentals - Java Programming
Просмотров 2,5 тыс.10 месяцев назад
Reflection in Java: The Fundamentals - Java Programming
Java's Stream API Explained - Java Programming
Просмотров 1,1 тыс.10 месяцев назад
Java's Stream API Explained - Java Programming
Checked and Unchecked Exceptions in Java - Java Programming
Просмотров 1,2 тыс.10 месяцев назад
Checked and Unchecked Exceptions in Java - Java Programming
Building a Snake Game in Java: A Complete Walkthrough - Java Programming
Просмотров 6 тыс.10 месяцев назад
Building a Snake Game in Java: A Complete Walkthrough - Java Programming
The Basics of Debugging Your Code in IntelliJ - Java Programming
Просмотров 10 тыс.11 месяцев назад
The Basics of Debugging Your Code in IntelliJ - Java Programming
Java Packages and Import Statements - Java programming
Просмотров 36411 месяцев назад
Java Packages and Import Statements - Java programming
can explain garbage collector
Do you want to know about how garbage collection works in Java in general, or specifically how it would pertain to something like a template expression?
For the measure performance Instance + Duration. Good Video
Thanks!
THANK YOU!!! Your video helped me understand the difference between the two after a Udemy course failed doing so. Granted, I had to pause a few times and look up more stuff that I forgot already, but now ... 🤯 And as a lover of keyboard shortcuts, the sout > System.out.println() made me incredibly happy.
Me at the start of this video: "Ah, how simple, I understand everything." After the 11th minute: "F-ck."
Threading issues and deadlocks can be some really interesting bugs to solve, which is why those thread dumps can be really useful!
Detailed explanation!! Subscribed already
For the reduce function, about what is happening. Is it (1001 + 1002 + ...) or (101 + 102 + ...) 12:32
Good catch - its supposed to be (101 + 102 + ...). I must have had the number "1000" in my head. Thanks for noting that!
filenotfound should really be unchecked because you have to run the code for it to see that the location is wrong for instance... very weird
A checked exception doesn’t necessarily mean an error can be detected at compile time or not (otherwise the compiler would just flag it right away). It just means that you have to provide explicit error handling code. Both checked and unchecked exceptions represent errors that can occur at runtime. The merits of checked exceptions are debatable, but among other checked exceptions, this one makes sense to me because there is reasonable likelihood of code hitting a case like this and you should have specific handling code available for it. Hopefully that helps clarify it a bit!
@@willtollefson thank you
great video
how do i keep playing again without quitting once started? i need to know for my assingment.
You can use another while loop to do that. For example if you want to keep the number range the same each time but select a different random number for each iteration, you could add a while loop around line 12.
this needs more views. Great Explanation , thank you
Thanks so much!
Thank you so much it helped a lot
You're welcome!
Phenomenal
Great explanation!
Glad to hear it!
Really enjoyed this tutorial! Great job man!
Thank you!
Great content! one suggestion on positive side, sometime your voice is not very clear and feels like you are too tired.
Thanks for the comment and suggestion! Admittedly I sometimes do my filming late at night because there often aren’t enough hours in the day. I’ll do my best to get better at this 🙂
Its cool feature definatly I will use but there are people in my company who would revert my code and use jackson instead to create json Don't know how to deal with foolish people specially when the have power and evil intension against you
Sometimes adopting new ways of doing things takes time. In this situation they aren’t adding the feature in its current state to the language and will probably preview an updated version in a later JDK. Hopefully you can reason with the other folks at your company one way or the other. I’ve often found logical reasoning works well for programmers that program computer logic everyday 🙂
@@willtollefson Thanks but sometimes you find yourself in a place where stubbornness prevails over rationality and logical reasoning. But it good these days we have people like you who help others to stay up to date with their videos and other content
Brilliant tutorial !! Thanks to this video, I think I can aim for Java silver!
Thanks a lot ! The best simple explanation I found about how to start debugging in Java. Clear, concise, straight to the point!
Glad to hear you liked it! Debuggers can be very useful for sure
Are you planning on doing Spring tutorials in the future?
That depends. Do you want to see Spring tutorials? 🙂
@@willtollefson of course !!! There are no good ones online. You explain the best both for new programmers and more advanced.
I'll be sure to get to this when I can! I've been taking a short break recently while I have a very little one at home, but I hope to get back into a more regular posting schedule in the future!
@@willtollefson thanks a bunch
It will removed in the future releases :(
Yeah, it was a good concept, but unfortunately had some design flaws that they are working out now. Hopefully it will have a come back in another preview coming up
Great Tutorial ! Greeting from Indonesia
Greetings! Thanks for the comment 🙂
+++
can someone from another network join the chat with this method
If I’m understanding your question correctly, you would need to setup a public IP address with this method that is reachable to other networks and as long as you had network connectivity and the same socket protocol, you should generally be able to communicate.
Perfect !!!
I am so glad I found this channel!
Great explanation!
I don't usually write comments, but of all the videos about lambda I've watched, it was yours that made it clear to me. Thanks buddy, have a good day.
Awesome, glad to hear it!
@@willtollefson Hey, I strongly agree with Mat. I don't write comments either, but finally now I understand lamdas... It's strange that you have so few viewers with such a great content. Thanks a lot!
That’s great! Maybe over time I’ll get more views, but I’m not in any rush. I’m glad to hear that the content is helpful!
hey man really nice teeth
Thanks! When I see my dentist in a few months I'll be sure to thank him :)
Awesome tutorial
Thanks!
Great video. Regarding 9:45, because it's an object reference then it's not cached by the thread? Is it always reading from the heap (or L3 perhaps)?
Since its an object reference, the local variable value (e.g. the reference value) is cached, but the object data itself remains on the heap, so as long as you don't change the object reference, you'll still reference the same heap data across all of the threads. This is why its preferred to mark the object reference as immutable because that helps give you guarantees about the concurrent protection of the value. It doesn't, however, guarantee concurrent modification protection of the underlying object, which is why we're using AtomicInteger.
@@willtollefson thanks, I'm surprised because if I understand correctly then objects are always read from the heap and the cost is significantly higher.
Great point. The JLS (to my knowledge) doesn’t specify any sort of read optimizations in this type of situation. Something like that could probably be implemented per JVM if it can detect situations where a more efficient read can happen on an object reference (and I’m sure it does)
Hi will. Can you do an advanced video about threads, synchronised, volatil etc ?
Thanks for the comment! Here are some videos I've done on those topics: Volatile and atomic: ruclips.net/video/31s_DzrkqZc/видео.html Synchronized: ruclips.net/video/FpNRXz696ZY/видео.html I've also done a few videos talking about runnables in general, virtual threads, and structured concurrency. If those don't scratch the itch, let me know and I can do a video on a specific threading topic.
@@willtollefson Great videos.
Great video, explanation and easy to understand, keep up the good work 👍
Thanks!
you're awesome man, you should have way more suscribers and views
Thank you!
Amazing motto Never Stop Learning!
Thanks! It’s definitely something I try to follow almost every day
Thank you! Really simple it seems, haven't had to use one yet until now for my personal projects, and it seems like the Semaphores meet my needs easily. I was worried that I would've needed something more complex. Did you ever get around to making that lock video? I am going to be watching some of your other concurrency videos soon though to see what the other solutions look like.
That lock video is on my short list right now of future videos to make. There are multiple flavors of locks - if there's a particular thing you want me to cover in that video, let me know!
Great stuff man! I really find your explanations very useful. Thanks for sharing
You’re welcome, thanks for the comment!
Very good examples. Thank you very much for sharing
Glad you enjoyed it!
Please don't use `var`. It irritates the mind.
Personal preference I suppose 🙂 I know folks who use it every chance they get and others that wish it was never added to the language. What are your thoughts on it? I agree with a lot of what is stated here: openjdk.org/projects/amber/guides/lvti-style-guide
It takes 1.3 seconds on average to run 100,000 concurrent "1 second sleep" tasks in Go. This is 4 times faster than in your example. Is it expected? I didn't run Java version on my machine (I don't have it), but my laptop is not a super computer by any means. And just for the fun of it, I ran with 1M concurrent tasks and it took 3.1 seconds on average. And then, for even more fun, I ran it with 10M tasks; finally it was slower than 5 seconds, 11 seconds to be exact. I wonder if you can try your code with 1M tasks and share your results.
Thanks for the comment! When I run 1M tasks on my machine with the Java version, I'm getting 10-11 seconds. When I run similar Go code on my machine I'm getting around 5 seconds. Without deep diving the compiled byte code and go binary to really figure out the performance difference, I have a few upfront guesses: 1. Java warm up could be playing a small role here due to lazy initialization for things like the classloader and virtual threads mapping to platform threads 2. Java and Go have different default behavior for the number of routines that can be executed in parallel and the number of OS threads available to the runtime for scheduling. 3. Goroutines are optimized to have a small stack size at the beginning of execution and then expand as needed. I'm wondering if stack allocation for Java virtual threads is more expensive in this case. Both are still MUCH better in this example than the previous Java thread model though :)
Sleeping for 1 second is probably not a very realistic example and goroutine smaller starting stack may explain the difference
Thank you for your detailed videos! Any chance creating one about the classloader?
Sure! I'll need to do a refresher myself on some of the lower level specifics, but I think this is a great idea
Great video! Could you please do a video about daemon thread, and thread interrupt exception. If there is, I haven't seen it.
Thanks for the comment! Yes I can do a video on that. I haven't hit on that subject yet
Thanks a lot. Subscribing now..
Thanks for reminding us that there is a such thing as over-designing things and making them more difficult to manage and read. But the decoupling concept is quite well explained and important.
You bet! It’s a difficult balance to maintain for sure
String templates will not ship in its current state, and was dropped for JDK23
Good point - I probably should have mentioned that :) Per what I’ve seen from Brian Goetz they are reworking it and as of now planning some API changes that will make it into future versions. There are pros and cons to trying out preview features and this is why they call them previews. Glad we’re making the changes now though rather than having them in the main language
The string templates feature looks awesome, Will. Excellent video showing this new capability!
Thanks! 👍
You hit quite a few good points in one short vid.
Thanks!
Crucial info for those getting unexpected results from their stream. I hope Netbeans debugger will give me this view as well.