Problem with simple Dice/DiceView program

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with simple Dice/DiceView program

Manas Dadarkar

Hi,
        I am facing a strange problem with a simple Dice/DiceView code. I have a simple dice and a diceview that should show the new image of the dice depending on what the new value of the dice is. For some reason, the image of the dice does not get refreshed in the system window. Can someone help me here?

Thanks,
-Manas





CS598rej-Dice.st (3K) Download Attachment
dice2.JPG (1K) Download Attachment
dice3.JPG (1K) Download Attachment
dice4.JPG (1K) Download Attachment
dice5.JPG (1K) Download Attachment
dice6.JPG (1K) Download Attachment
Dice.jpg (15K) Download Attachment
dice1.JPG (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problem with simple Dice/DiceView program

Tom Phoenix
On 7/25/06, Manas Dadarkar <[hidden email]> wrote:

> the image of the dice does not get refreshed in the system window.

You were drawing it outside of the Morph's bounds, so it didn't get
refreshed. I think you'll be happier with this code for
DiceView>>drawOn:

  drawOn: aCanvas
        | di |
        super drawOn: aCanvas.
        aCanvas drawImage: (di := dice diceImage)
               at: (bounds bottomRight - di extent).

Hope this helps!

--Tom Phoenix

Reply | Threaded
Open this post in threaded view
|

Re: Problem with simple Dice/DiceView program

Markus Gälli-3
In reply to this post by Manas Dadarkar
Hi,

I would not use forms but ImageMorphs and I would add them in the  
DiceView as morphs. (no dic needed)
Then in the update: you just could hide the last die and show the  
current.

But why fiddling around with unnecessary complexity, if you can have  
the same app with two lines of Etoys?

Ok, I guess you wanted to learn about this form of mvc.
But I think that if in doubt whether to learn a most venerable  
technology like MVC which needs a lot of code (where I would claim 3  
c.s. people give you 3 views on what MVC really means) or a newer  
one, which is smaller and does the same, I would go for Occam's Razor...

If you give me a reasonable example where you need two views on the  
same model, then we can discuss how far we can get with Etoys or  
Tweak (could use some help here too), which both more rely on the  
naked objects approach: http://www.nakedobjects.org



Cheers,

Markus

On Jul 25, 2006, at 2:09 PM, Manas Dadarkar wrote:

>
> Hi,
>         I am facing a strange problem with a simple Dice/DiceView  
> code. I have a simple dice and a diceview that should show the new  
> image of the dice depending on what the new value of the dice is.  
> For some reason, the image of the dice does not get refreshed in  
> the system window. Can someone help me here?
>
> Thanks,
> -Manas
>
>
> <CS598rej-Dice.st>
> <dice2.JPG>
> <dice3.JPG>
> <dice4.JPG>
> <dice5.JPG>
> <dice6.JPG>
> <Dice.jpg>
> <dice1.JPG>
>



ThrowDie.png (31K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problem with simple Dice/DiceView program

stéphane ducasse-2
Markus

this is cool that you show us the power of etoy all the time. But may  
be it would be difficult to write etoy in etoy...
So I'm sure that manas wants a solution that is not linked with etoy.

Stef

On 26 juil. 06, at 01:49, Markus Gaelli wrote:

> Hi,
>
> I would not use forms but ImageMorphs and I would add them in the  
> DiceView as morphs. (no dic needed)
> Then in the update: you just could hide the last die and show the  
> current.
>
> But why fiddling around with unnecessary complexity, if you can  
> have the same app with two lines of Etoys?
>
> Ok, I guess you wanted to learn about this form of mvc.
> But I think that if in doubt whether to learn a most venerable  
> technology like MVC which needs a lot of code (where I would claim  
> 3 c.s. people give you 3 views on what MVC really means) or a newer  
> one, which is smaller and does the same, I would go for Occam's  
> Razor...
>
> If you give me a reasonable example where you need two views on the  
> same model, then we can discuss how far we can get with Etoys or  
> Tweak (could use some help here too), which both more rely on the  
> naked objects approach: http://www.nakedobjects.org
>
> <ThrowDie.png>
>
> Cheers,
>
> Markus
>
> On Jul 25, 2006, at 2:09 PM, Manas Dadarkar wrote:
>
>>
>> Hi,
>>         I am facing a strange problem with a simple Dice/DiceView  
>> code. I have a simple dice and a diceview that should show the new  
>> image of the dice depending on what the new value of the dice is.  
>> For some reason, the image of the dice does not get refreshed in  
>> the system window. Can someone help me here?
>>
>> Thanks,
>> -Manas
>>
>>
>> <CS598rej-Dice.st>
>> <dice2.JPG>
>> <dice3.JPG>
>> <dice4.JPG>
>> <dice5.JPG>
>> <dice6.JPG>
>> <Dice.jpg>
>> <dice1.JPG>
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Problem with simple Dice/DiceView program

Markus Gälli-3

On Jul 26, 2006, at 11:55 AM, stéphane ducasse wrote:

> Markus
>
> this is cool that you show us the power of etoy all the time. But  
> may be it would be difficult to write etoy in etoy...
> So I'm sure that manas wants a solution that is not linked with etoy.

>
Stef,

all I want to emphasize is that "simple things should be kept simple"  
and that Smalltalk and MVC do not always provide us with the right  
perspective for doing so.

I love the uniformity of the Smalltalk approach and wonder how a  
smooth transition of a system like Etoys, where all objects are user  
interface, into a full fledged programming system could look like. Is  
it Tweak? Is it something else? I don't know.

"Form follows function --- that has been misunderstood. Form and  
function should be one, joined in a spiritual union" (Frank Lloyd  
Wright)

Cheers,

Markus

> Stef
>
> On 26 juil. 06, at 01:49, Markus Gaelli wrote:
>
>> Hi,
>>
>> I would not use forms but ImageMorphs and I would add them in the  
>> DiceView as morphs. (no dic needed)
>> Then in the update: you just could hide the last die and show the  
>> current.
>>
>> But why fiddling around with unnecessary complexity, if you can  
>> have the same app with two lines of Etoys?
>>
>> Ok, I guess you wanted to learn about this form of mvc.
>> But I think that if in doubt whether to learn a most venerable  
>> technology like MVC which needs a lot of code (where I would claim  
>> 3 c.s. people give you 3 views on what MVC really means) or a  
>> newer one, which is smaller and does the same, I would go for  
>> Occam's Razor...
>>
>> If you give me a reasonable example where you need two views on  
>> the same model, then we can discuss how far we can get with Etoys  
>> or Tweak (could use some help here too), which both more rely on  
>> the naked objects approach: http://www.nakedobjects.org
>>
>> <ThrowDie.png>
>>
>> Cheers,
>>
>> Markus
>>
>> On Jul 25, 2006, at 2:09 PM, Manas Dadarkar wrote:
>>
>>>
>>> Hi,
>>>         I am facing a strange problem with a simple Dice/DiceView  
>>> code. I have a simple dice and a diceview that should show the  
>>> new image of the dice depending on what the new value of the dice  
>>> is. For some reason, the image of the dice does not get refreshed  
>>> in the system window. Can someone help me here?
>>>
>>> Thanks,
>>> -Manas
>>>
>>>
>>> <CS598rej-Dice.st>
>>> <dice2.JPG>
>>> <dice3.JPG>
>>> <dice4.JPG>
>>> <dice5.JPG>
>>> <dice6.JPG>
>>> <Dice.jpg>
>>> <dice1.JPG>
>>>
>>
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Problem with simple Dice/DiceView program

stéphane ducasse-2
Sure I agree so say it that way.

> all I want to emphasize is that "simple things should be kept  
> simple" and that Smalltalk and MVC do not always provide us with  
> the right perspective for doing so.
>
> I love the uniformity of the Smalltalk approach and wonder how a  
> smooth transition of a system like Etoys, where all objects are  
> user interface, into a full fledged programming system could look  
> like. Is it Tweak? Is it something else? I don't know.
>
> "Form follows function --- that has been misunderstood. Form and  
> function should be one, joined in a spiritual union" (Frank Lloyd  
> Wright)

  So you could have a image viewer
that you could program in 5 lines. Etoy is still fairly complex in  
terms of interface and run-time semantics. This is not because
you get something done that this is simple. I think that simplicity  
is a vicious point. Good abstractions does not mean simplicity. Look  
at the conceptual complexity of the
Smalltalk uniform model (which I love but is difficult to follow ie  
metaclass when this is the first time).