An Eye On Design

Alex Souza's Blog
Home » Posts tagged 'corona'

A Temple A Day

May 29th, 2010 Posted in design, development, mobile Tags: , ,

[Disclaimer: This blog has no intentions to be a definitive opinion on Lua or Corona development. It is just an opinion, under the perspective of a non-professional developer, working for the first time with both technologies. If you find anything wrong with the expressed opinions, please feel free to comment and I will revise the text.]

Few minutes ago I upload my app for Apple appreciation. I hope to see it published at the App Store in the next days.

app 

Final interface.

Now, that this is finished, a final report on the application and Corona.

The Good

Ansca Mobile’s Corona is an infant SDK with lots of potential. It is much easier to code in Lua (interpreted language) than Object-C, or even Javascript (again, this is a personal opinion, based in my personal experiences).

Corona’s team are great people (have you ever received an email from a company’s CEO, trying to help you to solve problems? Yes, Carlos Icaza sent an email asking me if he could call my cell phone!), and they are working hard to have a great product.

Beta 2 has been updated every week, bring not only new features, as well as solving past issues. I am really excited to check the new Game Edition.

The samples they provide are also an excellent help to speed up your coding.

The Bad

Although Corona has been updated constantly, it does not have all the features the full SDK offers, meaning you cannot develop some apps like the ones you get from the App Store. Also, the current Corona SDK has much more potential for games than applications.

Specifically about A Temple A Day, I had to cut down several originally planned features, due the lack of some controls (mostly table view and asynchronous http request, for example). Fortunately, I could change my original idea to something doable but, consequently, I had to price down it.

Conclusions

If I had to develop a “regular” application again (and I plan to do it in a near future), I would probably spend more time with Appcelerator Titanium, instead of Corona. They are ahead in native controls. Unfortunately, I couldn’t “click” yet with their development tools and samples. Again, this is personal. I am waiting for the book they are writing about Ti.

Although, as of today, Corona is not that ready for apps in general, I am enjoying a lot to learn Lua, sharing experiences with the community in the forums, and planning my first game. The SDK may not be that strong for reference applications but, it really rocks when game is the main subject. As I mentioned above, I am looking forward for the Game Edition they are building at this moment.

If game is your “thing”, Corona is ready for you. Don’t wait and buy it with the special introductory price of $99, getting the Game Edition in this price. If you want to code apps with native controls, wait a little more or try other SDKs like Titanium or PhoneGap.

Myself, I will stick with Corona, keeping a closer look at Titanium progresses.

To the next app!

Alex

Updates on the app

May 20th, 2010 Posted in design, development Tags: ,

[Disclaimer: This blog has no intentions to be a definitive opinion on Lua or Corona development. It is just an opinion, under the perspective of a non-professional developer, working for the first time with both technologies. If you find anything wrong with the expressed opinions, please feel free to comment and I will revise the text.]

Last week, with the announcement of the new beta SDK from Ansca, I took a hard decision in reviewing my entire app (I had it 60% done), and re-start the coding, replacing the dozens of text files, for a SQLite database (thanks Ansca for bring SQLite to the SDK!).

I spent a few days reviewing the interface (check below how it is as of today), as well as handling some bugs or “unusual things”, that runs well in the simulator, but not in the device. For example, when user select a place, I get the place name, for example “Colonia Juarez”, as well as the file name for the place image (in this case “ColoniaJuarez”. In the same folder, I have the image files, which included “coloniaJuarez”. When running in the simulator, I got some warning messages informing that Corona “assumed” that “ColoniaJuarez” (the file name variable) is the same as “coloniaJuarez” (real file name), but the code ran perfectly. When I went to the device, I kept getting blank images. Now that I found the error, it seems a very simple thing but, I spent a few hours with alerts and “prints” trying to figure out what was happening.

photo_new

Buttons in the interface mean: 1) More options (which shows the last 3 buttons), 2) Call place, 3) Directions to place and 4) Share info. Blank (future) menu in the bottom will allow users to list places by name, sort a place and discover the closest place to visit

Lastly, I cannot say how grateful I am for people like Scott Powers and Mike Hart, from the Corona forums. They keep helping me with my questions, and this app would take much more time to be developed without them.

I will share some code in the next posting.

Alex

Moving forward with the app

May 11th, 2010 Posted in design, development Tags: ,

[Disclaimer: This blog has no intentions to be a definitive opinion on Lua or Corona development. It is just an opinion, under the perspective of a non-professional developer, working for the first time with both technologies. If you find anything wrong with the expressed opinions, please feel free to comment and I will revise the text.]

I had lots of progresses in the past days, not only with Lua, but also with Corona. I bought the SDK, which gave me access to beta 2. Although I am not using any features from the beta code, it seemed to be very stable and with good potential.

I spent most of my time setting the interface (portrait and landscape modes), also learning the correct way to align text (thanks to all support coming from Corona forums!) and positioning/animating my main icons. Here a list of situations I found:

- As I mentioned, my app has portrait and landscape modes. In landscape, users will see a full 480×320 picture rendered. In portrait, they must see part of the “big picture”, in 320×480. I couldn’t find a way to use just one big image and position it accordingly. At the end, my temporary solution was to use 2 images, one for each scenario. My main concern here is the total size of the application, as I am duplicating files;

- I found a bug in rotating the status bar (it does not rotate at this moment). Ansca already flagged this as an official bug (see the image below);

photo 

App in portrait mode, with full menu closed (see the arrow).

Checking the current design, plus considering my and Corona’s limitations, I have reviewed some features and changing a little the application scope. Also, getting involved with Lua, I decided to review some coding too (that’s why I am not posting it here). I am cleaning the current code and I will post an update late today or tomorrow.

Overall, I am starting to enjoy Lua and looking forward to finish this app, in order to start a new one (probably a game).

photo1

App in landscape mode, with full menu opened.

Welcome! Bem vindo!

May 4th, 2010 Posted in development Tags: ,

[Disclaimer: This blog has no intentions to be a definitive opinion on Lua or Corona development. It is just an opinion under the perspective of a non-professional developer, working for the first time with both technologies. If you find anything wrong with the expressed opinions, please feel free to comment and I will revise the text.]

My app must be international. Saying that, I planned to allow it to find which is the current language setup in the device and, enabling the correct idiom according that. I created an “.idi” file for each language I am planning to reach. For example, the english.idi file contains:

line 1: Send Mail

line 2: More Picts

line 3: More Stories

and the list goes on…

Below the code I used to make the selection, according the information coming from the phone:

   1: — Read idiom file according locale

   2: local language = system.getPreference( “ui”, “language” )

   3: local translatedStrings = {}

   4: local function loadIdiom (language)

   5: local path = system.pathForFile(language, system.ResourceDirectory)

   6: local file = io.open(path, “r”)

   7: if file then

   8:    local i = 0

   9:    while true do

  10:      i = i + 1

  11:      local line = file:read(“*l”)

  12:       if line == nil then break end

  13:           — load all strings according idiom

  14:         translatedStrings[i] = line –.. “\n”

  15:     end

  16:       print(translatedStrings[1])  –shows first line

  17:   end

  18:   io.close(file)

  19: end

  20:  

  21: if language == “en” then

  22:  loadIdiom(“english.idi”)

  23: elseif language == “pt” then

  24:  loadIdiom(“brazilian.idi”)

  25: else

  26:  loadIdiom(“english.idi”)

  27: end

  28:  

As you can see, I started getting the current language at line 2. Lines 21 to 27 select the correct .idi file and call the function loadIdiom, which reads the correct file and save all lines in a table (array). With this table, I will be able to call the correct string according the number of the line. For example, when I need to refer to string Send Mail, I will use translatedStrings[1], considering the string Send Mail is in the first line of the .idi file.

Hope it helps!

Alex

Lua and Corona

May 3rd, 2010 Posted in development Tags: ,

image

After mocked up my main interface and define my feature list, I evaluated the things I can and cannot do with the current Corona SDK (I can’t get access to the beta SDK as I am using the trial version). My list of CAN’T do includes:

- no support for SQLLite database (this is crucial in my case as I will have a list of places that must be available, even if the user is not connected) – I am addressing this with data in a text file. This is not the way I would like to implement but, considering I will have only hundreds of records, it will work;

- no MapKit integration, meaning I will not be able to render a map in a small part of the screen (when the user taps “see in the map” I will have to render a full HTML file showing the map, over the main screen;

- no native components nor keyboard available in landscape mode. This is hard, specially because I was thinking to address iPad as one of my targeting platform (Apple requires that the iPad interface works both in Portrait or Landscape);

- no email integration (I can’t create the email’s body programmatically);

Ansca has published its roadmap for Corona but, although several topics seems to be in their list, dates are far from final (in most cases they only say Q2/Q3, meaning something may be available from April to September– this is not the best way to get new customers to their platform!)

Knowing my limits, I read all Corona documents, plus the Lua official book and started to code. Some findings at this moment (please feel free to correct me if I missed something):

- You can’t find the same number of Lua samples in the web as you do for languages like Javascript or PHP. It is hard to move on when you are stuck;

- Lua book is not updated (the live code is different than the code printed);

- Corona does not implement the full Lua 5, meaning some functions are not available (after hours trying to work with dofile, for example, I figured out this is not available in Corona);

[Update: Scott's comment below confirms that all Lua 5.1 is implemented in Corona. Thanks for this info. I hope Ansca can create a table with the functions not available due security issues with the iPhone SDK]

- Because Corona does not have integration with SQLLite yet (Lua  can do that), I have to work a lot with arrays, a concept Lua does not have – the closest thing is tables. Problem is, tables are much more difficult/confuse to use than arrays (if you are familiar with arrays). Basic functions like arrayName.count (counts the number of elements in an array) do not exist in Lua tables (yes, in order to count how many elements I have in an array, I had to create a function who reads element by element and return the number found – crazy!).

[Update: Clearly I missed this info. There is a way to count arrays without the function I have used. In fact is is much simpler than I even imagined: to count the number of elements in a table called "places", all you have to do is: #places]

Although I expect a miserable life in the next weeks, developing in a language I do not know, without many examples to search, plus the fact Corona SDK documents could be improved (also it is oriented to games instead of apps), I will keep you posted on my progresses.

[Update: I agree that Corona offers lots of good examples and samples but I still think they could improve their documentation.]

Why am I doing that? Because I really think it is going to be easier to learn Lua/Corona plus developing my features according the limitations, than to learn Object-C. Time will tell if I am right or wrong (and you are going to know from here).

BTW, I have written a few functions I will comment in the next postings.

Alex

Going mobile, going Mac

April 27th, 2010 Posted in development Tags: , ,

top-5-cell-phones

After almost 10 years, yesterday I bought a Macbook Pro again (don’t leave yet if you are a Windows fan, I still have 3 Windows 7 machines at home, and I have bought already my Windows 7 Pro to install in the new notebook).

Why am I confessing this? Basically because I want to develop mobile apps to as many platform as possible. Like or not, the iPhone platform (including iPad and iPod Touch) has a huge penetration and, because Apple owns that, we developers have to have a Mac.

So, what about the machine? Clearly it is expensive for the components it has (I bought the 13.3’, who still has a Duo). For the same price, I could have bought something much more faster and with lots of other accessories, but running Windows. Again, it is the price to pay to be cross-platform.

My plans? Build apps to iPhone, iPod Touch, iPad and Android (future Windows 7 Phone Series and Blackberry). You may ask: “Do you code in Object-C"?”. No, I am planning to start with the Corona framework, from Ansca Mobile. The SDK from Ansca exports to iPhone, iPad and Android at this moment. Also, you code in Lua (much easier than Object-C or any other object-oriented language). Is it good? I don’t know yet but I am planning to share my learnings in the following posts.

Keep in touch,

Alex