Hello dear subscribers and guests 👋
Let's go through a few questions about JUnit to get a better sense of what you're most interested in
Let's go through a few questions about JUnit to get a better sense of what you're most interested in
Please open Telegram to view this post
VIEW IN TELEGRAM
Which of the following is true about @Test in JUnit 5?
Anonymous Quiz
11%
It requires to specify “public” access modifier for test methods
22%
A test method must return “void”
22%
It can take “timeout” and “expected” attributes
33%
It no longer requires test methods to be “public”
11%
I don’t know what JUnit is 😊
What annotation is used in JUnit 5 to indicate that a test should be disabled?
Anonymous Quiz
42%
42%
8%
8%
What is the correct way to write an assertion for throwing an exception in JUnit 5?
Anonymous Quiz
71%
assertThrows(IllegalArgumentException.class, () -> { // code });
7%
assertThrows(() -> { // code });
7%
assertEquals(IllegalArgumentException.class, () -> { // code });
14%
assertThrows(new IllegalArgumentException(), () -> { // code });
How much Java 👩💻 is in JDK 21? The majority of JDK 21 is made up of Java classes, which are part of the core JDK. However, a significant portion (about 21%) is still written in C and C++, reflecting their use in the underlying JVM implementation and other performance-critical components.
Please open Telegram to view this post
VIEW IN TELEGRAM
YAJC become Java programmer
How much Java 👩💻 is in JDK 21? The majority of JDK 21 is made up of Java classes, which are part of the core JDK. However, a significant portion (about 21%) is still written in C and C++, reflecting their use in the underlying JVM implementation and other…
Please open Telegram to view this post
VIEW IN TELEGRAM
Why is Testing Java Programs a Must?
Hey there, Java enthusiasts! 😊 Let’s talk about something super important but sometimes overlooked—testing your Java programs! It’s easy to get excited about building new features and making your code run, but taking a little extra time to test can be a game-changer for your project. Some developers argue that having clear, well-written tests can be even more valuable than elegant production code. Here’s why:
1. Catch Bugs Early🐞
Even the most skilled developers make mistakes—no shame in it! But testing can catch these bugs early, before they grow into bigger issues. Imagine deploying a program only to find out that one tiny bug affects a critical part of your app. That’s a nightmare, right? Testing helps you sleep better at night, knowing your code is more reliable.
2. Build Confidence in Your Code
When you write tests, you’re essentially saying, “I trust my code to do what it’s supposed to.” It’s like having a safety net! With automated tests, you’ll know immediately if a change breaks something. This gives you the freedom to refactor, optimize, and add features without the fear of breaking existing functionality.
3. Save Time (and Headaches) in the Long Run
While writing tests might seem time-consuming at first, it actually saves you a lot of time in the long run. Without tests, every little change means you’d have to manually check each part of your code to see if it still works. Automated tests do this work for you, allowing you to focus on the fun stuff—like coding the next big feature!
4. Improve Code Quality⚠️
Testing isn’t just about finding bugs; it also forces you to write cleaner, more modular code. When your code is structured well, it’s easier to write tests for it. Plus, testing can reveal hidden dependencies or areas that need improvement, making your overall codebase stronger and more maintainable.
5. Better Team Collaboration
If you’re working in a team, testing is crucial. It creates a shared understanding of how the code should behave and makes it easier for everyone to work on different parts of the project without stepping on each other’s toes. Plus, code reviews are way smoother when tests are in place!
Wrapping Up
Testing isn’t just an extra task; it’s an investment in the quality and reliability of your Java programs. So, next time you’re coding away, take a moment to add some tests—it’ll pay off in more ways than one!🚀
In upcoming posts, we’ll explore effective ways to test your programs and look at the best tools available to help you do it.
Happy coding, and may your tests always pass!✅
Hit that🔥 if this topic sparks your interest!
Hey there, Java enthusiasts! 😊 Let’s talk about something super important but sometimes overlooked—testing your Java programs! It’s easy to get excited about building new features and making your code run, but taking a little extra time to test can be a game-changer for your project. Some developers argue that having clear, well-written tests can be even more valuable than elegant production code. Here’s why:
1. Catch Bugs Early
Even the most skilled developers make mistakes—no shame in it! But testing can catch these bugs early, before they grow into bigger issues. Imagine deploying a program only to find out that one tiny bug affects a critical part of your app. That’s a nightmare, right? Testing helps you sleep better at night, knowing your code is more reliable.
2. Build Confidence in Your Code
When you write tests, you’re essentially saying, “I trust my code to do what it’s supposed to.” It’s like having a safety net! With automated tests, you’ll know immediately if a change breaks something. This gives you the freedom to refactor, optimize, and add features without the fear of breaking existing functionality.
3. Save Time (and Headaches) in the Long Run
While writing tests might seem time-consuming at first, it actually saves you a lot of time in the long run. Without tests, every little change means you’d have to manually check each part of your code to see if it still works. Automated tests do this work for you, allowing you to focus on the fun stuff—like coding the next big feature!
4. Improve Code Quality
Testing isn’t just about finding bugs; it also forces you to write cleaner, more modular code. When your code is structured well, it’s easier to write tests for it. Plus, testing can reveal hidden dependencies or areas that need improvement, making your overall codebase stronger and more maintainable.
5. Better Team Collaboration
If you’re working in a team, testing is crucial. It creates a shared understanding of how the code should behave and makes it easier for everyone to work on different parts of the project without stepping on each other’s toes. Plus, code reviews are way smoother when tests are in place!
Wrapping Up
Testing isn’t just an extra task; it’s an investment in the quality and reliability of your Java programs. So, next time you’re coding away, take a moment to add some tests—it’ll pay off in more ways than one!
In upcoming posts, we’ll explore effective ways to test your programs and look at the best tools available to help you do it.
Happy coding, and may your tests always pass!
Hit that
Please open Telegram to view this post
VIEW IN TELEGRAM
👍1🔥1
Testing Without Testing Frameworks
In our previous post, we discussed why testing is essential in software development😎
Today, let's explore how to test a program without using any testing frameworks like JUnit. Imagine we're developing a video game based on Harry Potter 🧙♂️. Our goal is to implement and test a basic
Here's a simple version of the class, where Harry can cast spells:
With this setup, Harry can cast different spells based on his level. Now, we want to ensure that our HarryPotter class works correctly. Since we aren't using any testing frameworks, we'll try a few simple approaches:
Approach 1: Testing with main Method and Console Output
The first approach is to add testing code directly to a main method, creating an instance of HarryPotter and checking the output manually. Here's an example:
Drawback: This approach relies on us checking the console output manually, which can be tedious and error-prone, especially for larger programs.
Approach 2: Using Simple Assertions
To make testing easier, we can add basic assertion-like checks to automatically verify the output. By comparing expected values with actual values and throwing an exception if they don't match, we avoid manually inspecting the output. Here's how:
Now, if a test fails, an exception is thrown, pointing us directly to the issue. This is a more effective way to test compared to simply printing results.
Summary
Testing without frameworks may not be as streamlined as using JUnit, but simple assertions in the main method can still help catch basic issues. This approach provides instant feedback on whether the method behaves as expected.
In our previous post, we discussed why testing is essential in software development
Today, let's explore how to test a program without using any testing frameworks like JUnit. Imagine we're developing a video game based on Harry Potter 🧙♂️. Our goal is to implement and test a basic
HarryPotter class that represents our main character.Here's a simple version of the class, where Harry can cast spells:
public class HarryPotter {
private int level; // Harry's level
private String[] spells = new String[] { "Lumos", "Expelliarmus", "Expecto Patronum" };
private int spellIndex = 0; // Index to cycle through all available spells
public HarryPotter(int level) {
this.level = level;
}
public String castSpell() {
String spell = spells[spellIndex];
spellIndex = spellIndex % level; // Using mod to cycle spells based on level
return spell + "!";
}
}
With this setup, Harry can cast different spells based on his level. Now, we want to ensure that our HarryPotter class works correctly. Since we aren't using any testing frameworks, we'll try a few simple approaches:
Approach 1: Testing with main Method and Console Output
The first approach is to add testing code directly to a main method, creating an instance of HarryPotter and checking the output manually. Here's an example:
public class Test {
public static void main(String[] args) {
HarryPotter harry = new HarryPotter(2);
System.out.println("Spell 1: " + harry.castSpell());
System.out.println("Spell 2: " + harry.castSpell());
}
}
Drawback: This approach relies on us checking the console output manually, which can be tedious and error-prone, especially for larger programs.
Approach 2: Using Simple Assertions
To make testing easier, we can add basic assertion-like checks to automatically verify the output. By comparing expected values with actual values and throwing an exception if they don't match, we avoid manually inspecting the output. Here's how:
public class Test {
public static void main(String[] args) {
HarryPotter harry = new HarryPotter(2);
if (!harry.castSpell().equals("Lumos!")) {
throw new RuntimeException("First spell should be Lumos!");
}
if (!harry.castSpell().equals("Expelliarmus!")) {
throw new RuntimeException("Second spell should be Expelliarmus!");
}
}
}
Now, if a test fails, an exception is thrown, pointing us directly to the issue. This is a more effective way to test compared to simply printing results.
Summary
Testing without frameworks may not be as streamlined as using JUnit, but simple assertions in the main method can still help catch basic issues. This approach provides instant feedback on whether the method behaves as expected.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤1👍1🔥1
The💪 :
https://nextleap.app/online-compiler/java-programming/m7x3nbndn
Feel free to share your thoughts in the comments! If you enjoyed the challenge, drop a👍 or ❤️
HarryPotter#castSpell method has a bug - see if you can spot and fix it https://nextleap.app/online-compiler/java-programming/m7x3nbndn
Feel free to share your thoughts in the comments! If you enjoyed the challenge, drop a
Please open Telegram to view this post
VIEW IN TELEGRAM
❤1 1
Your thoughts on this post?
Anonymous Poll
13%
Too challenging
0%
A bit long…
25%
Just right!
63%
I’m ready for JUnit!
What is the output of the following code?
Anonymous Quiz
15%
15 Java 5 10
42%
15 Java 15
24%
15 Java 510
18%
510 Java 510
Hey everyone! 👋
I wanted to take a moment to share some thoughts about this channel and why the activity here has been low🔋
When I started this channel, my goal was to help beginner developers get into Java📱 development - sharing insights on technologies, learning paths, and best practices. However, over time, I noticed that there was very little engagement - few likes, comments, or discussions. And to be honest, that affected my motivation. Without feedback, it’s hard to understand if the content is actually useful or interesting.
Because of this, I decided to focus on something that would be more engaging for me personally - learning new technologies while sharing my progress. Recently, I started a new channel where I document my journey of learning Swift🔢 and SwiftUI 👶 This time, I’m writing in Russian, so if you understand the language and are interested in 🍏 development, feel free to check it out: https://t.me/+9Y323c-9kkw1MzBi
That’s not all! In the near future, I’m planning to create another channel where I will share my experience learning AWS👩💻 and Google Cloud 👩💻
This one will be in English, just like this Java channel.
I appreciate everyone who has been here, and if you’re interested in my new journey - whether it’s Swift now or cloud technologies in the future - stay tuned!
Let’s keep learning together!🚀
I wanted to take a moment to share some thoughts about this channel and why the activity here has been low
When I started this channel, my goal was to help beginner developers get into Java
Because of this, I decided to focus on something that would be more engaging for me personally - learning new technologies while sharing my progress. Recently, I started a new channel where I document my journey of learning Swift
That’s not all! In the near future, I’m planning to create another channel where I will share my experience learning AWS
This one will be in English, just like this Java channel.
I appreciate everyone who has been here, and if you’re interested in my new journey - whether it’s Swift now or cloud technologies in the future - stay tuned!
Let’s keep learning together!
Please open Telegram to view this post
VIEW IN TELEGRAM
Telegram
Kotlin/Swift (iOS) Туда и Обратно
Канал - журнал, рассказывающий об опыте изучения Swift & iOS backend-разработчиком на Java & Kotlin
How to Ask ChatGPT 📱 as a Beginner Developer (and Not Get Burned)
🔤 🔤 - Intro
When I was just starting to code, ChatGPT didn’t exist.
(Yes, I’m that old. Okay, maybe not that old, but you get the point.)
Back then, I had to google endlessly, dig through Stack Overflow threads from 2012, and cry over cryptic compiler errors that no one seemed to explain well. So when ChatGPT appeared, I was like - wow. This changes everything.
But here’s the catch: it also makes it dangerously easy to stop thinking. To just copy-paste code that looks right but isn’t. Especially if you’re just getting started.
That’s why I’m writing this mini-series - short, honest posts for beginners or junior devs on how to actually use ChatGPT to learn, not just survive.
If you’re new to coding, or even just feeling a bit lost - you’re not alone.
I’ll try to keep things short, real, and sometimes a little bit funny.
Stay tuned for Post🔤 🔤
When I was just starting to code, ChatGPT didn’t exist.
(Yes, I’m that old. Okay, maybe not that old, but you get the point.)
Back then, I had to google endlessly, dig through Stack Overflow threads from 2012, and cry over cryptic compiler errors that no one seemed to explain well. So when ChatGPT appeared, I was like - wow. This changes everything.
But here’s the catch: it also makes it dangerously easy to stop thinking. To just copy-paste code that looks right but isn’t. Especially if you’re just getting started.
That’s why I’m writing this mini-series - short, honest posts for beginners or junior devs on how to actually use ChatGPT to learn, not just survive.
If you’re new to coding, or even just feeling a bit lost - you’re not alone.
I’ll try to keep things short, real, and sometimes a little bit funny.
Stay tuned for Post
Please open Telegram to view this post
VIEW IN TELEGRAM
❤3
Post 🔤 🔤 - Always run the code
When ChatGPT first came out, I was amazed.
You could ask: “How do I sort a list?” - and💥 it gives you code. Clean, confident, senior-style 😎
You copy it. Paste it. Move on.
But then you realize:
- it doesn’t compile😵
- the method doesn’t exist😵💫
- or worse - it kind of works, but not the way you want🤨
As a beginner, it’s so easy to stop thinking and just trust the code. I’ve been there - that’s why I’m saying:
Always run the code.
📌 Run it in your IDE, in a Playground, or in an online sandbox. Make sure:
🟡 it compiles,
🟡 it behaves as expected,
🟡 and you roughly understand what it’s doing.
Want to level up faster?
Write a quick note to yourself: what did you just learn? Even a sentence helps.
🙃 ChatGPT is a great assistant, but it can make mistakes.
You’re not dumb - you just need to check the code.
So:
Trust, but verify. Run it. Watch it. Understand it.
When ChatGPT first came out, I was amazed.
You could ask: “How do I sort a list?” - and
You copy it. Paste it. Move on.
But then you realize:
- it doesn’t compile
- the method doesn’t exist
- or worse - it kind of works, but not the way you want
As a beginner, it’s so easy to stop thinking and just trust the code. I’ve been there - that’s why I’m saying:
Always run the code.
Want to level up faster?
Write a quick note to yourself: what did you just learn? Even a sentence helps.
🙃 ChatGPT is a great assistant, but it can make mistakes.
You’re not dumb - you just need to check the code.
So:
Trust, but verify. Run it. Watch it. Understand it.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤2
Post 🔤 🔤 - Don't just ask "how", ask "why"
When I work with Java, it's all crystal clear: I know the ecosystem, I understand what's going on under the hood, and any steps from ChatGPT or documentation feel like an open book📖 But recently I started learning Swift and SwiftUI - and things got trickier.
Sure, you can just follow step-by-step instructions: copy, paste, run - done. But without knowing why it works, you risk falling into the "magic" trap. It's fine today, but tomorrow the context changes, and the code breaks - and you have no clue where to start debugging.
That's why I always try to dig deeper. If ChatGPT gives me an answer, I'll ask: why is it like this? what if I do it differently? are there alternatives?
⚠️ One catch: this can take a lot of time. The tree of topics can grow wide and deep. You ask about one thing, and the explanation sparks more questions. Sometimes you start with a SwiftUI layout question and end up discussing CPU architecture 🤯 ChatGPT doesn't always know when to stop, so sometimes it's better to have a mentor who will say, "Enough, go write code".
💡 My tip: when learning something new, switch between two modes - "just get it done" and "now understand why it works". That way you get both results and lasting knowledge.
When I work with Java, it's all crystal clear: I know the ecosystem, I understand what's going on under the hood, and any steps from ChatGPT or documentation feel like an open book
Sure, you can just follow step-by-step instructions: copy, paste, run - done. But without knowing why it works, you risk falling into the "magic" trap. It's fine today, but tomorrow the context changes, and the code breaks - and you have no clue where to start debugging.
That's why I always try to dig deeper. If ChatGPT gives me an answer, I'll ask: why is it like this? what if I do it differently? are there alternatives?
Please open Telegram to view this post
VIEW IN TELEGRAM
Post 🔤 🔤 - Check the docs, not just the bot
One of the most dangerous traps when working with ChatGPT is trusting it too much.
I often see this - and sometimes catch myself doing it too - when ChatGPT confidently provides:
🔸 method names
🔸 function signatures
🔸 parameters
🔸 a "recommended" way to use an API
And it all looks very convincing😌
Especially when you're working with a technology that's new to you - like Swift / SwiftUI or some cloud SDK.
But here's the key thing: ChatGPT is not a compiler and not official documentation.
It can:
🔸 mix up API versions
🔸 suggest outdated approaches
🔸 or simply invent a method that sounds logical but doesn’t actually exist 🤷♂️
In Java, I usually notice this immediately.
In a new tech stack - not always. And that's exactly where official documentation becomes critical.
📌 If ChatGPT suggests:
🔸 a new method
🔸 an annotation
🔸 a modifier
- pause and open the docs.
Apple Docs, Oracle Docs, AWS Docs - it doesn't matter. That's your source of truth.
Yes, reading docs is harder than copy-pasting code. But they give you context, constraints, and real-world examples.
🤖 I treat ChatGPT like a navigator:
"Show me the direction" - yes.
"Be the single source of truth" - no.
💡 A good rule of thumb:
ChatGPT👉 ideas and explanations
Documentation👉 verification and details
One of the most dangerous traps when working with ChatGPT is trusting it too much.
I often see this - and sometimes catch myself doing it too - when ChatGPT confidently provides:
And it all looks very convincing
Especially when you're working with a technology that's new to you - like Swift / SwiftUI or some cloud SDK.
But here's the key thing: ChatGPT is not a compiler and not official documentation.
It can:
In Java, I usually notice this immediately.
In a new tech stack - not always. And that's exactly where official documentation becomes critical.
- pause and open the docs.
Apple Docs, Oracle Docs, AWS Docs - it doesn't matter. That's your source of truth.
Yes, reading docs is harder than copy-pasting code. But they give you context, constraints, and real-world examples.
"Show me the direction" - yes.
"Be the single source of truth" - no.
ChatGPT
Documentation
Please open Telegram to view this post
VIEW IN TELEGRAM
👍1🔥1
Post 🔤 🔤 - Compare multiple answers
One thing I noticed when working with ChatGPT:
the first answer is not always the best one.
Most of the time, it's... decent.
It works, it looks fine - but that doesn't mean it's the right solution for your case.
I've had situations where ChatGPT🤖 gave me a solution, I implemented it... and later realized:
- it's not idiomatic
- it's overcomplicated
- or there's a much simpler way to do the same thing😅
This happens a lot when you're working with a new technology.
For example, in SwiftUI📱 there are often multiple ways to build the same UI - but some are much more "native" than others.
📌 What helped me:
I started asking the same question in different ways.
For example:
🔴 Is there a simpler way to do this?
🔴 What would be a more idiomatic solution?
🔴 How would an experienced developer approach this?
And suddenly - I get a completely different answer. Sometimes much better.
🤖 ChatGPT doesn't really "think" in one fixed solution. It generates responses.
So by rephrasing your question, you explore different parts of the solution space.
⚠️ Important:
Don't just collect answers - compare them.
Ask yourself:
🔴 Which one is easier?
🔴 Which one is more readable?
🔴 Which one fits the ecosystem better?
💡 My rule:
If something feels a bit "off" - ask again.
It's cheap, fast, and often gives you a better result.
One thing I noticed when working with ChatGPT:
the first answer is not always the best one.
Most of the time, it's... decent.
It works, it looks fine - but that doesn't mean it's the right solution for your case.
I've had situations where ChatGPT
- it's not idiomatic
- it's overcomplicated
- or there's a much simpler way to do the same thing
This happens a lot when you're working with a new technology.
For example, in SwiftUI
I started asking the same question in different ways.
For example:
And suddenly - I get a completely different answer. Sometimes much better.
So by rephrasing your question, you explore different parts of the solution space.
Don't just collect answers - compare them.
Ask yourself:
If something feels a bit "off" - ask again.
It's cheap, fast, and often gives you a better result.
Please open Telegram to view this post
VIEW IN TELEGRAM
Hello my dear readers! I would like to advertise my another channel where I tell about a microcontroller based project: traffic light 🚦
This is the electronics & programming worlds together. What could be more exciting?😎
https://t.me/BitByBitLab
This is the electronics & programming worlds together. What could be more exciting?
https://t.me/BitByBitLab
Please open Telegram to view this post
VIEW IN TELEGRAM
Telegram
Bit by Bit Lab
Building things across software and hardware.
This is my engineering log:
- backend (Java/Kotlin), iOS, and general programming
- microcontrollers, Arduino, Raspberry Pi
- small DIY projects and experiments
- tools, setups, and things I’m learning
This is my engineering log:
- backend (Java/Kotlin), iOS, and general programming
- microcontrollers, Arduino, Raspberry Pi
- small DIY projects and experiments
- tools, setups, and things I’m learning
❤1👍1