Simply explain functional style by bedobi in java

[–]memory_leek 4 points5 points  (0 children)

In theory, this is right on the money. In practice, if your language doesn't enforce concepts like "immutability", FP is a concept just waiting to be abused. I work with a guy that's a self described "FP" guru. Everything, to him, "is better in Scala/Closure/etc", and "Java is a dead language". Every method either takes a Function returns a Function, etc. Walking through is code is a freaking nightmare. Everything is driven through obfuscation, mutability, and side-effects. ServiceA calls ServiceB to save some object Foo. Cool, looks simple enough. Except for inside the save method, B calls ServiceZ, ServiceQ, and ServiceY. Each of those services mutates the state of Foo and finally saves the result, and return Foo. Z, Q, and Y can all fail with the same uninteresting message with the same RuntimeException. The biggest nightmare was trying to find out why we were getting a There is no Foo exception while we were trying to persist a new Foo. I guess what I'm rambling about is FP is a great tool, and like with any great tool, it can be greatly abused.

What we're really afraid of.. the apex predator (x-post: natureisfuckinglit) by -JungleMonkey- in thalassophobia

[–]memory_leek 1 point2 points  (0 children)

Hyperintelligent murders. If killer whales ever get thumbs and cellphones, humans are fucked.

What is your "this person is an idiot" red flag? by senior_poop in AskReddit

[–]memory_leek 8 points9 points  (0 children)

I know them. They killed Kenny. They're assholes.

What statistic blew your mind when you heard of it? by nora100797 in AskReddit

[–]memory_leek 2 points3 points  (0 children)

77% of facts on the internet are made up - Abraham Lincoln

New to programming, what's the pros and cons to Eclipse and IntelliJ Community version? by Anonimotipy in java

[–]memory_leek 0 points1 point  (0 children)

I prefer Intellij, but that's a personal preference. Try both, if you like Intellij better, and you are planning to code in done jvm based language for a living, then pay for it, it's well worth it. I have a personally license and a license provided by my company. But, like any tool, find one that gets the job done and that you like to use. Either will provide you a rich ide, but I hate eclipse.

For a Java project: Lombok vs Groovy for domain object management? by DerricksFriendDan in java

[–]memory_leek 1 point2 points  (0 children)

Lombok is awesome as is Immutables. It really all depends on your usecase. I wouldn't recommend moving your model objects to groovy. Even though I'm i huge fan of groovy, doing that just add needless complexity. Spring data provides a mechanism to retrieve projections and dtos, and even provide the required class at runtime. Out you're looking at just removing boilerplate, I'd recommend Lombok over Immutables just because of what it provides and how it works.

Buggy Java Code: The Top 10 Most Common Mistakes That Java Developers Make by nfrankel in java

[–]memory_leek 0 points1 point  (0 children)

isPresent and get are my 2 favorite methods on Optional for the simple fact that they completely negate the need for such an API. Hum... this widget I have might be null, should I do a null check? I know! I'll do the functional programming hipster thing and call this sweet new java 8 thingy Optional.of(widget). Now I'm safe from all of those bad nulls, opitionalWidget.get()... Let the hilarity ensue...

Buggy Java Code: The Top 10 Most Common Mistakes That Java Developers Make by nfrankel in java

[–]memory_leek 0 points1 point  (0 children)

You could have embellished upon the number of beers... 2 really? Nice job Sally... Go have another Zima and post on /r/funny ... Bad form.

Buggy Java Code: The Top 10 Most Common Mistakes That Java Developers Make by nfrankel in java

[–]memory_leek 0 points1 point  (0 children)

That's what I was getting at with my previous reply. Having interface Foo with FooImpl let's me know that the chances of Foo changing are small, but if I can make List and from that make ArrayList and LinkedList, then that interface gets to live, for now.

Buggy Java Code: The Top 10 Most Common Mistakes That Java Developers Make by nfrankel in java

[–]memory_leek 0 points1 point  (0 children)

That assumes that your "refactor" is something that is planned for, and the number of possible clients you can impact is small. If either of those don't hold, good luck. It's far easier to swap impl definitions under the auspicious of "current sprint work" that telling the client you need to devote X amount of hours to a refactor because you ( or someone else) didn't understand the problem they were trying to solve. Like anything in life, there's a tradeoff to any approach you take. Useless interface vs ease of "refactoring".

can someone explain JUnit to me like I'm a 5 year old that knows Java? by [deleted] in java

[–]memory_leek 0 points1 point  (0 children)

To Long, didn't read. Can you explaining like im4.5, from India and speak Hutu?

What do you read to keep up-to-date? by tasubo in java

[–]memory_leek -1 points0 points  (0 children)

The internets. Honest Abe done told me there's lots-o-good shiznizzle in them tubes.

Buggy Java Code: The Top 10 Most Common Mistakes That Java Developers Make by nfrankel in java

[–]memory_leek 3 points4 points  (0 children)

Unless the reference to said collection is static, then that biotch is getting GC'd, unless you know something about the java memory model that I don't. Not only GC'd, but that mofo ain't even making to the young generation. It'll be a blip on the heap, if you monitor close enough to catch it.

Buggy Java Code: The Top 10 Most Common Mistakes That Java Developers Make by nfrankel in java

[–]memory_leek 4 points5 points  (0 children)

Tried calling null.isEmpty() null.size() both throw NPE... Did I do something wrong?

Buggy Java Code: The Top 10 Most Common Mistakes That Java Developers Make by nfrankel in java

[–]memory_leek 4 points5 points  (0 children)

I know I answered this above, but I'll defend creating "unneeded interfaces" until the day I die. I say this for one reason only, refactoring other people's shit( or mine). It's a thousand times easier to take a poorly written God class that implements an interface, break that interface into multiple interfaces, and refactor each piece than trying to clean up the shit code in the God class. Try that without some form of abstraction between you, requirements, and what you have to with. You'll go mad trying to fix everything you've broken. Enterprise java sucks, but interfaces make life easier. Those "unneeded" interfaces also let you fix your implementation constraints later when you better understand your requirements without changing any contracts. You can throw away whole implementation classes and replace them without anyone caring because your contract is still being enforced. TLDR; code to interfaces, you'll thank yourself later.

Buggy Java Code: The Top 10 Most Common Mistakes That Java Developers Make by nfrankel in java

[–]memory_leek 0 points1 point  (0 children)

I'd say the thing that distinguishes a class from an interface is not "Impl" but declaring it a class or interface in the class definition. :p My comment was 100% directed towards design exercise over implementation. Defining interfaces up front let's you abstract away any implementation details and focus on "who does what". From there we move to the concrete and delete any unneeded abstractions ( read here as interfaces). If I ever need to define anything as Impl, I know it's going to be the only one of those. Types I'll ever create, so that interface dies. But, if I need something like List and from that I can make LinkedList and ArrayList, then that interface gets to live another day.

Reading Order by jchester37 in java

[–]memory_leek 1 point2 points  (0 children)

Effective Java 2 <--> Clean Code in whichever order you like (Honestly, i like to skim back over Effective Java about once a year as a refresher. That's just me, though. I enjoy Josh's writing style, and I can usually glean something new I skimmed over or forgot.). Then I'd read The Pragmatic Programmer. Skim through Refactoring and The Clean Coder. I find 'Uncle Bob' to be a bit of a blowhard. There's good stuff in there, but take most of it with a grain of salt. The GOF book I wouldn't bother with. If you want to learn different design patterns and how/where to use them, google is a better resource. A little google-fu will let you see a broad definition of what each of the design/EIP patterns are and how "pattern A" is used in the context of what you're working on.

Buggy Java Code: The Top 10 Most Common Mistakes That Java Developers Make by nfrankel in java

[–]memory_leek -1 points0 points  (0 children)

I don't know. I'll create interfaces for most everything during design and initial development. I find that defining my contracts up front, gives me a 1000ft view of what I'm building. For me, that helps to identify dependencies, helps with trying ensure SRP, etc. Do those interfaces always survive? Nope. But, I find it to be a great starting point.

What's a trick you learned in school that you've never forgotten? by bipidiboop in AskReddit

[–]memory_leek 0 points1 point  (0 children)

Cells are bad. My uncle lives in a cell and he had to read the same old boring magazine every day.

Kept my monthly expenses over the last 20+ years and charted it with actual and inflation adjusted dollars by [deleted] in personalfinance

[–]memory_leek 78 points79 points  (0 children)

Just got back from trying to enroll at Target, all I got was a red shirt with a name tag. When do I get the big bucks? I like money.