Scott Shipp

Ranch Hand
+ Follow
since Mar 31, 2013
Scott likes ...
Scala IntelliJ IDE Eclipse IDE Java Ubuntu
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Scott Shipp

This same question came up at work recently in an unexpected context. We observed after moving some services into AWS Lambda using Java that cold start times were unacceptable. If you're not familiar with the AWS Lambda service, AWS auto-scales according to request volume. When requests are at a pretty steady level, whatever algorithm they use has scaled your lambda to the right size of nodes and can handle all requests on "warm" nodes. If a burst of requests comes in and AWS Lambda's algorithm has to spin up new nodes to handle the volume, those are called "cold" nodes and they suffer startup and initialization time. AWS gives no guarantee that a given request to a Lambda will hit a "warm" node. If it hits a cold node, the request might take a second longer to be serviced.

We ran our own microbenchmarks and found that Node.js lambdas have shorter cold start times by about half. So now we're starting to think, well maybe we should move certain Java implementations to JS on Node.
5 years ago
Now we just need the Big-O analysis of space and time complexity of each algorithm.
5 years ago
One alternative might be to implement an equals() (or deepEquals?) method in RumbaLabel that compares all the fields you care about and just check that partnr is equal to an instance of RumbaLabel with those values. The problem with such an approach, though, is that it would move visibility of what exactly is different out of the test, so I wouldn't recommend it.
5 years ago
It's because the underscore is a substitute character for a comma. It's easier to read long numbers when they're broken up. 123456789 is less readable to humans than 123,456,789. I think it was in Java 7, they allowed underscores in numbers to make larger numbers like this more readable. "1_234_" is therefore the same as writing "1,234," which is not a valid value. The compiler is trying to be helpful and indicate this. Just think of it this way: if you replace the underscores with commas, is it a valid number that makes sense? Otherwise you'll get the illegal underscore message from the compiler.

So minor nitpick: you can have more than one underscore, if your number still makes sense: e.g. 1_234_567 would be valid.
6 years ago
Wow! I never even thought of the naming of RuntimeException. That's pretty funny!
6 years ago
The way I think about dependency inversion is that it's more about whether your code is hardcoded against a concrete dependency (like a specific model of printer or a specific file system), or if it instead inverts this relationship and becomes itself dependent on an abstraction of the concrete dependency.  That sounds kind of confusing so think of it this way: you send a daily email with the day's total sales. So you write code that does a lot of stuff against "EmailSystem" and the code is completely dependent on email. Next, the boss decides she wants to get the day's sales total text message summary each day instead. What do you do? Copy/paste the code and find/replace "EmailSystem" with "SmsSystem"?


You instead make the code depend on an abstraction like "MessageSystem" and you supply a concrete implementation for each instance. The code is more resilient to change now, and when the boss decides now she wants to get it via a REST API call to her Internet-of-Things appliance in her house, you've got it covered.

So I'd look at things like InputStream or Writer as Java library interfaces that facilitate dependency inversion.
6 years ago
Was the question stated exactly this way? The class names given don't even follow standard Java conventions. I'd personally avoid the company from here on out if that was an interview question given to me.
6 years ago
Hey Mark, If your goal is to learn better problem solving skills, what if you dispensed with the languages altogether? I think you may only need a pencil and paper (or a whiteboard and marker) and go solve those problems without the overhead of the language at all. Use pseudocode as necessary. When you're confident in your solution, then come back to the keyboard and code it up and see. This approach has always worked better for me.
6 years ago
This would not be unlike the Singer, Songwriter, SingerSongwriter example in Effective Java, item 20. What Bloch says there would be applicable, and he's basically saying that you should use interfaces for Player and Coach, then if necessary, your "PlayerCoach" could implement both interfaces.
6 years ago

S Fox wrote:I have a class that I made which is like a custom data-type, and I'm trying to figure out how to tell java what makes each object unique for the purposes of adding them into a Set? Right now it's just adding everything.
I wanted to compare the objects by a String "name" for deciding the set membership.

Check out the information at the below links. Hope it helps

Java Trail: Object as a Superclass

Deep Dive (with a video)

Why you must override hashCode if you override equals

Helpful Stack Overflow discussion

6 years ago
Hey everyone the ebook is out now on Print copies are supposed to ship on 12/29 and can be pre-ordered now.
6 years ago
Hey out there,

I am looking for book recommendations for books that cover practical mathematical and statistical methods for estimating, planning, etc. related to backend services. Let me know if anyone has recommendations. Something that covers topics like capacity planning, monitoring thresholds, queuing theory, etc.

One recent use case I had was to determine a good queue size for a service in a distributed system. I used a variation of Little's Law to figure out how certain queue sizes would impact a particular use case and come up with a range of milliseconds response time that downstream systems would have to have in order for us not to reject messages.

I have searched a lot online the past couple days and there are a number of books falling in this description, but its really hard to figure out if a book is just going to cover hard theory or if it actually demonstrates how to apply the theory in the field which is more of what I'm looking for.

6 years ago

Paul Clapham wrote:...maybe you could call that "recovering" anyway? I guess my point is that when an FTP exception happens, then having the application end abnormally isn't our preferred outcome. We would prefer to note that the exception happened, perhaps do something differently, but at any rate we want the application to continue on in a normal way...

Junilu Lacar wrote:The main thing to watch for, IMO, is copping out or worse, being lazy about checked exceptions. If you automatically wrap a checked exception with an unchecked exception and throw it back upstairs, then you have to ask if that's the right thing to do or if you're just being lazy and doing it for the sake of short-term expediency at the cost of long-term robustness of your design.

Paul / Junilu  --- I think the examples you give point out something really insightful which is that exceptions are very case-by-case. The Bill Venners article gives examples from the standard library that show exceptions being used quite differently, but they all make a lot of sense in context. So maybe the reason it is hard to come up with a general rule is that a general rule isn't very helpful and common sense needs to guide you?

Junilu Lacar wrote:Scott Shipp... you wouldn't happen to be the author of this article, would you? Just wondering because I had a discussion just in the past few days with someone off-Ranch about what you wrote there. Nothing bad, I assure you. The guy I was talking to was thinking about expanding on some of your points and he and I had a discussion about working on a follow-up article together.

Ha! Guilty as charged. It was inadvertently a polarizing article, which isn't what I intended at all, but there's a fair criticism in there. I now see that I started the argument wrong and half the people who read it didn't get any nuance out of it, just "don't use getters and setters." I also am planning a follow-up article at some point, about access modifiers and why I think the big jump from package-private to public in Java allows (maybe even encourages) essentially procedural style programming. The anemic domain model article from Martin Fowler is pretty near to what I had in mind when writing that one and maybe one day I can hope to learn how to express things as well as he does.

6 years ago

Campbell Ritchie wrote:Please give us a link to that article.

Sorry about that. I thought I had linked it but it looks like I somehow linked wrong. Here's the article on DZone.
6 years ago