Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!

Tim Cooke

Sheriff
+ Follow
since Mar 28, 2008
Tim likes ...
Clojure IntelliJ IDE Java
Standard Nerd
Belfast
Cows and Likes
Cows
Total received
280
In last 30 days
0
Total given
588
Likes
Total received
1240
Received in last 30 days
10
Total given
407
Given in last 30 days
3
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt Green check
expand Greenhorn Scavenger Hunt Green check

Recent posts by Tim Cooke

My prediction is the same as every year:

Couldn't..... care...... less
4 hours ago
I'm not a Windows user so can't suggest what command to use, perhaps someone else will chip in with that assistance, but you want more detail of the programming running with PID 1940.

I can be certain in telling you that it is not Java itself rather some other application that runs on Java. What application that is is the detail you're looking for.
20 hours ago
Are you sure it's Java? And not another application running on the JVM?

What details about the running process does netstat give?
20 hours ago
When I have dilemmas like this I say to myself "What would Josh do?", and reach for my copy of Effective Java. It says:

Effective Java wrote:One advantage of static factory methods is that, unlike constructors, they have names


Effective Java wrote:A second advantage of static factory methods is that, unlike constructors, they are not required to create a new object each time they're invoked


Effective Java wrote:A third advantage of static factory methods is that, unlike constructors, they can return an object of any subtype of their return type


Effective Java wrote:A fourth advantage of static factories is that the class of the returned object can vary from call to call as a function of the input parameters


Effective Java wrote:A fifth advantage of static factories is that the class of the returned object need not exist when the class containing the method is written


Effective Java wrote:The main limitation of providing only static factory methods is that classes without public or protected constructors cannot be subclassed


Effective Java wrote:A second shortcoming of static factory methods is that they are hard for programmers to find



Like Junilu says, the method and parameter naming is misleading so it's hard to know what the right approach is.

Here's a consideration that I might have coming from a performance point of view. GC 'stop the world' events are bad, so one way to avoid them is to create zero garbage so in your example the Version class is immutable and we could create a cache for it. Yes the trade off is memory usage, but in my world that's ok. The static factory method is perfect here:


But, it depends on the detail, usage, and what's important for you.
21 hours ago
This week, we're delighted to have David Kopec helping to answer questions about the new book Classic Computer Science Problems in Swift.

The promotion starts Tuesday, June 19th, 2018 and will end on Friday, June 22nd, 2018.

We'll be selecting four random posters in this forum to win a free copy of the book provided by the publisher, Manning.


Image from unknown

Please see the Book Promotion page to ensure your best chances at winning!

Posts in this welcome thread are not eligible for the drawing, and should be reserved for welcoming the author. Questions posted in this topic are subject to removal.
1 day ago
iOS
The two are not directly comparable in the way I think you expect they are. JEE is a programming language and library, where AWS is a server environment. Your question is akin to asking "should I specialise in Software Engineering or Systems Engineering?" two very different career paths.

Perhaps I misinterpreted your question? Please correct me if I have.
2 days ago
That'rrr does'rrr look like a legit'rrr typo. If only there were tech reviewers to catch this sort of thing before publication... :/
Welcome back Toby, it's been a while!

I hope you have fun answering all our questions.
1 week ago

Prasad Saya wrote:I never go hungry to a grocery store


A sure fire way to double your food bill.
1 week ago
Dehydration is the trigger for a grumpy Tim. Then I have heard that the body has a habit of misinterpreting thirst for hunger, so maybe it's the same thing.
1 week ago
For my current project at work I use zero Spring.
1 week ago
A gentle reminder to all promotion participants that this thread is for welcoming the author only. Normally questions posted here will be deleted but in this case as the authors have already answered they can stay. However, remember that questions asked in this thread will not get your name in the hat for winning a copy of the book at the end of the week. To be in with a chance of winning you need to ask questions in a new thread in this forum.

Good luck everyone!

Tim
CodeRanch Staff
1 week ago
Me neither Stephan. I was hoping to avoid rolling my own mutable value type. Even my Java savvy colleagues came up empty on this one too. This must be a solved problem.
2 weeks ago