I'm A Java Developer : To code my SAFEnet app should I forget Java and use something else?


#1

Not sure if this is the correct forum for my question, so please move it if necessary.

I’m not a rock star developer by any stretch of the imagination. I’ve built JSP and GWT websites backed by MySQL databases. Around 2005 I developed an API that coalesced various mobile phone contract data streams into one coherent data stream in real-time. I sold that and made enough money to be able to stop making bloody websites for financial companies and concentrate on learning how to make things I’m interested in. I’m not rich. At all. I have traded income/lifestyle for having the time to learn how to program desktop applications using JavaFX and 3D computer games using Java and LWJGL. It took me a long time to learn how to program in Java, to pick up JSP and GWT database driven web applications and a couple of years to learn JavaFX and LWJGL. Like I said, I’m not a rock star developer. In fact I’m a bit slow and I found everything I have learned how to do quite challenging. Perversely, this is why I enjoy programming. I find it difficult.

I’m describing this to try to give you an idea of my ability as a programmer now, so you can maybe advise me on how best to proceed.

I am focussed on building an application that allows people to create and play tabletop style role playing games together via the internet. Nothing new there. It’s just what I’m interested in doing, combines all the skills and experience I already have and is pushing me to learn new skills and areas of Java that I haven’t used before. I can do this with Java. I can do this on the standard internet.

I want to develop this on the SAFE network.

I’m new to the SAFE Network and I am gradually working my way through the background material. The support for Java development seems to be in its infancy - which is cool, though a little frustrating. The more comprehensive ‘how to build an app’ tutorials and demos are all using languages, frameworks and so on that I have zero background in.

So I’m asking for some advice: Should I carry on using what I know reasonably well and wait for a Java API while building up my background understanding of SAFE Network or try to learn how to use one of the new to me languages, frameworks, or whatever that seem to be more developed than the Java API?


#2

I’d wait for the Java bindings if I were you. Sounds like they’re quite close to release, and actually working as of last week. But in the meantime I think studying the API documentation for other languages is a good idea. They’re all supposed to be the same.


#3

Thanks for taking the time to reply. By Java bindings do you mean these - https://github.com/maidsafe/safe_app_java?

Re: Studying the API documentation in other languages, you’re suggestion makes sense. I am a bit slow though. I find it hard to fully understand without examples written in Java. Also I tend to learn by doing. Good advice though.


#4

I agree with @drehb that if your preference is Java, stick with that because things are falling into place. I don’t see an advantage in starting learning a new language unless that’s something you actually want to do.

There are probably people here with enough understanding of java and the SAFE API to compensate for the lack of examples (although check the repos of the Maidsafe devs working in that area and in the safe_app_java repo in case it has some test code in java etc).

The main learning for you will be the SAFE API and there are a few of us who will help you with that.

I’m not a rockstar either and it’s taken me over two years to get from lapsed programmer to a level where I’m making useful stuff with JavaScript as opposed to little demos. Like you I find pleasure in the challenge, and I think that’s a strength of yours at this stage of a project. It shows an ability to solve problems and a willingness to stick with stuff that you find hard when you know others find it easy. Eventually I find things get easier too, and that’s also fun because I enjoy helping others when I see they want to learn, less so when they haven’t figured out the value of that and how to solve problems themselves. That’s the most important skill to work on IMO :slight_smile: I’m also in a similar position to being able to choose what I work on, and glad to have you join us :+1:


#5

Where do I find these?

Where should I post questions?

Glad to have found another non-rockstar :slight_smile: Funny thing is that in my youth I was a very minor guitar playing rockstar!

I’m more than happy to do the hard work myself, I’m just old enough to know that asking for help is a wise way to progress.

My general plan is to build my application as a Java desktop project - which is where I am now. Whilst doing that I’m trying to build up an understanding of the SAFE Network. Then later, build a version running on the SAFE Network. I guess my fear is/was that the Java API doesn’t appear as a mature API or just hangs around as a poor second cousin to the existing, newer web application languages or frameworks that seem to be first class citizens here. At least that’s my impression.


#6

I’m not sure which devs - they get mentioned in the Dev updates sometimes, but we can ask @krishna now: can you point us to the repos of anyone who might have some sample code (even tests) which use the safe_app_java bindings.

API questions are best asked here on this forum.

I sometimes make sounds with a harmonica :wink: :musical_note:

Asking questions is always fine IMO, people don’t have to answer, and the skill is knowing how to make best use of the asking, and being willing and able to look for another way when the help you wanted doesn’t appear. Those are the skills I was referring to.

The SAFE API is the same for all languages and platforms with only slight deviations, so no issues there regarding Java. There may be better supported platforms, or horses for courses, but that’s a more general issue and not really to do with SAFE, at this stage anyway. In time the more popular languages will have more people writing tutorials, creating tools, frameworks etc, and the less popular languages will fall behind. But right now there’s not much in it.

I chose JavaScript partly because it was the easiest and quickest learning curve for me, and because at that time I was focusing on web apps as the most cross platform solution. As an ex C++ developer I was more interested to learn about Rust but didn’t think I’d be able to be very productive, and that was the most important thing to me. To be able to contribute something concrete as fast as possible.


#7

Hi @prtscr – thanks for your questions!

I’d say it’s better to stick with the Java API. Although we’re focusing on Android and mobile platforms, the desktop Java is definitely supported (the differences from Android APIs and JNI are minor). The bindings should be close to completion (@lionel.faber might provide you with more details here), but unfortunately there is not a lot of examples/tutorials – just yet. There are some examples of the API usage though, in the form of unit tests, so you can try to follow these for now if you’re eager to try using Java to build SAFE Apps :slight_smile:

The current dev branch is available here: https://github.com/lionel1704/safe_app_java/tree/v0.1.0
You can check the tests for some example code.

Couldn’t agree more! :wink: So please ask questions if you have any.

I’m sure the Q&A-style discussion will be helpful not only for you but for everyone interested in Java and reading this forum/searching on the clearnet.


#8

Thank you for that :slight_smile:


#9

Hey @prtscr! As mentioned above, sticking with Java is the better option. And adding on to the information that has been shared, here’s a sample application that we’re building to demonstrate the use of the Java APIs on the desktop platform.

Safe Todo Example - Java
This is still a work in progress, but, it should run you through the basic setup and authentication process.

Please reach out with any questions. We’ll be glad to help you :slight_smile:


#10

Thank you for that. I’ll take a look :slight_smile:


#11

Had a quick scan through the code and this is exactly what I need in order to relate the SAFE API documentation to a Java application. There are a couple of libraries in there that I’m not familiar with.

  • de.saxsys.mvvmfx
  • it.sauronsoftware.junique

Why were those libraries used?


#12

de.saxsys.mvvmfx

The application is built using the MVVM design pattern. This library provided us with necessary components to do so.

it.sauronsoftware.junique

As part of the authenticaton process the authenticator (in the browser) would open a new instance of the application with the required Auth URI. This library was used to maintain a single instance of the application and to send the data (in the URI) to the first instance.

Refrences:


#13

Okay. Thank you. I’ve not used the MVVM design pattern before but I’ll read up on that pattern.


#14

On your spare time, do u mind giving Rust a try?
Depends on what you need. The Rust Book is the golden standard.
http://rust-lang.github.io/book/

The New Rustacean podcast is very good if you’re an audio learner.
http://www.newrustacean.com/

There’s also The Rust Playground - a useful tool to test small bits of code even if you can’t get Rust installed on a computer
https://play.rust-lang.org/

Another useful learning resource where you also can keep track of your progress which can be a motivator.