Win a copy of Head First Android this week in the Android forum!

Kenneth A. Kousen

gunslinger & author
+ Follow
since Sep 18, 2002
I am a Java Champion, Oracle Groundbreaker Ambassador, and a Grails Rock Star. I am the author of the O'Reilly books "Kotlin Cookbook", "Modern Java Recipes", and "Gradle Recipes for Android", and the Manning book "Making Java Groovy", and have recorded over a dozen video courses for the O'Reilly Learning Platform covering topics related to Android, Spring, Java, Groovy, Grails, and Gradle. I am also a regular speaker on the No Fluff, Just Stuff conference tour.

I won the JavaOne Rockstar award three times. My academic background include BS degrees in Mechanical Engineering and Mathematics from M.I.T., an MA and Ph.D. in Aerospace Engineering from Princeton, and an MS in Computer Science from R.P.I. I am currently President of Kousen IT, Inc., based in Connecticut.

Blog: https://kousenit.org
Newsletter, Tales from the jar side: https://kenkousen.substack.com
Marlborough, CT
Cows and Likes
Cows
Total received
11
In last 30 days
0
Total given
0
Likes
Total received
34
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kenneth A. Kousen

Can a boss provide too much feedback? Sure, especially if they are being a micromanager. The issue is whether you want them to stop or not. To do so, you have to push back, and I talk in a lot of detail about how to do that in a way that does not threaten the loyalty relationship.

Here are a couple of Medium posts about it:

When Your Boss Is A Micromanager
https://medium.com/pragmatic-programmers/micromanagers-ken-kousen-93c1a97f29d7

and

Pushing Back: Lessons from the Prisoner's Dilemma
https://medium.com/pragmatic-programmers/pushing-back-lessons-from-the-prisoners-dilemma-451b948c6f1d

(I'm publishing posts on Medium so I can be part of the Pragmatic Programmer's publication there.)

So it really depends on whether the feedback is welcome or not.
3 months ago
A couple of things:

1. You might want to ask that question in the Jobs Discussion forum but in any topic other than this one, as this topic is ineligible for the drawing for free books. The number of question is still really low, so you have a good chance of winning one.

2. Thanks for appreciating the Kousen IT gag. I still say "Eye-Tee", but my wife pronounces it like I'm a member of the Addams Family.

Ken
3 months ago
It sounds sad, but (1) I took pictures, and (2) I got a story out of it, which I've used several times since.

It's true that most software developers used to buy ebooks directly from the publishers, like Manning or Pragmatic Programmers. But some of that is changing. For example, right before my Modern Java Recipes book came out, O'Reilly got rid of their online bookstore. Now they only supply books to distributors, and instead sell subscriptions to their own online O'Reilly Learning Platform. If you want a physical book, they actually link to Amazon.

It will be interesting to see how that evolves over time. For my current book, HYBHY, the Prag site https://pragprog.com/titles/kkmanage/help-your-boss-help-you/ only sells ebooks. If you want a print version, you go to Amazon https://www.amazon.com/Help-Your-Boss-You-Opportunities/dp/1680508229/ref=sr_1_4 .

Of course, that means when I give out coupon codes, they only work for the ebooks. I have no control over Amazon.

Btw, I'm in the process of preparing an audiobook version, which will be available through Audible (now a division of Amazon, sigh), iTunes, and some others.
3 months ago
On the humor front, when I wrote the Kotlin Cookbook, a non-technical friend of mine asked if it was a cookbook on how to cook kotlins, whatever they were. I think that person was joking, but in response I grabbed a copy of the book at my local Barnes and Noble and moved it over to the Cooking section to see what would happen.

When I revisited it about a week later, it had been returned to the IT section. Oh well.

Incidentally, the only reason my local B&N had those copies is because I asked them to order some. I signed them all and then waited as they sat on the shelf, fermenting, until eventually they got sent back to the publisher.

For HYBHY (my current book), Amazon still lists it as #1 New Release in Business Communication (#2 in Business Ethics) and claims it was released on July 27. If you look at B&N's web site, however, it claims the book doesn't come out until October, though you can pre-order it. That may hurt sales a bit.
3 months ago
Hi Tim,

Presumably the "coffee" book Campbell is referring to is Modern Java Recipes, http://shop.oreilly.com/product/0636920056669.do. I'm glad you liked Making Java Groovy. My other books are Gradle Recipes for Android, http://shop.oreilly.com/product/0636920032656.do and Kotlin Cookbook, http://shop.oreilly.com/product/0636920224327.do.

Help Your Boss Help You is really different for me, since it's my first non-technical book, though most of the examples come from my years in the engineering and IT industries.
3 months ago
The book is about building a relationship with your manager that gets you what you want in your job and your career. I definitely address manager experience levels, especially when dealing with rookie managers or managers promoted from the technical ranks. I don't talk much about employee experience levels, though I have a section on older employees reporting to younger managers.

Is there something specific you were wondering about?

Ken
3 months ago

Campbell Ritchie wrote:Good to see you here This book looks different from what I already have: your other book was about cooking coffee.



Okay, that's funny.
3 months ago
Hi Jude,

In terms of testing, I have several recipes that show how to write JUnit tests with Kotlin, which can test code written in either Kotlin or Java.  (You can find an annotated listing of all the recipes here).

Mixing Java and Kotlin in the same project is easy. In fact, every Android project already does that, because the Android SDK itself is still written in Java, which shows Kotlin classes can extend Java classes, or implement Java interfaces, and so on.

So adding Kotlin to an existing Java project is certainly doable. Add the appropriate Kotlin dependencies to your build tool and go from there. The GitHub repository for the book is a mixed Java/Kotlin project. I was planning to add a handful of recipes specifically on integration, but (1) I ran out of time and (2) it's actually easy enough that it hardly required recipes for it. Just instantiate the classes from the other language and invoke their methods as usual.
1 year ago
Spring has great support for Kotlin. You can use Kotlin classes as Spring beans, and Spring defined a series of extension methods that make the coding simpler. It even defined a DSL for bean configuration and a DSL for defining routing functions for reactive services.

There's an interesting design consideration involved, however. In Kotlin, all classes are final (i.e., can't be extended) by default, and Spring does a lot of its job through the Proxy design pattern. That means, for example, that if you annotate a Spring service with @Transactional, Spring needs to extend the class, so each method call can be intercepted and wrapped in a transaction.

In order to make that work with Kotlin, the Spring team defined an "all-open" plugin which opens Spring-managed beans for extension. From a user point of view, it's easy. You just add the plugin and code as usual. But the fact they had to do it makes me question whether "static binding by default" (making the classes final) was a good idea in the first place.

So Spring definitely likes working with Kotlin, but will they favor it in the future? I doubt that. Spring also has excellent support for Groovy, but even though that's also a language offered in the Spring Initializr (like Kotlin), it certainly hasn't replaced Java as the primary language for Spring apps.

I have some of this documented in my book, if you're interested, but just look at the web pages for Kotlin and Spring and you'll see these issues discussed in some detail. That's also a good example of how to sell Kotlin to Java developers, because the Spring people are doing that in their Kotlin API.
1 year ago
The so-called "multi-platform" part of Kotlin allows you to use the same code in many different types of systems. The page here has the basic information.

Wow. It turns out the Kotlin home page https://kotlinlang.org updated *today*, so everything looks different. I don't see the same info about available systems that was there yesterday, so I guess I'll have to look around for it. But the sample GitHub repo here contains everything from iOS Swift to Cocoa to WebAssembly to Python and more. Looks promising.

I should admit, though, that almost everything I've done with Kotlin has been on the JVM. I know the multi-platform approach has a lot of advocates, though.

1 year ago
At first glance it looks like your lmbd function returns Unit (i.e., nothing). If you want it to return a value, you need to add :Int to the signature and add a "return" statement inside the function.
1 year ago
Let me say first that if I have a working application, I usually leave it alone. That said, if I wanted to port it to another language, I would start by making sure I had a good set of test cases, and if you're trying to learn Kotlin, you can write your tests (including JUnit tests) in Kotlin.

Again, the biggest advantage of Kotlin over Java is its null safety. In addition, it has excellent concurrency support in the form of coroutines. Other advantages provided by the language are modern support for sequences, builders, extension methods, and more. In fact, frameworks like Spring use Kotlin to create DSLs to configure beans or applications, leading to simpler code that's still type safe.

Anything you can do in Java, though, you can do in Kotlin, so there is no reason you could not port over your app. As I say, though, if your app already works, I'd probably live with it.
1 year ago
The biggest reason devs move to Kotlin is for the null safety. The language eliminates nearly all null pointer exceptions, because nullability is enforced at the compiler level. It's also a modern language, with many functional features. The other major feature that appeals to developers is the coroutines support, which makes it easier to write concurrent code.

Anything you can do in Java, you can do in Kotlin. The "killer app" these days, however, is Android. Google has declared that all new Android libraries there will be "Kotlin first".

The Spring framework support is also excellent, and they've added a few Domain Specific Languages (DSLs) in Kotlin to simplify development there.
1 year ago
That's what Kotlin multi-platform support is all about. The current status and some basic information can be found here

As the page says, the multi-platform capabilities include support for "JVM, Android, JavaScript, iOS, Linux, Windows, Mac and even embedded systems like STM32".

Hopefully that's what you're looking for.
1 year ago
The good news is that while there are a lot of constructs, there are only a handful of use cases that come up over and over again. So working with `launch` and `async` and `coroutineScope`, etc, becomes manageable. Doesn't mean you don't have to be careful, as you said, but at least you're not always starting from scratch.

Good luck with the multi-platform approach. There are some notable successes, so there are decent examples to base your work on. I just don't feel confident enough in my understanding of the other platforms yet to spend time understanding the details.
1 year ago