12-05-2012 10:03 AM
I have been busy till last week doing Java development and not managed to fit in any real BB10 development, other than pottering round trying out the samples. But the client that I am working with was away last week, and so I thought I would take the opportunity to dive in.
My challenge was to create a working BB10 prototype of one of our simple Java applications - and I mean simple, only 5 screens. But since I have never learnt C++ officially or been taught anything about Cascades beyond various RIM presentations from BBM Jams I have been to, I thought that might be a big enough challenge.
To be fair pottering wasn't my only preparation, I have bought myself a second hand C++ book and a second hand QT book, and been trying to read these as bed time reading for ages now. I haven't got very far, but to an extent they were helpful too, I knew before I started that I was going to get confused by references and pointers and that I had to code destructors in C++. For QT, I knew that I really needed to understand signals and slots to be able to get any asynchronous processing working.
The approach I took was simply to take the smallest sample that looked like it has something like what I wanted, and then plagiarize the other samples looking for things that would help. There are a load of samples around, more than you would think, and the documentation is pretty good and getting better. I can say this because, I presume to throw me, RIM decided last week was time for beta 4 with new Simulator and new SDK, and loads more documentation. It didn't throw me (ha!), and I can say we are getting spoon fed compared with that it was like when I started Java coding!
I decided I would use a mixture of QML and C++, so one of my screens is entirely C++ generated, another is entirely QML generated, and the others are a mixture. I decided I would integrate as best I could, so I wanted to use the invocation frame work, and the standard Settings menus. I wanted to process assets and create a log file for debugging. So I really wasn't creating a prototype, I wanted to create a application structure that would work for future projects, not just a prototype.
Anyway, I demoed on Friday to my boss. He didn't like some of it (as expected, what are bosses for if not to criticise!), but he couldn't break it - and he can usually break my prototypes. Result! So I'm going to tidy it up for App World.
1) Don't try to code Java classes - use pointers and references. I kept trying to twist things round so that I could use Objects instead of pointers, it didn't work for me, I kept referencing Objects that were on the stack and so were cleaned up when i still wanted them round.
2) Do code a destructor as you are going.
3) Think about your header file - there seem to be a number of vague error messages that basically mean either you forgot to include the header or you forgot to define something correctly in the header file.
A certain consistency in these gripes - yes, C++. And that is accurate. If I could have coded this in Java with the same APIs it would have been easierr for me. But no point crying over split milk. I'm just going to have to get used to it!
I did have one issue that I spent ages trying to figure out - why wasn't I seeing my debug output? - then searched the forum, and found the answer, perhaps unsurprisingly, via a Thread that Simon Hain had contributed to! Look at the known limitations here: https://developer.blackberry.com/cascades/download
In summary, if you feel like taking a dip into BB10, go for it, dive in, the water is fine!
And I'm sorry to say, I have started lurking on the native development forum too....
12-06-2012 03:37 AM
GGs peter, I've been interested in BB10 C++ since day one, and it's nice to have someone actually try out the api properly before use. I can't wait to start now.
I hope the api isn't as bad as 5.0.0 where you can't do half the stuff you could easily do on another platform which uses the same language. *glares at Android*
I've got 99 problems and eclipse is all of them
12-06-2012 05:15 AM - edited 12-06-2012 05:16 AM
The future of Java on BB platforms has been discussed at length in a number of places, including here:
Sorry I did not start this Thread with the intention of discussing Java, rather just to let people know that a Java programmer (of sorts) could pick up the C++ Cascades ball and run with it. Honestly, if I can do it, you can do it too!
Not all APIs are there yet, and I am sure there will be things that you still do better on other platforms. But for me, being selfish here, the best thing is that I can create a good looking API without a load of code. In BBOS, I do work for an app that also exists on other platforms and my UI does not look great when compared with what they can do.
I can confirm that there are loads of people doing development in BB10 - there are at least 7 companies in the UK that I know of for example. I am well behind these people in terms of my BB10 experience.
12-06-2012 05:52 AM
Yeah, now that you mention it, that was another gripe I had with BBOS. UI and functionality was all crammed into the same thing and eventually the whole screen files became a ramen of UI coding and your acual app's algo. Plus there was the issue with stuff not behaving like it's supposed to.
I'm more than looking forward to putting all that behind and start work on C++. Bring on the segfaults!
I've got 99 problems and eclipse is all of them