B4A vs challenge 2, and what was the final result after about 1.5 days???

Hello all,
I'm not sure if anybody remembers this, but about 3 years I was issued a challenge by one of my friends who is an Android app developer for a company, he challenged me to create an app against him and the loser would have to pay for snooker or a curry when we went out next, suffice to say that I won that particular challenge by about 50 minutes, I even had time to walk to get some shopping before he finished his app using Eclipse.

The dreaded rematch:
Yes, 3 years later my friends brought up his horrible defeat and offered me a rematch but this time he would be using Android Studio as the firm he works for uses Android Studio as their primary development tool now. I decided to accept his challenge but I will admit that as it was Android Studio I presumed that he would have a huge advantage, so I set some ground rules.
  1. We can't copy and paste previously used code from our projects, except for connecting to my online MySQL databases.
  2. We can only use online resources, we CAN'T rely on our previous code base.
  3. It's a 1 day challenge, but because we set the bar so high the challenge went into a 2nd day.
  4. In theory the app MUST be able to be placed into the Play Store if we just swapped from MySQL database to an SQLite database.
  5. The app MUST have it's own camera feature.
  6. The app MUST have at least one search feature for searching the database for results.
  7. The app has to look presentable, no horrible layouts.
  8. The app should only be designed for use with Android phones, thus the app has to work with all of my phones in my desk drawer, Android tablets don't really matter in this challenge.
  9. The SDK must be set to 26 and above.
We had 3 options for making an app. Option one was to create a 10" tablet bespoke entertainment system like what his company makes for their clients, this was my app of choice but Imran pointed out that we needed lots of video feeds with mapping and other features, plus in theory we could not really put that on the Play Store. Option two was a simple restaurant system for taking orders and matching order to table numbers with extra food options and images, that was my second choice. Imran had a spare database on his laptop but after looking at it we decided that app would take a good few days to write, Imran writes those apps in his spare time for clients and between you and me I really wanted to beat him at his own game. We went for option three, a simple stock control app. Imran has used my template MySQL databases before so I setup 2 spare databases on my online server to speed things up and that was the challenge.

Imran turned up on Saturday morning with a work colleague and asked me if his colleague/friend could also join in on the challenge. Wait a minute I said, so that's two professional developers using Android Studio vs me on my Jack Jones using B4A. At first I said no way, but then Imran kept saying that I keep boasting how simple B4A is to use (Erel, I personally blame you for that one ;)). Imran broke me down and I reluctantly said yes to his challenge, but if I win he owes me not one but two nights out for curries or pizzas or snooker, he said yes okay :).

Let the challenge begin, option 3 was right up my street: #takingcandyfromababy.
We started coding at midday and I had to remind both Imran and his colleague Matthew that there was absolutely no conferring aloud just idle chit chat jokes etc etc etc. Imran could help Matt get to grips with the third database that I setup for him as Imran knows that particular database like the back of his hand.

Within an hour I had setup my database connectivity and a few other key features like in the manifest the app colors, ToolStrip resources, permissions etc, I had figured out what I personally thought was the best design layout for my app (the design did change a number of times throughout the challenge), I had also started to create the layouts using the built in designer. Don't forget that we could only use online resources and none of our previously created code base, that would have made the challenge way too easy as it would have become a cut and paste challenge and over in just a few hours.

Deep down I personally already know that I had a HUGE advantage over Imran and Matt, I had this great forum and ALL of its excellent resources at my disposal which is basically all I needed. Imran and Matt on the other hand had the whole internet to wade through with lots and lots and lots of code and results just to complete simple tasks blah blah blah, I know which one I preferred ;)

As we laughed and joked together whilst coding, deep down none of us wanted to lose, no way, especially Imran again. All I could hear was Imrans keyboard tapping away like crazy, he types faster than I do. I was coding away, Imran was coding away, Matt was coding away too. I was drinking rum and cokes, Imran was drinking tea, orange juice and ribenna, I let Matt just raid my alcohol drinks cupboard at will, hopefully the alcohol would slow him down a bit as he was typing really quickly too ;)

It was now about 5pm, we went 3 ways on pizzas, garlic bread and fries, oh yes and 2 large bottles of coke. Wow, doesn't time fly when you are having fun, well I was having fun as all the code I needed I was finding extremely easily on b4x.com, I was not sure about the other two though. At about 6pm I suggested that we stopped and continue the following day, both Imran and Matt said they would preferred to carry on for a few hours more, so I agreed. At 7:30pm I said that we had to stop now as I was going out for a few drinks with a couple of friends, so we stopped.

Pause time rules:
I suggested that we set some rules
  1. NO coding
  2. Definitely NO coding
  3. Absolutely NO coding
  4. No looking up solution or answers
  5. No home work whatsoever which is basically the same as 4
  6. ABSOLUTELY NO CHEATING
We all agreed to the above terms, we would continue the following day at my house again at midday.

The following day, Sunday:
So Imran and Matt turned up at mine at 10:30am, about 90 minutes early, but my house and my rules, laptops can only be turned on after 11:45am :rolleyes:

Midday arrives and we start coding again, I'm on a roll and I can hear Imran saying how happy he is with his progress. At this point I was shocked as I was sure that they were both behind me the day before and that their apps would not as nice looking as mine should be. The pressure was now on so I pushed and pushed and pushed and pushed, I typed faster and faster and faster, I typed as fast as possible debugging my code as I tested it. My code is looking messy in places, not my usual neat and tidy code, but I really didn't care, at this point code that should have been 10 lines long but was in fact 15+ lines long didn't bother me like it usually does, as long as it worked I didn't care one little bit. I usually do some coding and once I get the routines working, I then go back through the routine or sub making it smaller, faster and neater if possible, but not this weekend, not on Saturday or Sunday, my code could look like it had been dragged through a bush backwards and I wouldn't care one little bit, I didn't have time for that rubbish, as long as it worked that is all I cared about, I could always tidy up the code at a later date.

At about 3:20pm I came up with a great idea, I would add a Bluetooth barcode scanner. I quickly looked on the forum and I found Erels updated BluetoothManager 2018 example. Hmm, hmm, hmm I was not happy, I had never seen this updated 2018 module before and I just couldn't get it to read from any of my barcode scanners, BluetoothManager 2018 would always find and connect to all of my scanners first time of asking, but when it came to scanning/reading/sending the data to my app, Private Sub AStream_Error was the only sub that was firing, it should have been the Private Sub AStream_NewData (Buffer() As Byte) sub firing. I sat there for well over 45 minutes maybe even over an hour trying to figure out how to get the module to receive data from any of my Bluetooth barcode scanners. I never had this problem with the previously posted code, I remembered adding the previous code and scanning/reading barcodes instantly getting results.

I was now getting seriously frustrated, I was getting annoyed, I sent Joanne my better half a message, she replied with 'don't worry about it, you will find a way to get it working, you always do', but I couldn't not this time, I was now getting more and more annoyed with the whole situation and this new updated BluetoothManager 2018 module. The fact that no matter what I tried doing, BluetoothManager 2018 was not firing the Newdata sub, just the error sub was just sending me crazy :mad:

Edited: Please note that on Monday I got the BluetoothManager 2018 update working in less than 10 minutes, please read my response to Erel's post below.

Lets now continue:
I needed a break, I could hear Imran getting frustrated about something so I asked him what was the matter. He replied that he couldn't find code that he needs on the net which he has used lots of times in the past and was located on his laptop and also on his companies servers under developers resources. That was my chance to do a Donald Trump and to cut a good deal with Imran and Matt. The deal that I suggested was that he could use the code from one of his previous projects as long as I could do the same, but only once and for one feature only, we shook hands and 10 minutes or so later I had implemented some barcode reading code from a previous project of mine and my barcode scanners were all working perfect in my Android app, now that was my get out of jail free card played in Monopoly. To tell you the truth I had heard Imran moaning for about 90+ minutes, but I only asked him when I could see he was seriously getting annoyed and I needed a quick 10 minute break. I actually didn't need to add a barcode scanner routine, I just wanted one in the app.

The home straight, it was game over, but who for?
Have you ever seen that classic old western called 'The good, the bad and the ugly', well that was us three but we were not 3 gun slingers standing about in a circle with guns, we were 3 developers sitting down with laptops firing (typing) away like crazy, by the way I'm 'The good' in this movie :p

The time was about 6:15pm and I had gotten everything I wanted to integrated into my app thanks to all the resources found on b4x.com. I had integrated more into my app than I really needed too, but hey, I could so I did. I didn't announce that I had finished to the others, but instead I sent Imran an email link to Dropbox which was of course the compiled APK file, in turn Imran sent the link to Matt, they installed my app trying it out for themselves. Matt said 'hey what the..., you've finished it already', I said yes, Matt instantly replied 'well it can't be that good if you have finished it that quickly, you must be missing loads of features', I said to check it out for yourself, so he did. Imran on the other hand just looked at me blanked faced and in complete disbelief, he just said 'not again, seriously'. As it was, I found out later that both Imran and Matt were nowhere near finishing their apps, they said that they probably needed an extra 3 or 4+ hours to finish their apps. I had finished my app and I had more features too, both of them just couldn't believe it, I used tabs whilst their apps were popping open new activities left right and centre, Matt used an ugly looking scroll view in his add new stick screen. Whilst they were testing my app and playing about with it, I went though my code tidying it up slightly, nothing special and that was aloud as it didn't change the outcome of the B4A vs challenge 2. If it wasn't for me having issues with both the Camera 2 and BluetoothManager 2018 modules, I would easily have finished 2 hours earlier.

Things didn't all go 100% to plan though.
  1. I couldn't get BluetoothManager 2018 update to work as I expected, that was the only thing that really annoyed me.
  2. I made a spelling a mistake whilst adding long click event to xCLV, I don't use normal short clicks.
  3. My auto centre and auto sizing the ImageViews source code took longer than expected, my faults completely.
  4. Took too long for me to find the FontAwesomeToBitmap sub on the forum even though I know it was here somewhere.
  5. I wrote a working ProperCase routine when there are some on the forum already like ToProperCase, wasting precious time.
  6. The Camera 2 module does not work with my older Samsung phones (legacy errors), so I reverted back to the original Camera module that works perfect, about 60 minutes wasted there with the Camera 2 module.
  7. I spent too long testing image compressions, way too long.
  8. I could speed up high quality photo image taking, but images were not high enough quality, so currently the images are larger than I like but I'm sure with more time I can make them 1/5 smaller in size with minimal image quality loss.
  9. Numberpad module would open by itself if tabbing from left to right, I just removed the extra tab to fix that issue.
  10. I wished that I had added a login screen, it would only added an extra 15 or so minutes to the project.
  11. I don't like the view stock and add stock icons, but they will do for now.
  12. If I knew that I had all that extra time in hand, I would have added a small mobile Bluetooth printer to my app.

My app:
Here is a video of the winning app, sorry MY winning app developed in just a day and a half using B4A :D

The audio is not the best, my throat was not right as I had a cold at the time of recording so the sound is muffled in places and my pronunciation of some words are not clear at all, so sorry about that.

The app took a day and a half to develop mainly because I added more features than what was actually needed, and I changed my mind on a number of occasions about the look and feel of the app, plus I had the issues listed above which I really should never have had, after all I'm now a seasoned veteran when it comes to using B4A these days ;)

Thanks to all the library creator/wrappers, without whom this challenge would not have been remotely possible for me to do.

Will Imran challenge me again one day, third time lucky, let's wait and see ;)

Cheers...
 
Last edited:

Ed Brown

Active Member
Licensed User
Longtime User
Brilliant!
I remember the first challenge :) Surprising that your friend was prepared to lose again. Three years is long time between challenges and there's been so many great updates to B4A in that time. I don't suppose that you mentioned that to your challengers ;)
 

sorex

Expert
Licensed User
Longtime User
Well done, Peter.

It's looking good too, not just some working mockup.

We went 3 ways on pizzas, garlic bread and fries, oh yes and 2 large bottles of coke.

coder's food! (just missing a big bag of chips/crisps to pass the night ;) )
 

Peter Simpson

Expert
Licensed User
Longtime User
Thank you all
Will be amazing if you can share the winning code :):):):):):):):):):)
Now that would be amazing ;)

Brilliant!
I remember the first challenge :) Surprising that your friend was prepared to lose again. Three years is long time between challenges and there's been so many great updates to B4A in that time. I don't suppose that you mentioned that to your challengers ;)
Thank you Ed,
Yes 3 years is a long time to be stewing on a loss, poor Imran;). I almost had a heart attack when he suggested that we go for round 2, especially as I believe that one can start an Android Studio project by using a built-in template of sorts, thus within 10 seconds of us starting the challenge, I was effectively already about 20 minutes behind.

I only showed Imran and Matt the latest and greatest B4A once the challenge was all over, they were both impressed especially Matt as he was convinced that I had cheated until I showed him how little code I used in comparison to both him and Imran, and how simple the code flow actually was. I showed them the designer and the designer scripts that I had created for the auto sizing of images, I showed them the manifest file, and I showed them the library tab and the libraries that I had used, I also showed them how easy it was to debug in B4A. Imran basically already knows about B4A from his last thrashing, but Matt was impressed with this forum, it's resources and all the answers for question. I also showed them both XUI and XUI2D posts from @Erel. At that point Matt noticed my SmartWatch watchface, he laughed when I told him that I created it using B4A, but he was not laughing once I showed him my source code.

I would absolutely love to see B4X and especially B4A go mainstream in a HUGE HUGE HUGE way, it deserves to be.

Great job Peter!

I would be happy to further discuss the BluetoothManager issues you encountered...
Thank you for the offer @Erel
After reading your post I thought to myself that there was absolutely no way on this planet I would ask you for help on something so simple, not after the coding weekend I've just gone through, so a few minutes ago I re-downloaded your BluetoothManager 2018 project and looked at it again.

This time the first thing that I noticed was that there was no LastException in the error sub, so all I did was add 'Log(LastException.Message)' to the 'AStream_Error' sub, I then ran the code again, this time I received an error message that I recognised, wow I've actually gotten somewhere with this module and only after a couple of minutes this time. After reading the error message I changed 'AStream.InitializePrefix' to 'AStream.Initialize' and boooooooooooooooooooooooooooom it worked, 'AStream_NewData' received barcode number from my scanners.

Really Peter, that was all you had to do, yes Erel ;) and it all started with adding 'Log(LastException.Message)' to the 'AStream_Error' sub. Total time 2nd time around, about 5 minutes, maybe 7 minutes at a push lol. I probably missed the obvious over the weekend because of the situation, unlike a few minutes ago when I could take my time and if need be take all day, during the weekend I didn't have that luxury, there was plenty of stress and a bit of pressure involved.

Well done, Peter.

It's looking good too, not just some working mockup.

coder's food! (just missing a big bag of chips/crisps to pass the night ;) )
Thank you Geert,
One of the conditions was that in theory we should be able to be uploaded the app to the Play Store if we were using an SQLite database instead, so that means that it had to look relatively good and definitely had to be functional. I can't really complain as I got everything working as planned and I only came across a couple of issues, one of which I resolved only a few minutes ago on my 2nd attempt :rolleyes:
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
It must be taken into account that some developers are very quick in coding. In a few hours I put or on the completed App. While others are slower.

The next time you should have a fast developer of B4X compete with you, you will be 4 challengers ... Yes maybe it is half a cheat, but only half .. would highlight more the difference

Ah .. do you want to know how to identify a fast B4X programmer?
Simple, you must hold a challenge in the forum.

Establish the day and time of the challenge, when you reach that moment release the characteristics of the App and the rules. Who produces Apk faster has won.
(Of course here you could allow the use of your own code of other apps)
 

Peter Simpson

Expert
Licensed User
Longtime User
It must be taken into account that some developers are very quick in coding. In a few hours I put or on the completed App. While others are slower.

The next time you should have a fast developer of B4X compete with you
.

Hey, are you offering to come to my house, I live in a nice area called Solihull, it's in the West Midlands just outside of Birmingham, oh yes did I say England, United Kingdom :)

Okay you're on my team and bring some wine with you, but don't bring the cosa nostra with you :cool:

Seriously though, I would say that the simple fact that we added the rule that neither of us were aloud to use previous code was a great idea. They work for a large company that appears to have endless resources of code. Imran and Matt even when working from home usually just logs into work and within minutes they have their resources found with source code from their work server and detailed explanation on how to integrate it from the creator, then just basically integrate the code and it all done.

I just thought that it would be good if we started from scratch with absolutely no resources, just the internet. I mean if we used our own resources we could simply have cut and paste code and that boring challenge would have been over in just a few hours, where's the fun in that, it's just become a cut and paste competition, no thank you, I prefer to watch paint drying.

It was a good weekend, even if I would have lost it would still would have been fun having him around laughing and joking whilst competing, we compete at snooker too. Matt spent ages checking out my reference system, he loved the sound of it as he's a bit of an audiophile.

It was fun, anyway I've now got to go out for a quick bike ride before I jump in my car to see Joanne...

Edit:
Challenge on forums, no thank you, as that could just become another cut and paste fest too, well not unless it involves plenty of maths, calculations and formulas which I already know you are really good at :rolleyes:

Erel has ran a competition previously. I seem to remember some timing or looping competition at one point, how fast to run a formula or something like that. You should set one up @Star-Dust, you can pay for the winner to have a free holiday with their partner to Las Vegas with all expenses paid :D
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
.

Hey, are you offering to come to my house, I live in a nice area called Solihull, it's in the West Midlands just outside of Birmingham, oh yes did I say England, United Kingdom :)

Okay you're on my team and bring some wine with you, but don't bring the cosa nostra with you :cool:

Seriously though, I would say that the simple fact that we added the rule that neither of us were aloud to use previous code was a great idea. They work for a large company that appears to have endless resources of code. Imran and Matt even when working from home usually just logs into work and within minutes they have their resources found with source code from their work server and detailed explanation on how to integrate it from the creator, then just basically integrate the code and it all done.

I just thought that it would be good if we started from scratch with absolutely no resources, just the internet. I mean if we used our own resources we could simply have cut and paste code and that boring challenge would have been over in just a few hours, where's the fun in that, it's just become a cut and paste competition, no thank you, I prefer to watch paint drying.

It was a good weekend, even if I would have lost it would still would have been fun having him around laughing and joking whilst competing, we compete at snooker too. Matt spent ages checking out my reference system, he loved the sound of it as he's a bit of an audiophile.

It was fun, anyway I've now got to go out for a quick bike ride before I jump in my car to see Joanne...
I thought more of a challenge from a distance, I live too far, and I would drink the wine along the way. :p

But it's not a bad idea to create a challenge on Chit Chat .:D
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Have fun Peter. I do not know who Joanne is, but I suppose she's a woman and you're anxious to see her. :p:p

In fact I could reward the winner on a holiday in Sicily, a tour of all the bosses of Cosa Nostra :D:D;)
 

Star-Dust

Expert
Licensed User
Longtime User
I do not know why but the idea of the challenge has suggested another idea that is constantly buzzing in my head. A Web-IDE, ie the ability to write code from an online IDE environment ....
Maybe with a Hosting compilation service similar to the one offered for B4I.

Maybe there is a similar IDE you can inhibit the copy and paste and check that there are no cheating ...

But I do not even suggest it to @Erel in the WISH section, for now it's completely kidnapped by the games
 

Peter Simpson

Expert
Licensed User
Longtime User
Maybe there is a similar IDE you can inhibit the copy and paste and check that there are no cheating ...
[/USER] in the WISH section, for now it's completely kidnapped by the games
I've seen that on some websites when you right click on images to stop you from copying their images, but then in Firefox you can still copy the images anyway lol.

But I do not even suggest it to @Erel in the WISH section, for now it's completely kidnapped by the games
Yes that XUI2D has Erel working like crazy. I laugh my head of if Erel released his example game as a fully released game on both stores just to show what XUI2D on B4A and B4i can do, I would then stop laughing if the games became best sellers on both platforms ;)

I could reward the winner on a holiday in Sicily, a tour of all the bosses of Cosa Nostra :D:D;)
Erm err err err hmm, I think that I'll pass on that particular challenge, but thank you for the invite. Err err err I'll be washing my hair when you announce it :oops:

Yes Joanne is my partner, or as I always say, she is my better half :p
 
Last edited:

Peter Simpson

Expert
Licensed User
Longtime User
May the 'B4X' be with you .... Always !

Thank you John, 'B4X' right back at ya...

Was there a video of the other app (Eclipse)?
The challenge 3 years ago was against Eclipse and even though Imran did finish his project neither of us made a video of it. This time out Imran and Matt were both using Android Studio, anyway neither of them finished their projects so no video from them. I only created the video to show what could be created from scratch in just a day and a half and not using any previous code except for connecting to the online databases on my server oh yes and the barcode scanner code.

It's actually very surprising how much coding Imran and Matt have to do compared to us on this forum using B4A just to do something simple. What we B4A developers do in just a few lines of code appears to takes a lot more lines Android Studio, well it looks like that to me.

Well done ! .. nice and simple design.
Cheers...

Nice Peter. Thumbs up!
19.ThumbsUp_960x663.gif
 
Last edited:

Diceman

Active Member
Licensed User
"It's actually very surprising how much coding Imran and Matt have to do compared to us on this forum using B4A just to do something simple. What we B4A developers do in just a few lines of code appears to takes a lot more lines Android Studio, well it looks like that to me."

Maybe for the next challenge he'll show up with 5 programmers in tow. :rolleyes:
Nice clean interface for the app BTW.
 

aeric

Expert
Licensed User
Longtime User
Yes that XUI2D has Erel working like crazy. I laugh my head of if Erel released his example game as a fully released game on both stores just to show what XUI2D on B4A and B4i can do, I would then stop laughing if the games became best sellers on both platforms ;)
Please don't laugh at Erel, I think he is making a good game platform. I will certainly download the game if it is released. I am planning to use his samples to show to everyone that he can make a great mobile game using B4X.
 
Top