Tutorial: Stupid Word Counter

2 views
Skip to first unread message

Leauki

unread,
Jan 19, 2008, 11:18:13 PM1/19/08
to cocoa-sharp-dev, ocoa-...@lists.ximian.com
I wrote a new simple tutorial for Cocoa#.

It focuses on creating a C# program in Visual Studio with a Cocoa#
port in mind.

http://www.netneurotic.net/DNET/StupidWordCounter/

Yes, I realise it's simple; but it does cover the fundamentals.

There is more to come.

Have fun!

Andrew.



Chuck Esterbrook

unread,
Jan 19, 2008, 11:24:25 PM1/19/08
to cocoa-s...@googlegroups.com

Nothing wrong with starting simple! Thanks for this contribution and
the bountiful screenshots.

-Chuck

Stuart Carnie

unread,
Jan 20, 2008, 1:49:52 AM1/20/08
to cocoa-sharp-dev
Good work, and thanks for the contribution.

I prefer to take a different approach, and maintain binary
compatibility between platforms for the core application logic. There
is no conditional compilation in my example, just a single piece of
configuration to indicate which 'GUI' to use. I take a model-view-
controller approach, which allows the views to be separated out as an
interface (such as IWordCounterView).

I have a working example for Cocoa, but will redo the example, using
your word counter, to demonstrate the differences in the approach and
a single set of binaries that run on Windows and OS X without
modification. I will finish it off and post an article in the next
week or so.

Cheers,

Stu

On Jan 19, 9:24 pm, "Chuck Esterbrook" <chuck.esterbr...@gmail.com>
wrote:

Leauki

unread,
Jan 20, 2008, 11:52:22 AM1/20/08
to cocoa-sharp-dev
On Jan 20, 6:49 am, Stuart Carnie <stuart.car...@gmail.com> wrote:
> Good work, and thanks for the contribution.
>
> I prefer to take a different approach, and maintain binary
> compatibility between platforms for the core application logic.

Hm... that's the approach I took. The StupidWordCounterModel class
does all the actual application logic and StupidWordCounter speaks to
the GUI.

> There
> is no conditional compilation in my example, just a single piece of
> configuration to indicate which 'GUI' to use.

How did you solve the problem of different GUIs? I have two different
implementations of the controller class, one for Winforms, one for
Cocoa.

>  I take a model-view-
> controller approach, which allows the views to be separated out as an
> interface (such as IWordCounterView).

I have a model class and a controller class.

> I have a working example for Cocoa, but will redo the example, using
> your word counter, to demonstrate the differences in the approach and
> a single set of binaries that run on Windows and OS X without
> modification.  I will finish it off and post an article in the next
> week or so.

Excellent.

But I didn't know it was possible to combine the two into one binary.
My Windows Forms binary does run on Windows and Mac OS, of course.

I suppose checking for the underlying OS is possible, but how do you
do a "using Cocoa;" without making the compiler complain?

Reply all
Reply to author
Forward
0 new messages