How to improve my developer experience?

Hi all,

Please scroll down to the TLDR for the actual question, if you prefer to skip reading background information.

I’ve been trying to get into Nextcloud app development for a while now. At the moment, there are no concrete plans for specific apps. I would just like to learn how to build a robust app for Nextcloud, focusing on both backend and frontend.

I have about 15 years of experience as a full stack developer. In recent years, I have mostly been building APIs with Symfony and fully typed React projects using PHPStorm as my IDE. PHPStorm has been invaluable to me, as it catches pretty much all errors I’m making while developing. VSCode - to name just one alternative - never came close in developer experience, at least not for PHP.

Unfortunately, my developer experience experimenting with Nextcloud apps has not been great so far, to say the least. The Julius Knorr dev environment is a great starting point, and so is the app generator. Unfortunately, PHPStorm immediate shows squiggly lines here and there because of some inaccuracies in config files.

Also, squiggly lines keep popping up in places where I would not necessarily expect them. Often it has something to do with the fact that I’m developing my app inside /workspace/server/apps-extra/my-app while there is also config in /workspace/server that seems to have higher priority and therefore interferes.

Also, apps sometimes seem to be working fine without a vendor directory, which causes my IDE to complain about every import line. When I run composer install to try to get rid of these errors, some usually remain. For example, the developer maintaining the tutorials told me use OC\User\NoUserException refers to server/lib/private/User/NoUserException.php, which PHPStorm wasn’t able to pick up on, because the file doesn’t live inside my app.

TLDR

I have many questions I’d like to ask to other app developers. In general: can you tell me something about your development experience?

What code editor or IDE you are using? Does your code editor or IDE have extensions that specifically help writing Nextcloud apps? Are you seeing a lot of squiggly lines, if so, do you simply ignore them, because you know they are false positives? What do you set as the root folder in your code editor?

I see a lot of potential in Nextcloud app development, but as of know, my developer experience is just not good enough, which burns a lot of time and simply reduces my enjoyment of writing code.

Love to hear your thoughts! :smiley:

2 Likes

I am an app dev and I am using vscode (just for reference). I find it okay, once configured correctly.

That is bad practice in every case. There are 3 app namespaces:

  • OC for internal (private) implementation in the server
  • OCP for public interfaces and classes that apps can use
  • OCA as a root for all app code

So, every app should use only code inside OCA\AppId and OCP. Everything in OC is prone to modification without prior notification. Use on your own risk.

For the public classes, there is the nextcloud/ocp package for composer that contains the relevant classes/interfaces. That way, you can run your editor only on your app and the interfaces are available from there (reducing the code the editor has to parse). Once you want to debug including the stuff happening in the server, you will have to keep the server code in the project, though.

Which tutorial is it that uses private classes?

Hi Christian, thanks for your helpful message. This is the first time it is explained to me what the difference is between OC, OCP and OCA.

The tutorial in question can be found here Nextcloud app development tutorials final - Nextcloud. The one with the NoUserException is 6 Developing a complete app with a navigation bar and database. Then Ctrl+F for the import line and you’ll find it.

1 Like

Just stumbled on this, too. It’s in line 8 of lib/Service/NoteService.php of the tutorial.

As far as I see it, the class is not actually needed in the implementation. Just in annotations that shows throws. I am not sure this will actually be needed for psalm. Otherwise, one could drop that.

I cannot test ATM, as I am on a business trip.

1 Like