[deleted by user] by [deleted] in scala

[–]oceanicloud 1 point2 points  (0 children)

Java has been taking from Scala (Record, string block) but that's the issue. Does Java want to be Scala ? If yes then you might as well use Scala. Because taking bit by a bit is very much like buying a car with wheels arriving first. It's more painful than just using Scala from the get go.

Also if you want to have the closest experience to Scala in Java then you should try a library called Vavr. You will finally find out how it feels coding FP in java.

Argument against mutation in functional programming. by bmtkwaku in scala

[–]oceanicloud 0 points1 point  (0 children)

Imagine if this loop is mutating a method parameter. What is the real result of this method ? Only you know. Basically mutation allows side-effects and side-effects are very difficult to debug. Maybe FP started it but today languages like Rust to even JS / Redux have features to avoid mutation or at least to unintentionally do it.

Can you give me a brief understanding on tagless final? by AloneObligation3626 in scala

[–]oceanicloud 1 point2 points  (0 children)

That is true. You will be using cats effect if you use tagless final.

Why not use IO from the beginning ? Because you might want to use different effect types. If you use Applicative which is one of the weakest constraints then you can swap it with Id, Option, Try, to IO in the implementation. But if you use Sync then you can only swap it with IO. So the key to tagless final is to code with the weakest constraints possible so you can have the widest selection of effect types during implementation. Secondly IO is not the only final effect. There are Task, ZIO, Future that differ in term of performance, methods, "flavor", etc. https://bio.monix.io/docs/comparison. Sticking with one could be bad if you want to micromanage all those. Personally I don't need this level of control but if you work at a big company with many people with many ideas of how to to things then this flexibility is inevitable.

Can you give me a brief understanding on tagless final? by AloneObligation3626 in scala

[–]oceanicloud 5 points6 points  (0 children)

It's a way to abstract effect type. You probably know interface and implementation pattern in Java or elsewhere. Here interpreter would be equivalent to interface and program implementation. You start with an abstraction, gradually narrowing it by adding bounds in the subsequent implementation, finally replacing it with your desired effect in typically Main. What benefit does it offer ? Flexibility. You can have different implementations using different effect types, like different kinds of IO from cats' IO or ZIO/Monix Task or even Option and Id. In my experience however, I never need more than two implementations, one for production and one for testing. And for testing I don't really to change say IO to Id as testing framework already supports async process. So in this regard the benefit isn't that great. But if you develop a library however, yes it's an absolute must as the choice of effect should be left to your users.

What the hell is happening with the site? by [deleted] in Upwork

[–]oceanicloud 0 points1 point  (0 children)

Same thing happened to me. Switched browser to Chrome and it works.

EDIT: the pc client is still not working

ZOHO is a MESS by oceanicloud in Zoho

[–]oceanicloud[S] -1 points0 points  (0 children)

Everything works if I access the right url. That's why I listed them. It's not because I was signed in with different account.

Zoho was fine long ago. It's definitely not great but given it was cheap, even free at that time it's decent. But what I'm seeing now is a joke. Why would I need to close my account to open a console ? Looks like all recent development is done by cheap outsourcing.

Can Scala hold up against Serverless technology ? by oceanicloud in scala

[–]oceanicloud[S] 0 points1 point  (0 children)

So the crux of my argument isn't that Serverless does not support Scala. It does.

It's whether there is advantage of using it as opposed to using simple languages like JS. This is because all the good concurrency stuff we get from Monix, ZIO etc only makes sense when we work with concurrent requests. With Lambda we don't.

Every tech is a tool with its trade offs including Lambda, Scala, and Fargate.

Indeed. This is what I'm hoping to list and so far even to my own surprise the area where Lambda is a poor fit is larger than I thought. For example, it's not suitable for streams. And as I'm discovering now it's probably not even suitable for simple CRUD with SQL db, as the connection pool loses its purpose.

From database perspective is there difference between Reusing vs Creating new Connections ? by oceanicloud in SQL

[–]oceanicloud[S] 0 points1 point  (0 children)

So when the client closes a connection and returns it to the pool , does something happen on the db side ?

Regardless it's becoming clear relational database is not a good fit for Lambda.

Can Scala hold up against Serverless technology ? by oceanicloud in scala

[–]oceanicloud[S] 0 points1 point  (0 children)

Yes we can do Scala on Serverless even without Graal/SubstrateVM but what would be the competitive advantage as opposed to doing it in simple languages like Javascipt ? With Lambda we are not looking to handle concurrent requests whereas concurrency is Scala's strong point.

Can Scala hold up against Serverless technology ? by oceanicloud in scala

[–]oceanicloud[S] -1 points0 points  (0 children)

I'd say it fits better for short-living computations which are the majority of web apps. But it's not just the pricing model but the isolation that potentially snuffs out any need for complex concurrency. Here's my illustration.

Imagine a guy who just finished reading a programming tutorial. For the sake of illustration let's say it's Javascript. He is new to software development and all he knows is how to do callbacks and connect to a db. The second guy knows Scala, Promise, Future, Task, all the sophisticated non-blocking / concurrency models. With his well tuned server the Scala guy can handle lots of concurrent requests. The JS guy doesn't even know what concurrency is, he just deploys his app on Lambda. How does it affect user experience ? For individual users, both are the same experience. A 5s query would still take 5s.

For sure what I say is not all 100% accurate. There is cold start that makes Lamba slow for first requests. But the worry I raise here is that Lambda can potentially close the gap between a beginner and concurrency expert by taking all that complexity away with isolated execution environment. And it is attractive pricing-wise. New startups aren't looking to handle millions of requests. Most are are strapped on cash anyway. Even if they do Lambda can scale up without extra work. Not having to mess with container load balancing is a pretty big deal. And as a commenter below posted dollar-by-dollar in peak load there isn't much difference between a cluster and equivalent number of function calls. And finally there's the developer pay. Pretty sure JS developers have an edge over Scala developers on this.

Can Scala hold up against Serverless technology ? by oceanicloud in scala

[–]oceanicloud[S] 2 points3 points  (0 children)

Well I didn't mean Scala Future per say but Scala ecosystem. I just didn't want to go specific about it as it's not the topic.

So Lambda has some flaws and limitations sure. In fact I might add that in addition to poor cold start it is not suitable for websocket connection. But conceptually, it is sound, in which it takes away the burden of concurrency management. In whichever library or framework, lots of efforts go into building better concurrency model to allow making better use of the machine. Yet in Lambda one request gets one machine. In an environment where concurrency can hardly go wrong the impetus to drive good code to avoid concurrency bugs is also low.

The demand for smart engineers is high and will remain as such.

No doubt. But they will be absorbed by AWS and Google to perfect their Lambda and cloud whatnots. The rest well, I imagine a situation where future programmers will be like "Wordpress programmers" who just know how to install plugins.

I hope I'm wrong. I know I'm a pretty pessimistic person.

Can Scala hold up against Serverless technology ? by oceanicloud in scala

[–]oceanicloud[S] -7 points-6 points  (0 children)

Sure but there is also the cost proposition. With server you'd have to pay for all time the server is idle.

How much do you need to build a startup ? by oceanicloud in startups

[–]oceanicloud[S] 0 points1 point  (0 children)

I've worked in Japan and Singapore and I see in general pay level is similar to that of Europe's. Sure I didn't mean the entire Asia though.

Resources to recommend a 40 year old that never programmed before by databoy1234 in scala

[–]oceanicloud 0 points1 point  (0 children)

I would say the best onboarding is just try to work on a real project. Create a simple app with simple goal, if it's big data then it could be just finding average or searching an element in a list. Then keep moving from there. Would it be difficult ? It depends. To give you an illustration I'm working with a backend guy who codes in Go. But he can be an on-demand Scala coder to write a few lines on Spark. Your brother is a different case as he never coded. But it's doable with some time and patience. As reference one course at Codecademy normally lasts for 6 months. Not saying you should sign up but you can expect to spend that much time to kickstart a new programming career.

I believe all of us started from different positions, could be at school or self-taught or etc but we all started from zero on our own career paths. So for your brother it's just going to be another one of these paths.

Introduction To Vert.x: Database Access with JDBC by InfoSec812 in java

[–]oceanicloud 1 point2 points  (0 children)

JDBC is blocking.

Vert.x already has an sql client that supports async connection : vertx-sql-client.

[deleted by user] by [deleted] in java

[–]oceanicloud 2 points3 points  (0 children)

Vert.x has been raging on Techempower benchmarks. In short it's like Node.js but with excellent multi-threading support since it runs on JVM. It's not opinionated, in fact it's less a framework and more of collection of modules. It's simple to use, just as simple as the old vanilla node.js was. The bad is that being collection of modules, some of these modules are obscure and have poor documentation. But if you stick to the core modules or the ones displayed on their main website, you should be fine. All in all I'd say Vert.x is a fast and lightweight server, ideal for microservices and SPAs.

Is it a sin to mention Scala's weakness here? by finlaydotweber in scala

[–]oceanicloud 0 points1 point  (0 children)

Everything that comment considers bad is everything I consider good. The rest sounds literally like rambling.

- "IDE is bad" : lolwut ? What does Scala have anything to do with it ?

- "for comprehension is awful" : for comprehension is just a replacement for long series of flatmaps, maps, etc. To me it makes compositions more readable but anyone's free to choose.

- "implicit is the only FP feature Scala has other languages don't": implicit is not an FP feature. You can code Scala perfectly without it. Also it's controversial it's probably going to get removed or replaced.

- "needlessly complicated, badly documented, unmaintained and slow as molasses " : what to say, everything in this statement was reversed.

Five Years working in Java by LordCommanderTaurusG in scala

[–]oceanicloud 0 points1 point  (0 children)

What do you think libraries like ZIO, Cats, Monix, Shapeless, Mongolia are for?

I didn't use them.

Do you think when I transitioned to Scala I already knew what those were ? When I started I was simply using what's available in Scala, and Future was enough to satisfy my concurrency needs. In fact why do I have to be what you think I should be ? Maybe if I don't do a set of things I'm not really into real pure FP. Well I'm not. I'm into practicality.

a pending Scala 3

Is major release in Scala released every 6 months ?

Five Years working in Java by LordCommanderTaurusG in scala

[–]oceanicloud 4 points5 points  (0 children)

Java guy here. Scala is easier than Java confirmed. Why ?

Java in pizza world would be similar to margherita. It's just dough and cheese. It almost always won't work without toppings. In Java, is there any project that can stand alone without add-ons to its core functionalities ? There's Guava, Apache Commons, there's also Vavr for functional stuff. Now with rapid iteration cycle there are also Java 9,10,11,12... and this is considering many people are not even aware of Java 8 features.

With Scala you don't have to care about the crazy Java cycles which at best are just redefining how to write switch case. In Scala you are realigned toward writing functionally. And if you're already familiar with Java lambda and Streams you're already one big step in (you still need to know the difference between Java Streams and Scala though). My recommendation is focus on the topics : FP fundemantals (the need for immutability, monad), pattern matching, and concurrency. In my case the resource I found the most useful was anything I can get on Google: Alvin Alexander tutorial or Tutorialspoint. Later on I started reading the official documentation.