Should I use Java or Phoenix for my startup?

Hi,

I have proficiency in Java. I came to know about elixir and phoenix. I liked language and got pretty excited. I need to build a REST based backend server for my startup. I was thinking of using phoenix but as I started rethinking in functional way is getting difficult. Most of the time I start thinking in imperative way of solving.

This is hampering progress on my work. Anybody, who was in the same boat, what did you do. Any help/comments is appreciated.

I suggest you examine what you’re looking for from your startup. Is it to learn new languages & programming paradigms and to have fun, or to validate a business idea?

If it’s the former, great. Keep going with Elixir, ask questions when you get stuck and have fun. If the latter, I suspect using a language you’re not proficient with is a mistake. You’re validating an idea, odds are you’re going to throw away or rewrite the code you’re currently writing. Use the language that you’re most productive in, so you can get to that stage sooner.

5 Likes

I will echo what @lukerandall said. “Startup” implies that you have money - perhaps your livelihood, on the line. In that case go with what you know.

Now to your point of retooling your thinking. Making the move from the Object Oriented paradigm to the functional paradigm is difficult. For the folks I know who have worked through it, there is not really any special trick. It takes practice, plain and simple.

What worked well for me was working my way through a lot of small problems - using something like exercism (http://exercism.io). With the way functions compose it seemed to work well for me to try little things and then build them together into bigger constructs. I also spent time using Functional Paradigms in applications that were otherwise Object Oriented (Swift and Objective-C in my case). After a while you get a good feel for when a problem is particularly suited to the Functional Paradigm which helps.

5 Likes

Thanks luke. I have been thinking of moving to Java but after coding in Elixir, Java looks very verbose. But yes, I think I will be more productive and validate idea.

1 Like

Definitely avoid transitioning from OO programmer to functional programmer at the same time as you transition from engineer to entrepreneur. Both are quite challenging endeavours, which you’re better off tackling one after the other.

5 Likes

As others have said, for a startup, go with what you know. Nobody here is going to think less of you for picking something you’re used to for your, everything is on the line, startup. At least if that thing is Java.

That said, if you want a little help thinking in Elixir, I recommend this course: https://pragdave.me/. It helped me.

Aside from that. As my hero, Joe Armstrong, says, “Make it work, then make it beautiful, then make it fast”. Elixir forces you to think in terms of Data + Data Processing. I find that I can program Elixir like I would Java, then look at my working code and try and make it beautiful. Once you get the hang of porting your large imperative functions to smaller, piped, sometimes recursive, functions, you’ll start to think in terms of “native” Elixir idioms more and more often.

Phoenix is a web toolkit (some would call it a framework). Play is a fine alternative for the JVM. I am enjoying my Elixir journey, however it took me many months to become comfortable enough with Elixir and the ecosystem of libraries to bet my reputation and livelihood on it. If you don’t have that kind of time for exploration, then I’d advise you to stick with Java, and keep learning Elixir in your spare time.

1 Like

Welcome to FP world!
@ladco as a full time Java developer and a beginner in FP. This is what I would suggest:

With the gears shifting in Java, as you already know, you can always write Java in Functional way. This is how I started in FP, before even discovering elixir/erlang. I do program almost regularly in elixir, for practicing as a hobby.

When you are starting something of your own, you quickly need an MVP or might try out an interesting idea. The point is your TAT could be in the matter of hours or days, and this could be a matter of getting a new customer or packing up!

So, this is at-most important: YOU NEED TO BE PRODUCTIVE! you don’t have time to debug some unknown exception that popped up in production and have clueless about it. I think if you are still exploring, I would still advice you to look around, not just pick the first thing you see. Phoenix is a great framework, I’d love for what I can do, but for designing just REST apis, it just might a bit bloated (may be I wrong?)

anyways, here’s the bottom line:

You use Java to design your apis (It’s verbose? yes – but it just works. if bothered too much, then switch to scala/play) and put it production. then, on the side, you can test the same with phoenix on the side – in dev. With startup, I believe your budget will also be limited.

Good luck!
Chandra

PS: you can always ping me if you need any help with Java :wink:

I really believe in choosing the tech for the problem and not about what is popular. So for example if you need a real-time app then something like Elixir or Meteor.js might, if your doing something that needs machine learning your better off using Python. Just find out what you need a go from there.

Also for startup and MVP’s is not about having everything perfect it’s about get a first version out there. Keep it simple

If you know Java but are interested in some functional features then Kotlin might be worth a look.

You can easily make your data classes immutable and transform them with map/filter/reduce operations, and use well known Java frameworks as needed.

1 Like

I would suggest to go with what you know best, except if you have people experienced with Elixir/Erlang on your team who could guide you through.

Some tips from me to enhance Java experience:

  • Use Project Lombok to prevent Java boilerplate in your source code files.
  • Get familiar with FP in Java (Functional Interfaces/Lambdas/Streams…).
  • Use good IDE, if you currently not using it with Java. Intellij has Distraction Free Mode for those who like clean look.

Java has some good frameworks as well. From simple Java Spark or Ninja to full-fledged Spring (It supports Reactor).
If you need to use Actor model you could use Akka. (Could be integrated to the Spring Framework as well.)

1 Like

For startup use … cloud, something you can easy and fast prototype :slight_smile:

if you want to go java route … you can check https://www.jhipster.tech/

Or Kotlin instead Java

Elixir saves you all that strange lengthy needless JAVA compile and recompile time. Even on the fastest machines, JAVA compile time is long. Elixir is plug and play.

1 Like

yes you need to heavy machine for java :grinning:

1 Like

If you think Java compilation is long, you need to try compiling a scala program :lol:

3 Likes

Thanks for the awesome support! I am going through project lombok. Intellij have been my favourite IDE for last 5 years :slight_smile: I am planning to use spring boot. Will check out Ninja, Jhipster and Java spark. Jhipster looks more promising. Will be learning Kotlin for buliding android app.

I admit, I have experimented with many languages and frameworks, the ones drove me crazy and made me real upset were Scala / Jhipster / Spring boot … @ladco … I still use JAVA for Android development, but other than that I don’t write JAVA.

@ladco, I recall Elixir made me confused at the beginning, since it does things in new and not standard ways compared to OOP/c#/Java, yet it is fun once you learn it :slight_smile:

Did you make an MVP? Did you like what you used?

1 Like

First of all Java is becoming is functional. I dumped Java 9 years ago for groovy and grails for its functional flavour and meta programming capabilities resulting in less verbose and more readable code (Convincing customers that they get Java byte code that will run their Tomcat/JBoss servers). I am using Elixir and Phoenix now because of the same reasons. All our new products are being written using the power of Elixir OTP. In a way declarative programming is less confusing and more natural than Imperative programming.

2 Likes