How to think about programming with Livecode

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
sanoski
Posts: 25
Joined: Sun Jan 25, 2009 10:09 am

How to think about programming with Livecode

Post by sanoski » Wed Sep 21, 2011 5:25 pm

I'm basically just looking for some advice. A friend of mine at Starbucks wants me to build him an app, but I'm having trouble thinking about how to design it with Livecode. It's basically just a tool for memorizing the menu. Everything on their menu has certain characteristics -- flavors (vanilla, chocolate, caramel, etc), and then they all have specific nutritional contents, e.g. 30 grams fat, 6 grams protein, 30 grams sugar, and so on -- different cup sizes obviously have different characteristics. You can look at their website for an example. He wants to be able to type something in and receive recommendations. Each product has numerous different properties I need to keep track of and then reference when a search is made. I'm just not sure how to keep track of all this information. I thought of creating a bunch of cards for every product and using a group control to behave like a background. I could make each card look nice. It would contain all the appropriate information for each product. But I'm not sure how to search through them based on those inherent characteristics. I haven't decided on a syntax yet, but here's an example. Say I type in "chocolate, < 30 fat". It should list out the results in a scrolling list field. When an element is then clicked, it would go to the appropriate card containing that product's information. What strategy would you suggest for tackling such a problem?

Thanks in advance,
Sano

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: How to think about programming with Livecode

Post by dunbarx » Wed Sep 21, 2011 7:30 pm

One way is to load a bunch of cards as you mentioned. Place the keywords in fields as you see fit. Unmark all cards. Then go through a series of finds, marking all cards that contain the criteria you search for (find all instances where calories > 40, then find all instances where cocoa content > 60%, etc.). When you are done, the marked cards will be the ones of interest, and you can collect the data on them into some sort of display.

This can be done with smaller entities than a rolodex of cards, like a single datagrid, but then thumbing through them would not be as fun, pretty, informative and transparent.

Craig Newman

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: How to think about programming with Livecode

Post by WaltBrown » Thu Sep 22, 2011 7:46 am

You could also have say one card per product and have a hidden field on it. In that field put any key:value pairs you want, one per line. "Temperature,Hot", "Fat,< 30 mg", "Stains,Yes", "Size,Venti", "Whipped Cream,No", "Kids,Yes", "Pumps,5", "Shots,3", etc etc. You don't need to set up key words or fields before hand (but you could of course), just enter anything you like. This way you don't have to create new fields for each search parameter, it can just grow on it's own.

Then do the search and mark, like Craig described, for the keyword+comma or comma+value.

Walt
Walt Brown
Omnis traductor traditor

AndyP
Posts: 634
Joined: Wed Aug 27, 2008 12:57 pm
Contact:

Re: How to think about programming with Livecode

Post by AndyP » Thu Sep 22, 2011 8:40 am

Hi Sano,

I think the way you are looking at this would make updating the characteristics when they change a nightnare!

Why not put all the details into a database and then turn your search for say "chocolate, < 30 fat" into a SQL statement to return the list, then if entries need changing, change in the database leaving the app alone.

What platform is the app for by the way?
Andy .... LC CLASSIC ROCKS!

kevin11
Posts: 101
Joined: Thu Aug 11, 2011 5:02 pm

Re: How to think about programming with Livecode

Post by kevin11 » Thu Sep 22, 2011 11:55 am

I would say that this app demands a database.

As well as creating and loading the database, along with retreival of the data and display (on one card, no need for hundreds) I would also suggest you write tools to add new records and amend any records in the database. There are lessons on this site that point the way.

richervin
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 54
Joined: Sat Sep 17, 2011 5:04 pm

Re: How to think about programming with Livecode

Post by richervin » Fri Sep 30, 2011 1:33 am

Trying to understand the user's requirement, I came up with this:

Produce an interface that allows a user to choose a composition - cup size, product type, options, add-ons, and so-forth

At the bottom or top of the screen, maintain a continuous characteristic display containing the fat, calories, carbs, and so on. This mini display can be customizable to meet the user's needs.

As the user adds on and removes product features, they can instantly see the effect of their changes on the display.

One thing, though. Starbucks has an app already, and it may have features similar to this.

Making a recommendation on a small number of characteristics will probably not be practical, since there is such a wide variety of ways to manipulate the end product. To reduce fat, for example, you can choose skim, soy, half-water, no whip, half whip, or with room. There is no way to know which of these features your particular customer would prefer.
LiveCode 5.1.1 on Mac OS Mountain Lion
Attempting to develop for Android and iPhone
Currently on my third trial, and still finding LiveCode to be difficult for mobile applications in general, and particularly poor for Android

Post Reply