Mike Gosling

Ranch Hand
+ Follow
since May 19, 2016
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Mike Gosling

Hello Ken,

As you may know, good chunk of us here are using Spring in our daily life. Can you explain me how does content of your book can help in understanding Spring's Mockito wrapper around core Mockito?

I have very thin understanding of what you exactly are stubs/spies etc, when to used them etc. Seems to me that Im struggling more how to understand connection Spring-Mockito rather then Mockito iteself.

In short, does your book can help us using Mockito with Spring?
2 years ago
AhH, I thought that OP who initiated thread well get a prize In any case, questions are somewhat relevant if anyone decides to buy a book, who knows..
2 years ago
Maybe Jeremy can reply back as separate answers.
2 years ago
Hello,

Would be super grateful if someone can explain me how wait/notify/notifyAll works and if is there better solution for the problem I am facing. Basically, we have to send a bunch of SMS messages. For sending messages an object called SMPPSession is used but in this example I'll just use superficial code. SMPPSession is supposed to send messages to SMSC server and to reestablish session in situations when connection breaks.  I would like to use multiple threads for sending multiple messages, and to have a separate single thread, some sort of "guardian"/ "watcher"/"notifier".  The role of that separate thread is to stop all other threads from executing their code, while it works on reestablishing session. Naturally, SMPPSession is shared among all these threads. Once that guardian finishes reconnecting, all other thread needs to continue with using the session and proceed with sending.

Now, I have some code and getting exception. Any help?

In reality we do send real SMS messages using jsmpp library and inside it there is SMPPSession object.



In order to make it visual:

Hello,

Are there any practical exercise/assignments in your book after each chapter? Or it is project based perhaps?

Also, which programming language is used to explain concepts? Which book you would recommend after reading yours?

How much does your style of writing about DS is differ from say Head First approach series?

Hope you have a success with your book
2 years ago
Hi,

The title of your books really does sound templating.

Would like to know your thoughts why do average Java developer would need to understand byte code manipulation? I have no idea what it is.. I will take a look later today.. I mean, majority of Java developers are using Spring (Boot) and how does knowledge from your book can be used within the context of Spring?

Second thing, I see that Part 3, 4 and 5 are somewhat unrelated? Are they? Or in your book they should be read one after the other if they are related? If they are, can you explain how do you make connection between maven and functional programming?

Regarding concurrency, I myself haven't actually studied concurrent programming at school, I did however employ CompletableFutures at work for doing (commutative) operation upon some large dto (to examine different sections of it in parallel). What will be your advice to learn concurrency, for someone who doesn't have a lot of strong CS core background, didn't learn assembler for instance. Can your book help on learning concurrency by example?

Don't get me wrong. I am not trying to say bad about your work or anything along those lines..
2 years ago
I am studying for OCP17 exam. Currently starting with Streams chapter.



When I manully compile, I get:



Why doesn't numeric type promotion from int to double doesn't apply here?

If I would have to guess (hopefully some will explain me this):



Java is capable to do boxing for one type of primitives to its corresponding boxed class, but not between various boxed types.
Hopefully this would help.



Please go through this tutorial (https://docs.oracle.com/javase/tutorial/java/generics/index.html) and combined with this thread it should make sense. It helped me I am know seeing that List<? super T> is more convenient for addition and that List<? extends T> is more handy for getting things.
Hey Liutauras, thanks for excellent post. After reading Oracle's tutorial on generics it became a bit clearer, but now with your post, these wildcards are becoming far more clearer now. I will just follow your strategy for determining what can be added/removed in generics with bounded wildcards.

Good thing you dismantled my example  

While explaining Lower-Bounded Wildcards in table 9.14, authors wrote that unbounded generics are immutable. This may not be entirely correct since it is allowed to add null values.



Oracle docs: https://docs.oracle.com/javase/tutorial/java/generics/wildcardGuidelines.html
Thanks Stephan, I must make sure to memorize this.
So from the OCP Java17 they give an example on what method call will compile, "line a" or "line b"?



I wanted to check with you guys if my way of "reasoning" is correct:

First I notice I'm dealing with two classes which have common interface, also I notice I'm dealing with parameterized collections. So I envision three groups of hierarchies like so:



First lets check anyFlyer.

Since formal parameter of anyFlyer is List<Flyer> the object it points to, if we were to write it somewhere in the code, it could only:



It couldn't be:



This is because of parameterized types (I'm not sure are there any more reasons or is this correct):



So flyer can only be pointing to appropriate parameterized collection.

Having that  in mind, passing variable x, to anyFlyer would cause compilation error.

Lets check groupOfFlyers:

If we take a look at third group of hierarchies, we can see 'List<? extends Flyer>'. These can be type for (I don't know proper term) four objects (options ?), that would compile:



And since they all compile and x is one of them, f1, then we can safely say "Line b" is the one which does compile.


I'm interested to hear is this good way to reason about?



I am reading tutorial from Oracle on Generics (https://docs.oracle.com/javase/tutorial/java/generics/upperBounded.html)

I don't understand why the last piece of code compiles>



Is there any kind of java library, that can determine whether some class satisfies criterias of immutability?

Something like a simple method call:

2 years ago