Re: [Pharo-users] how to model this a better way

2019-04-29 Thread Richard O'Keefe
For what it is worth, I have now completed two thirds of the Exercism tasks
for Pharo.
That's about 24 of them, maybe 1 or 2 more.
ONE of them warranted the creation of another class (the Tournament
exercise deserves
a Team class).
MOST of them were no-data classes with just one method.
A couple of them required multiple methods, which in turn required state in
the
class, but not many.
In each exercise the framework forces you to have at least two classes:
Solution  -- defined by you
SolutionTests -- provided
and you have to glean the interface from the SolutionTests class.
Your suggestion for a Direction class is perfectly reasonable, and would be
the right thing to do if Point did not exist or if you made a conscious
decision
to avoid it for practice reasons.

I suppose the idea is that you push the testing button beside the
SolutionTests
class, and when an undefined class or undefined message is encountered, use
the
debugger to begin creating it.  I found it helpful NOT to do that, but to
survey
*all* the tests first to find out what methods were required and from that
to
work out what state had to be maintained.

On Thu, 25 Apr 2019 at 17:22, Roelof Wobben  wrote:

> Hello Ricard O'  Keefe
>
> For my exercism is a way of practising smalltalk and get familair with the
> concepts.
> So sometimes for me totally new concepts like Double Dispatch.  so in your
> questions some of the thirth and fourth question. And I try to solve the
> challenges like there are real world problems.
>
> Because Tim like to push me further then sometimes the challenges needed
> so I learn new concepts or practice things I already learned.
>
> I agree totally with you that I always look if existing classes can do the
> job before I write my own objects.
>
> The problem that I faced is that I not always see which objects I need and
> what the responsibility is.
>
> Right now my thoughts are this :
>
> RobotTests  they contain all the tests.
> Robot . Responsibility for keeping track of what the position is and which
> direction it faces.
> Direction. Responsibility for calculating a new position or a new
> direction the robot faces.
>
> Thanks for you suggestion to solve it first in a language that im familiar
> with but I not so familiair with a langugae I can solve "all"  the
> problems.  Because smalltalk is OO  I sometimes look at ruby code to see
> how they solve things.
>
> Roelof
>
>
>
>
>
> Op 25-4-2019 om 06:23 schreef Richard O'Keefe:
>
> PS: in this thread nobody has disagreed about what OO programming is.
> The disagreement was about *how to apply it*.
> There actually seems to be quite a lot of agreement that the
> answer depends on what your underlying goal is:
>  - is this throw-away code for a specific problem?
>  - is this code to be included in a useful program?
>  - is this just for practice in an unfamiliar language
>where you already understand all the concepts?
>  - is this for learning about radically new concepts?
> And everyone agrees that test cases are good for all of these.
>
> You might find it useful to join another exercism thread and
> solve some of these problems in a language that you are
> comfortable with, then solve them in Smalltalk (or Ruby).
> This will help to separate "how do I solve this problem?"
> from "how do I express this solution in language X?"
> Another thing you might find useful, having solved a
> problem, is to try to solve it a different way.
>
> For example, in a functional language, you might solve a
> problem first in a C-like way using mutable objects freely.
> Then you might solve it again using immutable values.
> And then you might solve it again using higher-order functions.
> And then you might solve it again using point-free style as
> much as you can.
>
> For another example, in R, or Fortran 90, or Matlab, you
> might solve a problem first in an element-at-a-time way,
> and then you might try it again using vectorisation to
> eliminate as many loops as you can.
>
> And in *this* example, don't suppose that there is One Right
> Way To Do It.  Get ONE solution going.  ANY solution.  I would
> suggest my approach, because (a) of course I would, and (b) it
> really is a struggle with exercism to find out what the problem
> actually is, and you want to get to SOME solution quickly.  But
> it doesn't matter so much, because the point is to try it MORE
> ways than one.  This is one way to learn design.  Try more than
> one approach and discover which ones work out better.
>
> I started out using Point.  Then I tried again just using bare
> coordinates.  I started with position and velocity as instance
> variables.  Then I tried again with them as method temporaries.
> I eliminated one thing after another until I was left with
> obviously correct code, and I felt no shame in using
> #caseOf: to classify characters, even though there are books
> that will tell you that using "if" and "case" is anti-OO.
> I could do it again eliminating #caseOf: in terms of "if" if
> 

[Pharo-users] Why doesn't the VM command line help show the useful image commands anymore?

2019-04-29 Thread Tim Mackinnon
I was asked a question about starting pharo exercism from the command line on 
Arch linux - seems the Pharo.image file isn’t being found (but it was installed 
with AUR, which I am unfamiliar with).

Anyway - I tried using the command line on OSX ( I noticed they had used pharo, 
and not pharo-ui — which I never understood: why is it not pharo for ui and 
pharo-cmd for terminal, as it burns most people?) - and typed “pharo —help”, 
and you get an impressive long list of commands - however it doesn’t show you 
the useful Image commands anymore? So you would never know to use “pharo 
Pharo.image —list”.

 A while back it showed you that - but its now gone which seems a shame?

I also notice at the bottom of the list, its says the the image name defaults 
to Pharo.image - however I haven’t noticed that works at all - you have to 
specify an image, so thats a bit misleading.

Tim




Re: [Pharo-users] Pharo 6.0 and 6.1 64 bit freeze on MacMini -also in 7.03

2019-04-29 Thread TedVanGaalen
Crying victory too soon: 
Alas, it happened again pharo screen frozen, 
partly drawn, when going to full screen
( see image.)
frustrating.
The strange thing however:
 the Seaside/Zinc server
 kept running that is: I could enter  and save data in
 in my test app running in the web browser!
No idea why.
TedvG  






--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] Getting example images - https://picsum.photos

2019-04-29 Thread Paul DeBruicker
I forgot the "ext" query parameter which gives the image urls

so 




ZnClient new
  systemPolicy;
  forJsonREST;
  url: 'https://uinames.com/api';
  queryAt: #region put: #germany;
  queryAt: #gender put: #female;
  queryAt:#ext put: nil;
  get.






--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] Getting example images - https://picsum.photos

2019-04-29 Thread Sven Van Caekenberghe
Ah, also quite interesting.

With the latest Zn loaded:

Metacello new
  repository: 'github://svenvc/zinc/repository';
  baseline: 'ZincHTTPComponents';
  load.

You can do:

ZnClient new
  systemPolicy;
  forJsonREST;
  url: 'https://uinames.com/api';
  queryAt: #region put: #germany;
  queryAt: #gender put: #female;
  get.

>>> a Dictionary('gender'->'female' 'name'->'Fabienne' 'region'->'Germany' 
>>> 'surname'->'Schuster' )

> On 29 Apr 2019, at 20:03, Paul DeBruicker  wrote:
> 
> https://uinames.com/ 
> 
> 
> The api is a GET e.g.
> 
> https://uinames.com/api?region=germany=female
> 
> 
> & returns JSON with image url and plausible name among other things.
> 
> 
> 
> 
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
> 




Re: [Pharo-users] Getting example images - https://picsum.photos

2019-04-29 Thread Paul DeBruicker
https://uinames.com/ 


The api is a GET e.g.

https://uinames.com/api?region=germany=female


& returns JSON with image url and plausible name among other things.




--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] Getting example images - https://picsum.photos

2019-04-29 Thread Sven Van Caekenberghe
Perfect, I should have looked at the list of available images ... great catch.

> On 29 Apr 2019, at 18:42, Offray Vladimir Luna Cárdenas 
>  wrote:
> 
> Pretty cool!
> 
> This is how you get a Pharo image working, with pun intended ;-):
> 
> http://ws.stfx.eu/7WN9SG9YBB6E
> 
> 
> 
> Cheers,
> 
> Offray
> 
> On 29/04/19 6:23 a. m., Sven Van Caekenberghe wrote:
>> Hi,
>> 
>> This is a cool service: 
>> https://picsum.photos
>>  - it gives you example images (pictures/photos).
>> 
>> Here is how you can use this from a standard Pharo image (no pun intended).
>> 
>> ZnEasy getJpeg: '
>> https://picsum.photos/512
>> '.
>> 
>> ImageReadWriter formFromStream: (ZnClient new
>>   systemPolicy;
>>   url: '
>> https://picsum.photos/640/480?grayscale
>> ';
>>   accept: ZnMimeType imagePng;
>>   get) readStream.
>> 
>> Sven
>> 
>> 
>> 
>> 




Re: [Pharo-users] Pharo 6.0 and 6.1 64 bit freeze on MacMini -also in 7.03

2019-04-29 Thread TedVanGaalen
FYI  FWIWfurther testing: 
Running 7.03 with the 20181039  VM
-loaded Seaside 3.3 from Git
-filed in my test web app + utils
everything working OK without any changes!
Thanks 
TedvG



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] how to model this a better way

2019-04-29 Thread Offray Vladimir Luna Cárdenas

Roelof,

I second Richard on that. Maybe Exercism is important, but I don't know 
if is important enough to consider quitting Smalltalk because of the 
experience solving a problem there.


Maybe sharing some of our personal experiences learning Smalltalk, the 
struggles and joys on that could put Exercism in perspective.


In my case I started with Smalltalk via Etoys and Squeak in 2006 and 
2007, but I left it as I can not "get it" all, despite of seeing the 
potence behind ideas like Dynabook and having rewarding experience in 
educational context with freshmen students. We used Etoys, Bots Inc and 
Scratch. The last was easier to get, but the others offered a better 
continuum to go from tile based programming to coding, so we combined 
all of them. But when I try to build more... "practical" things like OS 
scripting or data stories/visuals I struggle a lot with the Smalltalk 
environment, the paradigm switch and its purity, the absence of modern 
books and local communities and the kind of childish UI. It was like if 
I was growing in my needs, but the Squeak environment was so tailor 
suited for education with children that can not grow with me in more 
professional day to day tasks.


Seven years later I found Pharo, so Smalltalk and I were changed enough 
for this meeting again experience. I have struggles again, particularly 
getting support with some issues related the GT, but the community was 
welcoming (as always), the books where more mature, the mailing list 
more active, and the level of fluency I get this time to express my old 
and new ideas in code was nothing I have experienced before in any 
computer language/environment. I chose a "real" world project as my 
learning experience this time (called Grafoscopio[1]) and despite it has 
a lot to improve and there is still newbie code here and there, any time 
I have the chance to working in it again, I'm really grateful of 
sticking around and keeping with the Smalltalk communities and the 
technology.


[1] https://mutabit.com/grafoscopio/index.en.html

So, my advice is don't let the Exercism experience let you down on 
Smalltalk. You could try with other approaches to learn, you could try 
with different books, or given yourself some distance, rest a little bit 
and be back here again. I know nothing about double dispatch, I'm 
learning design patters, I do not do TDD as common wise advices. I'm 
learning this by myself, following my own exploration and learning needs 
as they arrive, with the help of this community. And I know I'm getting 
better when I compare with myself years ago. So I expect to be here for 
the years to come and get even better and to showcase that in the code I 
write and share with this community. Would be nice to have around too.


Cheers,

Offray


On 24/04/19 6:19 p. m., Richard O'Keefe wrote:

Please don't quit Smalltalk.
I never said not to use classes.
That would be insane.
I said that *this specific exercise* is one
where *extra classes do not pay off.
This is in no way whatsoever a debate about
Pharo or Smalltalk.
We'd be having exactly the same discussion
in a list devoted to Java, Python, Ruby, or
any other OO programming language.
Please read
http://www.cs.otago.ac.nz/cosc345/bickerton.htm
It's a short page about learning.

If you want to learn about OOP, the problem is not
Pharo or Smalltalk or even me.  It's that exercism
is not designed to do that.  It's designed to give
people who already know what they are doing in one
or more other languages practice in a new one.

Do a web search for something like "How to learn OO design".
You will find little things like


qwertyuiop924  on 
Sept 14, 2016  [-]


Here's the OOP model:

A program can be modelled as a set of communicating black-box objects, 
with their own state.


The idea is to separate concerns, abstracting away implementation 
behind well-defined interfaces, which can in turn be implemented by 
other objects to cleanly replace parts of the application.


The rest of OO is pretty much just understanding Design Patterns (a 
set of names for common interactions between objects, and methods for 
setting these interactions up), grokking inheritance, and the 
difference between inheritance and composition, and grasping how to 
design a good OO system (how thickly to layer your classes, how much 
abstraction and what sorts, etc.)


The best languages for learning OO are Ruby and Smalltalk.



in https://news.ycombinator.com/item?id=12495117

You will find articles like

https://medium.com/@richardeng/the-consequences-of-learning-oop-the-wrong-way-3659bdf0b996

You will find courses.

And look at the Pharo web site again: Stephan Ducasse has put up free 
copies of several books about Smalltalk.  I think he now has every one 
I've heard of.  Here's one link to get to them:


http://stephane.ducasse.free.fr/FreeBooks.html




Smalltalk and Object 

Re: [Pharo-users] Pharo 6.0 and 6.1 64 bit freeze on MacMini -also in 7.03

2019-04-29 Thread TedVanGaalen
Forgot to mention : Tests were run with newest 7.03 image, also downloaded
today.



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] Pharo 6.0 and 6.1 64 bit freeze on MacMini -also in 7.03

2019-04-29 Thread TedVanGaalen
Hi Stephan

Yes, tested this briefly: I confirm that
  20181039 works, 201810230536 is broken 

The broken version freezes as soon as selecting full screen from the menu
it freezes also when resizing or moving the window. (after force quitting it
and restarting. 

The 20181039 on first sight seems to be OK, 
If it keeps working ok, I will use this VM from now on 
until Pharo is downloadable with the official correct VM
btw: 
PLEASE RETURN THE ONE CLICK IMAGE
I don't prefer the Pharo Launcher, rather have a one-click image:
no fuzz with an extra app, it works right out of the box
and I can have my own directory structure.
(that means here: having Pharo app, .image.1..x,  changes, Pharo source
and other relevant resource files in one project dedicated folder. )
So that everything I need for a project -including Pharo itself
is there, all I have to do is go to that folder.
call it what you will but I prefer this way of working,
don't care much if it uses a few 100 megabytes more.
"I Did It My Way" Frank Sinatra (I can't sing that good :o|   ) 
Regards
TedvG



--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



Re: [Pharo-users] Getting example images - https://picsum.photos

2019-04-29 Thread Esteban Maringolo
I remember Paul de Bruicker (cc'ed) used a similar service to get user
profiles (with first and last name and pictures, so you can "simulate"
users in your app, and you could ask for male or female profiles).

I don't remember the name, hopefully he will :)

Esteban A. Maringolo

On Mon, Apr 29, 2019 at 8:24 AM Sven Van Caekenberghe  wrote:
>
> Hi,
>
> This is a cool service: https://picsum.photos - it gives you example images 
> (pictures/photos).
>
> Here is how you can use this from a standard Pharo image (no pun intended).
>
> ZnEasy getJpeg: 'https://picsum.photos/512'.
>
> ImageReadWriter formFromStream: (ZnClient new
>   systemPolicy;
>   url: 'https://picsum.photos/640/480?grayscale';
>   accept: ZnMimeType imagePng;
>   get) readStream.
>
> Sven
>
>



Re: [Pharo-users] Pharo 6.0 and 6.1 64 bit freeze on MacMini -also in 7.03

2019-04-29 Thread Stephan Eggermont
Ben Coman  wrote:
> On Sun, 28 Apr 2019 at 17:33, Stephan Eggermont
>  wrote:
>> 
>> TedVanGaalen  wrote:
>>> Hi Stephan
>>> yes, you wrote that already before, but
>>> which specific VM from files.pharo.org? there are many.
>>> TedvG
>> 
>> Please compare if you have the same results I had as I described in the
>> issue
>> 20181039 works, 201810230536 is broken
> 
> I've spent ten minutes looking around the site including these locations
> http://files.pharo.org/get-files/70/
> http://files.pharo.org/vm/pharo/mac/
> http://files.pharo.org/vm/nightly-build/
> http://files.pharo.org/platform/
> 
> and not been able to identify those versions.
> Could you provide links to both those VMs?

Vms are in https://files.pharo.org/vm/pharo-spur64/mac/





[Pharo-users] [ANN] Pharo Consortium New Academic Member: LIFIA

2019-04-29 Thread Marcus Denker
The Pharo Consortium is very happy to announce that LIFIA has joined the 
Consortium as an Academic Member.

About
- LIFIA is a Research Center based at the Faculty of Informatics of the 
National University of La Plata, in Argentina. 
  It is an associated center to the Scientific Research Commission of the 
Buenos Aires Province (CIC-PBA). 
  LIFIA pioneered the use of OOP (and Smalltalk in particular) in Argentina's 
industry and academia.   
  https://www.lifia.info.unlp.edu.ar/en/

- Pharo Consortium: http://consortium.pharo.org
  The goal of the Pharo Consortium is to allow companies and institutions to 
support the ongoing development and future of Pharo.

Individuals can support Pharo via the Pharo Association: 
http://association.pharo.org




[Pharo-users] Getting example images - https://picsum.photos

2019-04-29 Thread Sven Van Caekenberghe
Hi,

This is a cool service: https://picsum.photos - it gives you example images 
(pictures/photos).

Here is how you can use this from a standard Pharo image (no pun intended).

ZnEasy getJpeg: 'https://picsum.photos/512'.

ImageReadWriter formFromStream: (ZnClient new
  systemPolicy;
  url: 'https://picsum.photos/640/480?grayscale';
  accept: ZnMimeType imagePng;
  get) readStream.

Sven