Re: feedback on CLFramework

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

Re: feedback on CLFramework

Stéphane Ducasse

Hi nullPointer

here are some feedback on your work that is really important for us.


Use Smalltalk way of formatting code.
==========================

        btn -> button please use normal smalltalk conventions.

        inClassSideBoolean
                ifTrue: [ aClass class compile: aStringCodeSource classified:  
(aSymbolCategoryName asString) notifying: nil. ]
                 ifFalse: [ aClass compile: aStringCodeSource classified:  
(aSymbolCategoryName asString) notifying: nil. ].
or
        inClassSideBoolean
                ifTrue: [ aClass class
                                compile: aStringCodeSource
                                classified: (aSymbolCategoryName asString)
                                notifying: nil. ]
                ifFalse: [ aClass compile: aStringCodeSource
                                classified: (aSymbolCategoryName asString)
                                notifying: nil. ].

        getFiles: aStringPathOfDirectory

        | aFileDirectory fullPathOfFile  aCollection |
       
        aFileDirectory := CLFileDirectory on: aStringPathOfDirectory.
        aCollection := Bag new.

        aFileDirectory fileNames do:
        [
                :nameOfFile |
               
                fullPathOfFile := aFileDirectory fullPathFor: nameOfFile.
               
                aCollection add: fullPathOfFile.
        ].

        ^aCollection.

Don't use space everywhere
is not smalltalk

getFiles: aStringPathOfDirectory

        | aFileDirectory fullPathOfFile  aCollection |
        aFileDirectory := CLFileDirectory on: aStringPathOfDirectory.
        aCollection := Bag new.
        aFileDirectory fileNames do:
                [:nameOfFile |
                fullPathOfFile := aFileDirectory fullPathFor: nameOfFile.
                aCollection add: fullPathOfFile].
        ^aCollection.

If you give me access I can reformat everything.


Add some comments
==========================
In the examples category there is no class comments so I have no idea  
about what I'm reading.


There is not one single class comment: please add some of them.
So far I could not find how to use it



Do not refer to your class inside itself
==========================
CLCompiler>>createMessageInClass: aClass withCodeSource:  
aStringCodeSource inProtocol: aSymbolCategoryName

        CLCompiler createMessageInClass: aClass withCodeSource:  
aStringCodeSource  inProtocol: aSymbolCategoryName inClassSide: false.
               
->

CLCompiler>>createMessageInClass: aClass withCodeSource:  
aStringCodeSource inProtocol: aSymbolCategoryName

        self createMessageInClass: aClass withCodeSource: aStringCodeSource  
inProtocol: aSymbolCategoryName inClassSide: false.



Nice to see that you use traits :)
=========================

Keep working.
I still believe that a windowSpec based on a literal array is better  
than a byte array.

Stef





_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: feedback on CLFramework

gerard alis
Stéphane Ducasse-2 wrote
Use Smalltalk way of formatting code.

getFiles: aStringPathOfDirectory

        | aFileDirectory fullPathOfFile  aCollection |
        aFileDirectory := CLFileDirectory on: aStringPathOfDirectory.
        aCollection := Bag new.
        aFileDirectory fileNames do:
                [:nameOfFile |
                fullPathOfFile := aFileDirectory fullPathFor: nameOfFile.
                aCollection add: fullPathOfFile].
        ^aCollection.

If you give me access I can reformat everything.
Sorry, but i don´t like that format of code. For me is not readable. I don´t know when starts a block or if is a loop or condition block.That problem is more big when exists various identations. I´m coming of VB and C# and that way seems anarchist for me :)  my cerebellum is limited for that way of write code.

Why my format not is "Smalltalkish" way? Perhaps I´m wrong (i have short time with that language) but I believe indeed than Smalltalk don´t have a style defined (Thanks to God)


Stéphane Ducasse-2 wrote
Add some comments.

In the examples category there is no class comments so I have no idea  
about what I'm reading.
Yes. I´m not add comments basically for my poor english.
Today i could try it. Is a relax work for sunday :)


Stéphane Ducasse-2 wrote
Nice to see that you use traits :)
I´m miss it in another languages :)


Stéphane Ducasse-2 wrote
Keep working.
I still believe that a windowSpec based on a literal array is better  
than a byte array.
Of course, but I don´t know do it of another way. Literal array is very complicated for me.
Xml serialization and Moose serialization don´t be possible. The code generated is HUGE, and fails
with complex composite morphs. The one way for me is a mechanism where each morph write his state in a stream. All states togethers will build the final morph. I believe that mechanism works, is elegant and readable. And is easy detect problems too, but i need a little more of time for do it. I want implement various widgets ( a grid is MUCH needed ) and last, before of 1.0 version, the serialization mechanism.

Thanks for the feedback :)

PS. I added recently the CLSplitterPanel widget -> http://www.youtube.com/watch?v=qbd9bbfxNB4


Regards



Reply | Threaded
Open this post in threaded view
|

Re: feedback on CLFramework

Stéphane Ducasse
>>
> Sorry, but i don´t like that format of code. For me is not readable.  
> I don´t
> know when starts a block or if is a loop or condition block.That  
> problem is
> more big when exists various identations. I´m coming of VB and C#  
> and that
> way seems anarchist for me :)  my cerebellum is limited for that way  
> of
> write code.

smalltalk allows you to write nice and compact code so take it as a  
opportunity.
In python you would be forced to use tab at the right place.


        [:each | .... ]


        [:each|
                        ...
                               
                        ]


> Why my format not is "Smalltalkish" way?

read all the code in the image and you will see nowhere

        do:
        [
        :ecah |
       



        ]

or

        (expression) ifTrue:
       
        [



        ]
                ifFalse:

        [



        ]


       


> Perhaps I´m wrong (i have short
> time with that language) but I believe indeed than Smalltalk don´t  
> have a
> style defined (Thanks to God)

Read Kent beck book (best Smalltalk pattern)
have a look at Smalltalk with Style on my web page.

I can tell you I cannot read your code well.
So if you want to really have fun with Smalltalk, change.

>>
> Yes. I´m not add comments basically for my poor english.
> Today i could try it. Is a relax work for sunday :)

just write
subject verb complement
and code.

I'm responsible for XXXX
I collaborate with YY and ZZ

Here are three important methods:
        -
        -
        -

Here is a way to invoke me.
       

>> Keep working.
>> I still believe that a windowSpec based on a literal array is better
>> than a byte array.
>>
>>
>
> Of course, but I don´t know do it of another way. Literal array is  
> very
> complicated for me.
> Xml serialization and Moose serialization don´t be possible. The code
> generated is HUGE, and fails
> with complex composite morphs.

if you store them as literal arrays probably but inside a string I do  
not see why.

> The one way for me is a mechanism where each
> morph write his state in a stream. All states togethers will build  
> the final
> morph. I believe that mechanism works, is elegant and readable. And  
> is easy
> detect problems too, but i need a little more of time for do it. I  
> want
> implement various widgets ( a grid is MUCH needed ) and last, before  
> of 1.0
> version, the serialization mechanism.
>
> Thanks for the feedback :)
>
> PS. I added recently the CLSplitterPanel widget ->
> http://www.youtube.com/watch?v=qbd9bbfxNB4

So far I could not build an interface with two buttons.

>
>
> Regards
>
>
>
>
> --
> View this message in context: http://n2.nabble.com/Re-feedback-on-CLFramework-tp3718474p3718991.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: feedback on CLFramework

Stéphane Ducasse
I watch the video and this is cool

>> PS. I added recently the CLSplitterPanel widget ->
>> http://www.youtube.com/watch?v=qbd9bbfxNB4

In VisualWorks you use the builder and it generates a class for you
a bit in the same way then you code the missing code.

You said:

> Of course, but I don´t know do it of another way. Literal array is
> very
> complicated for me.
> Xml serialization and Moose serialization don´t be possible. The code
> generated is HUGE

and in VW all the interface is generated using the UIBuilder.
so I'm wondering why this is working

for example I could paste the following without any problem in a  
methods.
Then we could easily code a simple interpreter that perform: the  
message on an instance

for example
        #(#{UI.ActionButtonSpec}
                                        #layout: #(#{Graphics.LayoutFrame} 115 0.35 30 0 180 0.35 53 0 )
                                        #name: #removeButton
                                        #model: #removePattern
                                        #label: #(#{Kernel.UserMessage} #key: #Remove #defaultString:  
'Remove' #catalogID: #pdp)
                                        #defaultable: true )

        f := LayoutFrame new with: #(115 0.35 30 0 180 0.35 53 0)
               
        =>
        ActionButton new
                layout: f;
                name: #removeButton
               
I do not know exactly the VW framework details but we can cerytainly  
interpret the following literal array.


windowSpec
        "UIPainter new openOnClass: self andSelector: #windowSpec"

        <resource: #canvas>
        ^#(#{UI.FullSpec}
                #window:
                #(#{UI.WindowSpec}
                        #label: #(#{Kernel.UserMessage} #key: #ContextListPolicyEditor  
#defaultString: 'Context list policy editor' #catalogID: #pdp)
                        #min: #(#{Core.Point} 528 401 )
                        #max: #(#{Core.Point} 1024 768 )
                        #bounds: #(#{Graphics.Rectangle} 592 427 1120 828 )
                        #flags: 4
                        #menu: #menuBar )
                #component:
                #(#{UI.SpecCollection}
                        #collection: #(
                                #(#{UI.LabelSpec}
                                        #layout: #(#{UI.AlignmentOrigin} 0 0.175 5 0 0.5 0 )
                                        #name: #PatternListLabel
                                        #label: #(#{Kernel.UserMessage} #key: #Patterns #defaultString:  
'Patterns' #catalogID: #pdp) )
                                #(#{UI.SequenceViewSpec}
                                        #properties:
                                        #(#{UI.PropertyListDictionary} #dragOkSelector
                                                #wantToDrag: #dragEnterSelector
                                                #dragEnter: #dragOverSelector
                                                #dragOver: #dragStartSelector
                                                #doDrag: #dropSelector
                                                #drop: #dragExitSelector
                                                #dragLeave: )
                                        #layout: #(#{Graphics.LayoutFrame} 2 0 30 0 0 0.35 -60 1 )
                                        #name: #patternList
                                        #model: #patternList
                                        #menu: #menu
                                        #useModifierKeys: true
                                        #selectionType: #highlight )
                                #(#{UI.ActionButtonSpec}
                                        #layout: #(#{Graphics.LayoutFrame} 25 0.35 30 0 90 0.35 53 0 )
                                        #name: #newButton
                                        #model: #newPattern
                                        #label: #(#{Kernel.UserMessage} #key: #New #defaultString: 'New'  
#catalogID: #pdp)
                                        #defaultable: true )
                                #(#{UI.ActionButtonSpec}
                                        #layout: #(#{Graphics.LayoutFrame} 115 0.35 30 0 180 0.35 53 0 )
                                        #name: #removeButton
                                        #model: #removePattern
                                        #label: #(#{Kernel.UserMessage} #key: #Remove #defaultString:  
'Remove' #catalogID: #pdp)
                                        #defaultable: true )
                                #(#{UI.InputFieldSpec}
                                        #layout: #(#{Graphics.LayoutFrame} 13 0.35 105 0 -9 0.75 128 0 )
                                        #name: #patternNameInput
                                        #model: #patternName )
                                #(#{UI.ActionButtonSpec}
                                        #layout: #(#{Graphics.LayoutFrame} 8 0.75 105 0 87 0.75 128 0 )
                                        #name: #colorButton
                                        #model: #selectColor
                                        #label: #(#{Kernel.UserMessage} #key: #PickColor #defaultString:  
'Pick Color' #catalogID: #pdp)
                                        #defaultable: true )
                                #(#{UI.TextEditorSpec}
                                        #layout: #(#{Graphics.LayoutFrame} 13 0.35 160 0 -8 1 -155 1 )
                                        #name: #TextEditor1
                                        #model: #patternString
                                        #tabRequiresControl: true )
                                #(#{UI.LabelSpec}
                                        #layout: #(#{Graphics.LayoutOrigin} 13 0.35 85 0 )
                                        #name: #Label1
                                        #label: #(#{Kernel.UserMessage} #key: #Name #defaultString:  
'Name' #catalogID: #pdp) )
                                #(#{UI.LabelSpec}
                                        #layout: #(#{UI.AlignmentOrigin} 0 0.675 137 0 0.5 0 )
                                        #name: #Label3
                                        #label: #(#{Kernel.UserMessage} #key: #PatternString  
#defaultString: 'Pattern String' #catalogID: #pdp) )
                                #(#{UI.GroupBoxSpec}
                                        #layout: #(#{Graphics.LayoutFrame} 6 0.35 65 0 -2 1 -145 1 )
                                        #name: #GroupBox1
                                        #label: #(#{Kernel.UserMessage} #key: #Pattern #defaultString:  
'Pattern' #catalogID: #pdp) )
                                #(#{UI.InputFieldSpec}
                                        #layout: #(#{Graphics.LayoutFrame} 12 0.35 -118 1 0 0.679924 -92  
1 )
                                        #name: #matchSelectorInputField
                                        #model: #matchSelector
                                        #type: #symbol )
                                #(#{UI.InputFieldSpec}
                                        #layout: #(#{Graphics.LayoutFrame} 6 0.68 -118 1 -8 1 -92 1 )
                                        #name: #conversionSelectorInputField
                                        #model: #conversionSelector
                                        #type: #symbol )
                                #(#{UI.LabelSpec}
                                        #layout: #(#{Graphics.LayoutOrigin} 12 0.35 -137 1 )
                                        #name: #Label4
                                        #label: #(#{Kernel.UserMessage} #key: #MatchSelector  
#defaultString: 'Match Selector' #catalogID: #pdp) )
                                #(#{UI.LabelSpec}
                                        #layout: #(#{Graphics.LayoutOrigin} 6 0.68 -137 1 )
                                        #name: #Label5
                                        #label: #(#{Kernel.UserMessage} #key: #ConversionSelector  
#defaultString: 'Conversion Selector' #catalogID: #pdp) )
                                #(#{UI.ActionButtonSpec}
                                        #layout: #(#{Graphics.LayoutSizedOrigin} -100 0.5 -33 1 80 23 )
                                        #name: #okButton
                                        #model: #accept
                                        #label: #(#{Kernel.UserMessage} #key: #Ok #defaultString: 'Ok'  
#catalogID: #pdp)
                                        #defaultable: true )
                                #(#{UI.ActionButtonSpec}
                                        #layout: #(#{Graphics.LayoutSizedOrigin} 20 0.5 -33 1 81 23 )
                                        #name: #cancelButton
                                        #model: #cancel
                                        #label: #(#{Kernel.UserMessage} #key: #Cancel #defaultString:  
'Cancel' #catalogID: #pdp)
                                        #defaultable: true )
                                #(#{UI.LabelSpec}
                                        #layout: #(#{Graphics.LayoutOrigin} 12 0.35 -82 1 )
                                        #name: #Label2
                                        #label: #(#{Kernel.UserMessage} #key: #DisplayAllLimit  
#defaultString: 'Display all limit' #catalogID: #pdp) )
                                #(#{UI.SpinButtonSpec}
                                        #layout: #(#{Graphics.LayoutFrame} 90 0.35 -83 1 150 0.35 -60 1 )
                                        #name: #displayAllLimitField
                                        #model: #displayAllLimit
                                        #type: #number
                                        #formatString: '0'
                                        #low: 1
                                        #high: 100
                                        #interval: 1 )
                                #(#{UI.ActionButtonSpec}
                                        #layout: #(#{UI.AlignmentOrigin} -10 1 -10 1 1 1 )
                                        #name: #HelpButton
                                        #model: #help
                                        #label: #(#{Kernel.UserMessage} #key: #Help #defaultString:  
'Help' #catalogID: #pdp)
                                        #defaultable: true )
                                #(#{UI.DividerSpec}
                                        #layout: #(#{Graphics.LayoutFrame} 0 0 -48 1 0 1 -44 1 )
                                        #name: #Divider1 ) ) ) )



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: feedback on CLFramework

gerard alis
In reply to this post by Stéphane Ducasse
Stéphane Ducasse-2 wrote
I can tell you I cannot read your code well.
So if you want to really have fun with Smalltalk, change.
But I´m cannot read then with that format. I have fun with Smalltalk, but for fun i need
don´t write the code of apocalyptic way :))
Exists the possibility of give format in browser, selecting the option "Pretty print", in the right.
The format of that option seems the same than you want, and don´t change the original code.
Despite I will try to read the book of Kent Beck.


Stéphane Ducasse-2 wrote
if you store them as literal arrays probably but inside a string I do  
not see why.
But how i can store the state of a object in a Array? exists some mechanism already do it for that or is needed implement it? Seems difficult.


Stéphane Ducasse-2 wrote
So far I could not build an interface with two buttons.
Well, the application is in alpha state... and not usable for serious purposes. I did warn of that :((


Regards

Reply | Threaded
Open this post in threaded view
|

Re: feedback on CLFramework

Stéphane Ducasse

On Sep 27, 2009, at 11:09 AM, nullPointer wrote:

>
>
> Stéphane Ducasse-2 wrote:
>>
>> I can tell you I cannot read your code well.
>> So if you want to really have fun with Smalltalk, change.
>>
>
> But I´m cannot read then with that format. I have fun with  
> Smalltalk, but
> for fun i need
> don´t write the code of apocalyptic way :))
> Exists the possibility of give format in browser, selecting the option
> "Pretty print", in the right.
> The format of that option seems the same than you want, and don´t  
> change the
> original code.
> Despite I will try to read the book of Kent Beck.

In the long term it will not work. I can tell you.
If everybody reading your code always feels like me it will not work.

>> if you store them as literal arrays probably but inside a string I do
>> not see why.
>>
>
> But how i can store the state of a object in a Array? exists some  
> mechanism
> already do it for that or is needed implement it? Seems difficult.

for User Interface object you only need to store icons and image all  
the rest is
what: classname, number, string, boolean and symbols...so we already  
now how to store them.
in literal arrays. Do you need more?

The advantage of a array like spec is that it is independent of your  
implementation objects
so they will not break each time you change an instance variable. VW  
used that since 1996
or even before. They could also produce a web based interface and we  
could do the same by pluging
a seaside aware interpreter.


> Well, the application is in alpha state... and not usable for serious
> purposes. I did warn of that :((

This is not a problem. I just wanted to tell you.
But this is good that you publish it anyway.



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: feedback on CLFramework

gerard alis
In reply to this post by Stéphane Ducasse

Stéphane Ducasse-2 wrote
In VisualWorks you use the builder and it generates a class for you
a bit in the same way then you code the missing code.

You said:

> Of course, but I don´t know do it of another way. Literal array is
> very
> complicated for me.
> Xml serialization and Moose serialization don´t be possible. The code
> generated is HUGE

and in VW all the interface is generated using the UIBuilder.
so I'm wondering why this is working
I´m not sure of understand good that...
The only class than works in UIBuilder for create the UI (#specMorph) is CLViewDesigner class.
That class create the #specMorph and #specEvents  methods, in a child of CLView class. All examples in CLFramework be CLView kinds. In the #specEvents is returned a Dictionary where exists a relation between morph, type of event and handler of that event. All that is more more readable than VW mechanism, where not is easy understand it.


Stéphane Ducasse-2 wrote
I do not know exactly the VW framework details but we can cerytainly  
interpret the following literal array.

[.....]
I understand is possible create a interpreter for that code, with #perform: message. But the difficult seems GeneratE that code, not reader.

Not is equal a result like that...?

|CanvasMorph btnAction1 ...... |

"CanvasMorph"
CanvasMorph := Morph new.
CanvasMorph color: Color red;
                    borderWidth: 5;
                    etc....

"btnAction1"
btnAction1 := CLButton new.
btnAction1 text: 'Accept';
                position: 10@10;
                roundedCorners: true.

[...............]

CanvasMorph addAllMorphs: #( btnAction1 btnAction2  [etc....] )



Is a dummy example, but the result code is more cleaned, and readable.
And seems equal of hard.Another environments ( equal or much more competents than VW )
using that mechanism.

My knowledge of Smalltalk and programming in general is very limited and poor. I want listen another ways of do.I want learn. But i have understand it before :D


Regards












Reply | Threaded
Open this post in threaded view
|

Re: feedback on CLFramework

Stéphane Ducasse

On Sep 27, 2009, at 11:43 AM, nullPointer wrote:

>
>
>
> Stéphane Ducasse-2 wrote:
>>
>> In VisualWorks you use the builder and it generates a class for you
>> a bit in the same way then you code the missing code.
>>
>> You said:
>>
>>> Of course, but I don´t know do it of another way. Literal array is
>>> very
>>> complicated for me.
>>> Xml serialization and Moose serialization don´t be possible. The  
>>> code
>>> generated is HUGE
>>
>> and in VW all the interface is generated using the UIBuilder.
>> so I'm wondering why this is working

I mean not working for you.

>>
>
> I´m not sure of understand good that...
> The only class than works in UIBuilder for create the UI  
> (#specMorph) is
> CLViewDesigner class.
> That class create the #specMorph and #specEvents  methods, in a  
> child of
> CLView class. All examples in CLFramework be CLView kinds. In the
> #specEvents is returned a Dictionary where exists a relation between  
> morph,
> type of event and handler of that event. All that is more more  
> readable than
> VW mechanism, where not is easy understand it.
>
>
>
> Stéphane Ducasse-2 wrote:
>>
>> I do not know exactly the VW framework details but we can cerytainly
>> interpret the following literal array.
>>
>> [.....]
>>
>
> I understand is possible create a interpreter for that code, with  
> #perform:
> message. But the difficult seems GeneratE that code, not reader.

Ah
You walk throw your structure and the visitor generate the associate  
information.
May be you can tag the method to indicate if they should be saved.



>
> Not is equal a result like that...?
>
> |CanvasMorph btnAction1 ...... |
>
> "CanvasMorph"
> CanvasMorph := Morph new.
> CanvasMorph color: Color red;
>                    borderWidth: 5;
>                    etc....
>
> "btnAction1"
> btnAction1 := CLButton new.
> btnAction1 text: 'Accept';
>                position: 10@10;
>                roundedCorners: true.
>
> [...............]
>
> CanvasMorph addAllMorphs: #( btnAction1 btnAction2  [etc....] )


I do not know.
Because with the literal array approach we can interpret it after the  
way we want.


> Is a dummy example, but the result code is more cleaned, and readable.
> And seems equal of hard.Another environments ( equal or much more  
> competents
> than VW ) using that mechanism.

No this is not equivalent because with an array you could build a  
renderer for another toolkit, web, ....

> My knowledge of Smalltalk and programming in general is very limited  
> and
> poor. I want listen another ways of do.I want learn. But i have  
> understand
> it before :D

Cool




_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project