Writing a mac app - where to start?

Posted by: padmavyuha

Writing a mac app - where to start? - 11/09/08 04:40 AM

It's possible I may have asked this before, but this is with renewed enthusiasm and some spare time...

Getting back in to weaving, I was looking for mac apps to experiment with weaving patterns - there's only one, and it's ridiculously expensive and intended for running industrial-size patterns. Trying out the available/affordable winxx apps, they're basically pretty crap, and I think I could make a much more usable app on the mac.

The problem is, I've never written an app before, never coded in cocoa or whatever, and don't really know where to start. Can anyone suggest good books/resources for someone starting from scratch writing a cocoa app that uses quite a lot of (probably fairly simple) graphics? the basic idea of the app is to create a graphical matrix that shows what a particular tie-up and treadling sequence with particular warp/weft colours will look like as a cloth. Here's an example of a cheap/bad winxx app trying to it (sorry about this):



I'm not completely new to coding, I've written a lot of code in a proprietary sort of BASIC that belonged in a pre-windows 4G database app called Advanced Revelation, and I've done some Fox BASIC and some fairly intricate LISP (also for a GUI app).

I assume that having leopard, I already have the xcode development kit on my DVD (though I'll need to d/l an up-to-date version) - but for me it'll be like wandering around the LHC without a map...

(Actually, I find myself wondering whether there's any mileage in considering developing it in webkit form - would that be terribly slow for large arrays?)

- padmavyuha
Posted by: zwei

Re: Writing a mac app - where to start? - 11/09/08 09:01 AM

link-o

That's where I suggest you start. Create an account and copy/paste your post into their developer forums. They have been quite helpful to me in the past.

Also, there is a LOT of documentation that comes with Xcode ...good luck wink
Posted by: Svend

Re: Writing a mac app - where to start? - 11/09/08 10:40 AM

Go to your local book store. In the computers section there are probably several how to get started books. Look through them, pick the one that works best for you.

Something like this, maybe -







I believe your idea of a first app, your weaving program, is way to ambitious of an undertaking to start with.
Posted by: padmavyuha

Re: Writing a mac app - where to start? - 11/09/08 11:17 AM

Thanks... Yes, it's ambitious, but in my experience it's much easier to get motivated to learn how to do something if you have a genuine project you want to bring to fruition, rather than some vague idea of learning in the abstract.

I've got some idea of what might be involved through sitting down and beginning to scope out what I want the app to do. There's a lot of interesting logic to work out in order to make the coding behind display of the weaving pattern array as 'elegant' as possible in as few lines of code as possible. The image I posted above just dips its toe into what's possible even on a 4-shaft loom, never mind on the 8-shaft one I'm actually using at home. I've basically got to create a resizeable visual array whose contents/colours are determined by switches and colour selectors for each warp/weft. It's nowhere near as complex as, say, creating a game arena, because there's no interaction with the actual weaving display itself, just tweaking it from the edges. I'll worry about more fancy things like 3D effects later on smile.

This is also going to help me with my own weaving, and understanding more deeply how weaving patterns work. It's then going to be fun adding all the functionality like selecting blocks of pattern and copying them, changing one colour to another globally or within a selected range (something a lot of the other apps don't do, stupidly enough), how best to print the thing out, and opening from/saving to the existing .WIF file format that other weave apps use, which offer users a lot of preformatted templates.

Fun and headache, I'm not expecting to get this done any time soon. Meanwhile, I've been hunting around on the net, and people have pointed me to two books: 'Programming in Objective C' by Stephen Kochan (for learning Obj-C from scratch) and Cocoa 'Programming for Mac OS X' by Aaron Hillegass (for the cocoa- and OSX-specific stuff, including using xcode etc.)

Lots of forum etc. help available, I just need to crack into it.

- padmavyuha

Posted by: neil

Re: Writing a mac app - where to start? - 11/09/08 11:39 AM

Guys,

There's an entire column in MacTech dedicated to helping people learn to write apps on Mac OS X. It's called Road to Code.

Look up Dave Dribin ... he's the author behind the series ... you can see his article list at:

http://www.mactech.com/articles/mt_indices/D_Authors.html
Posted by: Nagromme

Re: Writing a mac app - where to start? - 11/09/08 01:58 PM

I'd also consider RealBASIC, which I think has a free trial.

And there are a zillion open-source 2D game engines, some of which are less technical to learn than others. One of those might lend itself to weaving!
Posted by: padmavyuha

Re: Writing a mac app - where to start? - 11/09/08 05:14 PM

Thanks for the ideas, folks...
Posted by: FSM

Re: Writing a mac app - where to start? - 11/10/08 06:37 AM

Originally Posted By: Nagromme
I'd also consider RealBASIC, which I think has a free trial.

And there are a zillion open-source 2D game engines, some of which are less technical to learn than others. One of those might lend itself to weaving!
i made a simple app using RealBASIC about 4 years ago or so. i kept the code pretty short, yet RB added a lot of bloat and my app was huge. if i get back into it, it's Cocoa all the way for me.
Posted by: Nagromme

Re: Writing a mac app - where to start? - 11/10/08 03:33 PM

FIle size isn't too critical these days. Maybe my 10MB app could have been 2MB, but no harm done. (Plus being able to deploy instantly to Windows and Linux was nice.)
Posted by: padmavyuha

Re: Writing a mac app - where to start? - 11/12/08 03:16 PM

I've just started working my way through Programming in Objective-C - it's very well written so far, functioning as an introduction to programming for someone who's never really learned it systematically before (and no object-oriented stuff anyway). I've opted for writing the test programs in TextWrangler and compiling/running them in Terminal for the moment, because I tried using Xcode and it felt like climbing into the flight cabin of a Concorde in order to cross the road smile. The book is a little out of date in that area, in that it walks you through using Xcode's predecessor, Project Builder. This means that something as basic as running a 15-line program and actually seeing the output from it is currently beyond me. I'll need to know how at some point, but the TW/Terminal combo suits me fine for now.

The author is doing a good job of explaining the basics of objects/instances/methods etc. - I've had folk try to tell me about this before, but this is the first time it's started to make sense.

I'm finding this strangely exciting - I suppose it's because I've been using computers for 22 years now, and now I'm peeking under the bonnet properly for the first time. Plus I love languages!

There is already a wee corner of my mind that is starting to mull over how one might define graphical objects that will end up displaying an array that resembles a weave pattern - and of course, there's another slightly larger corner of my mind that is already considering what would be a cool name for my app smile. I have (just) enough dignity to avoid any Trekkie names such as 'WarpFactor'.

- padmavyuha
Posted by: FSM

Re: Writing a mac app - where to start? - 11/16/08 06:48 PM

i bought Programming in Objective-C back on May 21 of 2004 (Amazon.com tells me this when i just checked). i thought it was a terrific book, but it wasn't out of date back then. heh. still, it really does do a good job of helping the newbie understand object-oriented programming in that every example also includes all of the code and explanations to understand it.

the next book i shifted to was even better. here's the link (highly recommended):

http://pine.fm/LearnToProgram/

(EDIT: oops, that was when i learned Ruby after my web hosting company allowed us to use Ruby on Rails -- has nothing to do with Macs)
Posted by: padmavyuha

Re: Writing a mac app - where to start? - 11/18/08 12:51 AM

I've got 'Cocoa Programming for Mac OS X' by Aaron Hillegass to delve into once I've finished the first book - this one is consistently the most voted for on the CocoaDEV website. I see that I've got two major learning slopes to climb - the language, and the IDE! But I'm sure the IDE will make a lot more sense once I get the language that it's intended to help code with.

- padmavyuha
Posted by: David Simpson

Re: Writing a mac app - where to start? - 11/18/08 06:04 PM

You might consider trying a free trial of Revolution (http://www.runrev.com). You could try either the Revolution media version or the Revolution Studio version if you actually want to compile a stand-alone app which you might make available for download or sale to others.

I use Revolution to develop each of the apps I sell on my website, and I think that it would be worth a look. Revolution is generally considered to be easier to program than either RealBasic or writing a Cocoa app in C.

If you have ever previously done HyperTalk programming, then you would feel right at home using the Revolution programming language, as the syntax is compatible. I like being able to spend more time thinking about and planning my software features, as opposed to dealing with the intricate details of the actual programming language itself.

I am not sure exactly how I would design the app you are planning, based upon the screenshot I see in your post.
But it would be rather straightforward to quickly prototype the GUI elemets and decide which features you need. It looks like the center graphic is programmatically created - and this is something you could certainly do in a number of ways in Revolution.
If the various color bands around the edges are active, then maybe these could tie to the color picker to get their value. So that when you click on the item, it pops up the color picker gets the color for you, and then you can use the selected color to set the color of the object.
Actually this is just a few of lines of code in Revolution:

on mouseup
answer color
set the backGroundColor of me to it
end mousup

So you could make rows of little buttons across the top and sides, turn off the showBorder attribute - and you would have a nice little rectangular area of color. The code I listed above would go into each field (just keep duplicating them).

Posted by: padmavyuha

Re: Writing a mac app - where to start? - 11/19/08 12:23 AM

Thanks, I'll take a look at it - though I'm interested in learning Objective-C for the same reasons I'm interested in improving my French - because it's a language used worldwide by many people, in environments I'm familiar with.

I've got something similar to what you described in mind, except that I'm going to have a setup for users to save colours to a list (something similar to Quark's); that way, you can keep a 'catalogue' of fibre colours that (near enough) match your existing stock. Then you can see what a a real combination of colours looks like - and then tell the app to swap DarkBlue-5 with BlueGreen-2 in the selected warps and see how it looks different, undo, redo etc. etc.

The centre panel will indeed be programmatically generated, that's going to be the most fun part! I'm in the middle of writing pseudo-code to scope out the logic behind which colour displays in which 'cell', and what the rules are. It's actually very simple, as each cell just has a warp/weft toggle, and a corresponding colour that it gets from the edge markers.

It gets a little more complex if I go for more fancy graphics which I'd like to add at some point, so you can choose either a simple graphic analogue (as in the image at the top of this thread) or a more sophisticated one that simulates the threads going over/under each other using a little shadow overlay; this requires each cell to know whether it's a riser or a diver or a middle, as well as warp-or-weft.

Once I've got somewhat further on with the language, I'll be picking developers' brains about how best to maintain this display area in terms of speed/memory use.

- padmavyuha
Posted by: FourthWorld

Re: Writing a mac app - where to start? - 11/22/08 01:31 PM

While you're learning Revolution, be sure to check out their forums:
http://forums.runrev.com/

Like David, I've been using Rev for many years, and have been very pleased with the uncommonly strong ROI it delivers for our clients.

But the uncommon productivity is leveraged on a fairly unique way of working, so don't be surprised if you have questions as you get into it.

The folks on those forums are very helpful so you'll be able to get any questions you have answered quickly.