Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Hilaire
Sven,

Often the intend is wrongly perceived, I am sorry about that.

I know about these Pharo books (but not the Pharo with Style which I did
not pay attention to), I bought three of them and I wrote the original
Morph chapter in the Pharo By Example book, I donated a bit to the Steph
proposal for additionnal resources (sorry forgot the name). For me these
resources are just obvious, and I just mentioned ones I have good
souvenir with when learning at the very beginning. I understand now it
felt like I want to ignore the Pharo documentation effort, but it was
really not my intend, I think I am over this kind of silly behavior, I
am sorry it felt that way.

Hilaire

Le 18/12/2019 à 19:39, Sven Van Caekenberghe a écrit :
> I consider you a full member of the Pharo community, I have seen you 
> interacting on the mailing lists for many years and I appreciate your work a 
> lot, that is why I was surprised you would not know that there are newer, 
> pharo specific versions of the very old book you mentioned, the Pharo By 
> Example book is itself many years old already.
>
> Please understand, many people ask for all kinds of documentation, authors 
> put a lot of work in writing or updating documentation, and then it seems to 
> go unnoticed, which is very frustrating.

-- 
Dr. Geo
http://drgeo.eu





Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Sven Van Caekenberghe
Hilaire,

I hope you are well.

I consider you a full member of the Pharo community, I have seen you 
interacting on the mailing lists for many years and I appreciate your work a 
lot, that is why I was surprised you would not know that there are newer, pharo 
specific versions of the very old book you mentioned, the Pharo By Example book 
is itself many years old already.

Please understand, many people ask for all kinds of documentation, authors put 
a lot of work in writing or updating documentation, and then it seems to go 
unnoticed, which is very frustrating.

Sven

> On 18 Dec 2019, at 19:32, Hilaire  wrote:
> 
> Keep cool and relax, no need to be harsh.  Just mention the additional
> resources I will happily learn from, I did not see your previous posts.
> 
> I mentioned resources I was happy to use when learning Smalltalk, I am
> only distantly following what is going on with Pharo. Last time I code
> some bits of Pharo was about 2-3 months ago. Serious Smalltalk code was
> likely about 12 months ago. I am recovering from a surgery where a big
> part of my large bowel was removed and hoping for no relapse. So excuse
> me if I am not up to the standard, I am not even a professional
> programmer. My daily job is teaching to teenagers and staying afloat.
> 
> Thanks
> 
> Hilaire
> 
> Le 18/12/2019 à 19:00, Sven Van Caekenberghe a écrit :
>> Come on, there is
>> 
>>  http://books.pharo.org/updated-pharo-by-example/
>> 
>> which is the same book, but for Pharo, and updated to 5.0
>> 
>> And
>> 
>>  http://books.pharo.org/booklet-WithStyle/
>> 
>> being written.
>> 
>> Let's appreciate all the effort done by the authors to do the hard work of 
>> keeping all this up to date.
>> 
> -- 
> Dr. Geo
> http://drgeo.eu
> 
> 
> 




Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Hilaire
Keep cool and relax, no need to be harsh.  Just mention the additional
resources I will happily learn from, I did not see your previous posts.

I mentioned resources I was happy to use when learning Smalltalk, I am
only distantly following what is going on with Pharo. Last time I code
some bits of Pharo was about 2-3 months ago. Serious Smalltalk code was
likely about 12 months ago. I am recovering from a surgery where a big
part of my large bowel was removed and hoping for no relapse. So excuse
me if I am not up to the standard, I am not even a professional
programmer. My daily job is teaching to teenagers and staying afloat.

Thanks

Hilaire

Le 18/12/2019 à 19:00, Sven Van Caekenberghe a écrit :
> Come on, there is
>
>   http://books.pharo.org/updated-pharo-by-example/
>
> which is the same book, but for Pharo, and updated to 5.0
>
> And
>
>   http://books.pharo.org/booklet-WithStyle/
>
> being written.
>
> Let's appreciate all the effort done by the authors to do the hard work of 
> keeping all this up to date.
>
-- 
Dr. Geo
http://drgeo.eu





Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Sven Van Caekenberghe
Come on, there is

  http://books.pharo.org/updated-pharo-by-example/

which is the same book, but for Pharo, and updated to 5.0

And

  http://books.pharo.org/booklet-WithStyle/

being written.

Let's appreciate all the effort done by the authors to do the hard work of 
keeping all this up to date.

> On 18 Dec 2019, at 18:30, Hilaire  wrote:
> 
> Hi Steve,
> 
> Did you give a look at the "Smalltalk by Example" and "Smalltalk with
> style" ? There are good starters to get an overall idea of the basic
> objects and how is written Smalltalk code. It could help to jump in
> Pharo then.
> 
> There are very easy reading, the advanced parts may not apply to Pharo
> though, but you can then jump to specific Pharo books.
> 
> http://stephane.ducasse.free.fr/FreeBooks.html
> 
> Hilaire
> 
> 
> 
> Le 18/12/2019 à 09:11, Steve Davies a écrit :
>> I'm a career programmer but I'm nearly 60 and sadly I can't absorb
>> information like I used to be able to, and I'm just finding Pharo so
>> overwhelming - I feel like a maintenance programmer trying to find a
>> way into a million lines of code when you don't understand the
>> principles of organisation and the conventions of the developers.
>> 
>> Is there no way to have some sort of "progressive revelation" of the
>> insides of Pharo?  Just documentation on most classes, examples of how
>> to use the class, without the implementation being exposed initially?
> 
> -- 
> Dr. Geo
> http://drgeo.eu
> 
> 
> 




Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Hilaire
Hi Steve,

Did you give a look at the "Smalltalk by Example" and "Smalltalk with
style" ? There are good starters to get an overall idea of the basic
objects and how is written Smalltalk code. It could help to jump in
Pharo then.

There are very easy reading, the advanced parts may not apply to Pharo
though, but you can then jump to specific Pharo books.

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

Hilaire



Le 18/12/2019 à 09:11, Steve Davies a écrit :
> I'm a career programmer but I'm nearly 60 and sadly I can't absorb
> information like I used to be able to, and I'm just finding Pharo so
> overwhelming - I feel like a maintenance programmer trying to find a
> way into a million lines of code when you don't understand the
> principles of organisation and the conventions of the developers.
>
> Is there no way to have some sort of "progressive revelation" of the
> insides of Pharo?  Just documentation on most classes, examples of how
> to use the class, without the implementation being exposed initially?

-- 
Dr. Geo
http://drgeo.eu





Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Ben Coman
On Wed, 18 Dec 2019 at 16:12, Steve Davies 
wrote:

> Hi,
>
> I'm having yet another go to get to grips with Pharo.
>
> My project is for home automation.  It seems in principle a great match
> since object inside Smalltalk are obviously a great match for physical
> objects being controlled.
>
> I started at the Pharo Wiki on Github "Setting up a new project".
>
> I'm a career programmer but I'm nearly 60 and sadly I can't absorb
> information like I used to be able to, and I'm just finding Pharo so
> overwhelming - I feel like a maintenance programmer trying to find a way
> into a million lines of code when you don't understand the principles of
> organisation and the conventions of the developers.
>

Consider the analogy would be someone wanting to write Hello World as a
newcomer in C
and having the source code for the Eclipse IDE in front of them and feeling
like they have to understand all of that source code before writing Hello
World.
Just because because the code for the whole Pharo IDE system is front of
you doesn't mean you should feel need to understand it all at once, or even
ever.
But I remember a similar initial jarring of my workflow before developing a
constructive-ignorance mindset.


Is there no way to have some sort of "progressive revelation" of the
> insides of Pharo?  Just documentation on most classes, examples of how to
> use the class, without the implementation being exposed initially?
>

The books and MOOC are probably the best for this
https://pharo.org/documentation

For something a bit more goal oriented, try Exercism...
https://exercism.io/tracks/pharo-smalltalk


The stuff I need to look into for my project is mixed in with 1000s of
> classes that I (hopefully) can ignore for now - but there seems to be no
> way to hide away all the irrelevant stuff.
>
> Traditionally if I was trying to get to grips with a large unfamiliar code
> base I would use grep to search, skim through source files getting a sense
> of it.  With the browser in Pharo I feel like I'm looking through a
> keyhole.  No doubt this is just unfamiliarity and I just need to learn the
> tools better.
>

A few things I find useful are:
* In the class definition, select a variable the right-click-it > Code
Search > References to it
* In the Browser, select a class, right-click-it > Class Refs to find some
unit tests using it, then debug-into those tests.
* Make heavy use of Senders and Implementors to find examples of how things
are used.
* Add "self haltOnce" into methods so you can observe the call stack of how
they are used.  Note: "self halt" can be dangerous in system methods you're
not familiar with, in case that method is used by the UI loop.  haltOnce
effectively stops the current UI loop and spawn a new UI loop to keep
working.

Personally I find it easier to understand the Pharo libraries by watching
them run in a debugger than perusing static code.

I'm looking forward to trying out the new object-centric-debugging...
https://www.youtube.com/watch?v=uDYJIm54yE4


Please read this as a request for help as to how to get a finger hold and
> how to shake this feeling of drinking from the firehose?  It's not intended
> as a complaint.
>

Cool.  It does read that way.  Happy to help you settle in.

cheers -ben

>


Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Ben Coman
On Wed, 18 Dec 2019 at 23:05, ponyatov  wrote:

> I'm speaking about 20K SRAM computers and Java-only services. FFI and VMs
> do
> not matter here.
>

Ahh, got it.  Pharo's never going squeeze down to a 20K device,
but I think its feasible for our StackInterpreter VM to be ported to the
ESP32 microprocessor (https://www.sparkfun.com/products/13907)
Oh if I had the time...
And these devices get more powerful and cheaper every year. Maybe we will
get there.

cheers -ben


Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread ponyatov
I'm speaking about 20K SRAM computers and Java-only services. FFI and VMs do
not matter here.



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



Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Ben Coman
On Wed, 18 Dec 2019 at 20:06, ponyatov  wrote:

> Hello, colleague.
>
> I'm also working in the same domain, primarily on the target of adapting
> the
> Actor model (async distributed messaging) for IoT systems in a wide: from
> deeply embedded nodes to top-level north-side cloud cervices.
>
> I like Pharo as a workstation system and IDE, but I'm not looking Pharo as
> a
> self-hosted platform for my needs. The problem is all IoT infrastructure it
> tightly bound with low-level C for nodes and Java for top-side. There are
> dozens and hundreds of existing projects, firmware source codes, platforms,
> etc which I must integrate with as is.
>
> As you know, Smalltalk is well known as bad in interaction with other
> existing projects,


Historically that was true, but Pharoers saw interaction with the outside
as a gap they had to close
and third party libraries are not hard to use via FFI..  Here is one small
example of my own making calls into the LibSodium crypto library.
https://github.com/Traadh/bittrex/search?q=ffi_q=ffi


If anybody doubts, try to use it the same way as
> Lua engine: embed into existing C#/Java project,


Embedding Pharo is getting better now that we have a headless VM

http://forum.world.st/ANN-Pharo-Headless-Beta-Actually-what-is-between-Alpha-and-Beta-td5102089.htm

able to use an external library like GTK3 for its graphics backend.



> or bind it with any
> randomly selected C++ library in a click, like Qt, LLVM, wxWidgets or
> something fat like this.
>

Can you link to some info/tutorial on such one-click binding.  What
workflow should Pharo be trying to emulate?

cheers -ben


Re: [Pharo-users] Question on MetaLink: access to the calling MessageNode from a MethodNode

2019-12-18 Thread Marcus Denker



> On 18 Dec 2019, at 14:06, Mehrdad Abdi  wrote:
> 
> Hello
> 
> For a specific method, I need to log some information when the method is 
> called, like the state of the receiver, values of arguments, where the method 
> is called, ... .
> 
> Using following MetaLink, I’m able to capture the receiver and arguments and 
> context. 
> 
> link := MetaLink new
>   metaObject: self;
>   selector:
>   
> #linkBeforeMethodArguments:receiver:selector:context:;
>   control: #before;
>   level: 0;
>   arguments: #( arguments receiver selector context ). 
> aMethod := MyClass methodNamed: #myMethodArg1:arg2.
> aMethod ast link: link
> 
> For capturing the information related to where this method is called, It's 
> possible to extract it from Context, but it’s a dirty way. 
> Is there any way to access the MessageNode which called this MethodNode?
> 
No, the information is only available via the context… even the #sender 
reification is internally is compiled to "thisContext sender receiver”.

You could add your own reification (that is a class similar to 
RFSenderReification and implement your own “sendingMethodNode” reification, but
this would just make it look nicer, not be different from an implementation 
point of view…

Marcus





[Pharo-users] Question on MetaLink: access to the calling MessageNode from a MethodNode

2019-12-18 Thread Mehrdad Abdi
Hello

For a specific method, I need to log some information when the method is 
called, like the state of the receiver, values of arguments, where the method 
is called, ... .

Using following MetaLink, I’m able to capture the receiver and arguments and 
context. 

link := MetaLink new
metaObject: self;
selector:

#linkBeforeMethodArguments:receiver:selector:context:;
control: #before;
level: 0;
arguments: #( arguments receiver selector context ). 
aMethod := MyClass methodNamed: #myMethodArg1:arg2.
aMethod ast link: link

For capturing the information related to where this method is called, It's 
possible to extract it from Context, but it’s a dirty way. 
Is there any way to access the MessageNode which called this MethodNode?

Best regards,
Mehrdad


Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread ponyatov
Hello, colleague. 

I'm also working in the same domain, primarily on the target of adapting the
Actor model (async distributed messaging) for IoT systems in a wide: from
deeply embedded nodes to top-level north-side cloud cervices.

I like Pharo as a workstation system and IDE, but I'm not looking Pharo as a
self-hosted platform for my needs. The problem is all IoT infrastructure it
tightly bound with low-level C for nodes and Java for top-side. There are
dozens and hundreds of existing projects, firmware source codes, platforms,
etc which I must integrate with as is.

As you know, Smalltalk is well known as bad in interaction with other
existing projects, due to its architecture mostly close to the guest OS but
not a programming language. If anybody doubts, try to use it the same way as
Lua engine: embed into existing C#/Java project, or bind it with any
randomly selected C++ library in a click, like Qt, LLVM, wxWidgets or
something fat like this.

The way looks me affordable to survive Smalltalk as a development platform
is metaprogramming = code generation. We can build a domain model of the
system we want to build (and integrate) and next generate C(++) source code
by transpiling this model to the required target language. The Pharo gives
as a very comfortable environment for model transformations, playing with
transpilation and generic knowledge representation, and at the same time, it
will not be involved in a target system we build.



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



Re: [Pharo-users] [pharo-project/pharo] Proposed improvement : performance of #atRandom: in class Bag (#5392)

2019-12-18 Thread Benoit St-Jean via Pharo-users
--- Begin Message ---
While I'm at it, another improvement would be to buffer #newFrom: by 
reading large chunks of the argument  via a ReadStream, 
adding the objects read to a  buffer and inserting into the 
receiver via #add:withOccurrences:.  That way, if you read say 1000 
object (of which lots are similar), you don't have to "add" 1000 items, 
you could reduce the number of adds by reducing the duplicates with this 
buffer bag.  Wouldn't make much of a difference in the worst case 
scenario but one can assume that since you're using a bag, you normally 
expect a lot of dups!  So we could gain a lot that way.  Anyway, that's 
what I'm seeing with my experiments (millions of objects) and I'm still 
contemplating that improvement with more & more tests (such as adjusting 
the buffer size).  So far, this is really promising!


On 2019-12-18 06:32, Sven Van Caekenberghe wrote:


OK, now I see. I was thrown off by the weird formatting ;-)

The final expression is not needed, since you started with an emptyCheck.

Reformatted then:

|Bag>>#atRandom: aGenerator "Answer a random element of the receiver. 
Uses aGenerator which should be kept by the user in a variable and 
used every time. Use this instead of #atRandom for better uniformity 
of random numbers because only you use the generator. Causes an error 
if self has no elements." | rand index | self emptyCheck. rand := 
aGenerator nextInt: self size. index := 0. self doWithOccurrences: [ 
:key :count | index := index + count. rand <= index ifTrue: [ ^ key ] ] |


Still, we need a PR as well. And maybe a specific test unless this is 
already covered by other tests.


—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub 
, 
or unsubscribe 
.



--
-
Benoît St-Jean
Yahoo! Messenger: bstjean
Twitter: @BenLeChialeux
Pinterest: benoitstjean
Instagram: Chef_Benito
IRC: lamneth
GitHub: bstjean
Blogue: endormitoire.wordpress.com
"A standpoint is an intellectual horizon of radius zero".  (A. Einstein)

--- End Message ---


Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Tim Mackinnon
Steve - obviously there are a few books and tutorials to skim through, but 
worth mentioning the meta-enter key (eg Cmd-enter on Mac) - this is spotter 
which is a universal grep and browser to help find things, as well as users of 
things (and lots more tricks)

Also, in the playground is where you can evaluate code like a repl- if you use 
meta-g on an expression you get a results inspector on the rhs which lets you 
explore and keep sliding over panes as you dive in (great for looking at 
results). You can also teach your own objects to add useful tabs to that 
browser to get a cheap ui (useful for starting out)

Tim


Sent from my iPhone

> On 18 Dec 2019, at 08:47, Steve Davies  wrote:
> 
> 
> 
> 
>> On Wed, 18 Dec 2019 at 10:42, Cédrick Béler  wrote:
>> 
>> 
>> > Le 18 déc. 2019 à 09:37, Sven Van Caekenberghe  a écrit :
>> > 
>> > Here is the class comment of MQTTExperimentalClient, which would be the 
>> > one to use:
>> > 
> 
> Thank you Sven and Cédrick for the pointers.  An existing implementation of 
> MQTT Client is a huge help and of course very useful for my learning.
> 
> I didn't know the Filter field could "or" so that is great to make things 
> disappear.
> 
> Thanks for taking the time to show me how to load the code with Metacello.
> 
> Steve
>  


Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Steve Davies
> > The stuff I need to look into for my project is mixed in with 1000s of
classes that I (hopefully) can ignore for now - but there seems to be no
way to hide away all the irrelevant stuff.


> Is it classes or methods ?


Well "Smalttalk allClasses size" gives 9018
Object allSubclasses size gives 17742
Object class allSubclasses size gives 8864

So there are thousands of classes, right? 9018 I think is the most sensible
answer since it doesn't have the meta-classes.

Steve


Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Steve Davies
On Wed, 18 Dec 2019 at 10:42, Cédrick Béler  wrote:

>
>
> > Le 18 déc. 2019 à 09:37, Sven Van Caekenberghe  a écrit :
> >
> > Here is the class comment of MQTTExperimentalClient, which would be the
> one to use:
> >
>

Thank you Sven and Cédrick for the pointers.  An existing implementation of
MQTT Client is a huge help and of course very useful for my learning.

I didn't know the Filter field could "or" so that is great to make things
disappear.

Thanks for taking the time to show me how to load the code with Metacello.

Steve


[Pharo-users] Proposed improvement : performance of #atRandom: in class Bag

2019-12-18 Thread Benoit St-Jean via Pharo-users
--- Begin Message ---

For those interested,

I proposed a fix to *drastically* improve the performance of 
Bag>>#atRandom: !


See https://github.com/pharo-project/pharo/issues/5392

--
-
Benoît St-Jean
Yahoo! Messenger: bstjean
Twitter: @BenLeChialeux
Pinterest: benoitstjean
Instagram: Chef_Benito
IRC: lamneth
GitHub: bstjean
Blogue: endormitoire.wordpress.com
"A standpoint is an intellectual horizon of radius zero".  (A. Einstein)


--- End Message ---


Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Cédrick Béler



> Le 18 déc. 2019 à 09:37, Sven Van Caekenberghe  a écrit :
> 
> 
> 
>> On 18 Dec 2019, at 09:30, Sven Van Caekenberghe  wrote:
>> 
>> There is not much handholding documentation though, check out the unit tests.
> 
> Here is the class comment of MQTTExperimentalClient, which would be the one 
> to use:
> 

I just wish all « not much handholding documentation » was like that ;-)

And this are expression nice to debug (especially stepping into methods like 
#open, #sendMessage, #subscribeToTopic, …).

Cheers,

Cédrick


Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Sven Van Caekenberghe



> On 18 Dec 2019, at 09:30, Sven Van Caekenberghe  wrote:
> 
> There is not much handholding documentation though, check out the unit tests.

Here is the class comment of MQTTExperimentalClient, which would be the one to 
use:



I am MQTTExperimentalClient.
I am an MQTTPrimitiveClient and a MQTTAbstractClient.

I am an experimental / proof of concept implementation of a simple MQTT client.

Examples:

Send a single message to a topic to the local broker, say a temperature reading 
of a sensor, using QoS level 1.

  MQTTExperimentalClient new
atLeastOnce;
open;
sendMessage: 20 asByteArray toTopic: '/device/42/outside-temperature';
close.

Same message to a remote host, using the default QoS level 0.

  MQTTExperimentalClient new
host: 'iot.example.com';
open;
sendMessage: 21 asByteArray toTopic: '/device/42/outside-temperature';
close.

Read a single message, using QoS level 2 (client should be closed afterwards)

  MQTTExperimentalClient new
exactlyOnce;
open;
subscribeToTopic: '/new-user-notifications';
readMessage.

Read and collect 10 temperature readings 

  Array streamContents: [ :stream | | count |
count := 1.
MQTTExperimentalClient new
   open;
   subscribeToTopic: '/device/42/outside-temperature';
   runWith: [ :message |
 stream nextPut: message contents asInteger.
 (count := count + 1) > 10 ifTrue: [ ConnectionClosed signal ] ] ].

Collect 100 system notifications

  Array streamContents: [ :stream | | count |
count := 1.
MQTTExperimentalClient new
  host: 'iot.eclipse.org';
  open;
  subscribeToTopic: '$SYS/#';
  runWith: [ :message |
stream nextPut: message.
(count := count + 1) > 100 ifTrue: [ ConnectionClosed signal ] ] ].

Implementation note:

I use an inbox when reading messages so that I can store unexpected out of band 
messages. 
Reading a message requires a condition filter.
I handle keepalive and ping.
I implement #runWith: to program in event driven style.


Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Sven Van Caekenberghe
Hi Steve,

Welcome!

Yes, Pharo and similar dynamic object system can seem overwhelming, but they 
are also powerful.

The trick is to find the shortest path from the system to your application, 
(re)using as much as possible. You should indeed also learn to skip over 
details and look at the interfaces of objects.

There are a couple of books, see http://books.pharo.org (and much more other 
documentation).

As for an MQTT client, that already exists: https://github.com/svenvc/mqtt

There is not much handholding documentation though, check out the unit tests.

Don't hesitate to ask questions.

HTH,

Sven

> On 18 Dec 2019, at 09:11, Steve Davies  wrote:
> 
> Hi,
> 
> I'm having yet another go to get to grips with Pharo.
> 
> My project is for home automation.  It seems in principle a great match since 
> object inside Smalltalk are obviously a great match for physical objects 
> being controlled.
> 
> I started at the Pharo Wiki on Github "Setting up a new project".
> 
> I'm a career programmer but I'm nearly 60 and sadly I can't absorb 
> information like I used to be able to, and I'm just finding Pharo so 
> overwhelming - I feel like a maintenance programmer trying to find a way into 
> a million lines of code when you don't understand the principles of 
> organisation and the conventions of the developers.
> 
> Is there no way to have some sort of "progressive revelation" of the insides 
> of Pharo?  Just documentation on most classes, examples of how to use the 
> class, without the implementation being exposed initially?
> 
> The stuff I need to look into for my project is mixed in with 1000s of 
> classes that I (hopefully) can ignore for now - but there seems to be no way 
> to hide away all the irrelevant stuff.
> 
> Traditionally if I was trying to get to grips with a large unfamiliar code 
> base I would use grep to search, skim through source files getting a sense of 
> it.  With the browser in Pharo I feel like I'm looking through a keyhole.  No 
> doubt this is just unfamiliarity and I just need to learn the tools better.
> 
> Please read this as a request for help as to how to get a finger hold and how 
> to shake this feeling of drinking from the firehose?  It's not intended as a 
> complaint.
> 
> My first task is to write an MQTTClient.  MQTT is a messaging protocol.  MQTT 
> has "clients" - who subscribe for "topics" and receive matching messages, and 
> which can publish to topics.  And there are brokers which distribute 
> published messages to subscribing clients.
> 
> I only need to implement a client.  The protocol is binary, not text.  It 
> runs over TCP.  Here's a description of the messaging 
> 
> SInce I envision objects inside Pharo that model the real external objects 
> then I will need some sort of background process running the connection to 
> the mqtt broker, and each object would receive and send MQTT messages via 
> that process.
> 
> So to tackle this I need to understand:
>   • How to implement a TCP client (subclass ProtocolClient?  Or do I need 
> to work at a lower level with SocketStream?)
>   • Packing and unpacking binary data, working with bits.
>   • How to talk to and from a background process.
> Any and all suggestions and help to get going would be welcome.  I do 
> understand the principles of Smalltalk and can read code OK.
> 
> Thanks,
> Steve
> 
> 
> 




Re: [Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Cédrick Béler
Hi Steve,

> 
> Hi,
> 
> I'm having yet another go to get to grips with Pharo.
> 
> My project is for home automation. 

Interesting, this si the kind of side project I always have in mind. 

You should look at PharoThings that may help in some respects.




> It seems in principle a great match since object inside Smalltalk are 
> obviously a great match for physical objects being controlled.
> 
> I started at the Pharo Wiki on Github "Setting up a new project".
> 
> I'm a career programmer but I'm nearly 60 and sadly I can't absorb 
> information like I used to be able to, and I'm just finding Pharo so 
> overwhelming - I feel like a maintenance programmer trying to find a way into 
> a million lines of code when you don't understand the principles of 
> organisation and the conventions of the developers.

I guess this is the usual feeling and also the learning curve is steep.

I’ll suggest do the Mooc (or at least partially) 
http://mooc.pharo.org 


> 
> Is there no way to have some sort of "progressive revelation" of the insides 
> of Pharo?  Just documentation on most classes, examples of how to use the 
> class, without the implementation being exposed initially?

Classic browsing of main class moments is possible but o-k there are a lot. 
This is really a system where you can learn everyday (but it’s also a pandora 
box ^^ eating all you attention sometimes).

Also, to me revelation that could be your « progressing » revelation of code is 
exactly that… instead of browsing endless classes, methods, class hierarchy, 
using the debugger was incredible to reveal the inner working of some package… 
this is code flowing browsing.

Find something you want to understand, write an expression that exposes it, and 
debug it (CTRL + D).


> 
> The stuff I need to look into for my project is mixed in with 1000s of 
> classes that I (hopefully) can ignore for now - but there seems to be no way 
> to hide away all the irrelevant stuff.

Is it classes or methods ?  There are ways to filter packages at least in the 
browser but putting text and logical OR, lets says 
Zinc | iCal | whatever


> 
> Traditionally if I was trying to get to grips with a large unfamiliar code 
> base I would use grep to search, skim through source files getting a sense of 
> it.  With the browser in Pharo I feel like I'm looking through a keyhole.  No 
> doubt this is just unfamiliarity and I just need to learn the tools better.

Same. You look at packages and classes. Again the debugger to have a real 
feeling of the dynamic. I remember back in 2005, I was struggling to draw some 
class hierarchy to understand...

> 
> Please read this as a request for help as to how to get a finger hold and how 
> to shake this feeling of drinking from the firehose?  It's not intended as a 
> complaint.

Sure ;) 

> 
> My first task is to write an MQTTClient.  MQTT is a messaging protocol.  MQTT 
> has "clients" - who subscribe for "topics" and receive matching messages, and 
> which can publish to topics.  And there are brokers which distribute 
> published messages to subscribing clients.



Uhm magic of pharo, and especially for this field, Sven at least did an 
implementation of MQTT (the guy behind Zinc which is a great central 
framework). And this is great code:

https://github.com/svenvc/mqtt 


To load it:

Metacello new
  repository: 'github://svenvc/mqtt/repository';
  baseline: 'MQTT';
  load.



> 
> I only need to implement a client.  The protocol is binary, not text.  It 
> runs over TCP.  Here's a description of the messaging 
> 
> SInce I envision objects inside Pharo that model the real external objects 
> then I will need some sort of background process running the connection to 
> the mqtt broker, and each object would receive and send MQTT messages via 
> that process.
> 
> So to tackle this I need to understand:
> How to implement a TCP client (subclass ProtocolClient?  Or do I need to work 
> at a lower level with SocketStream?)
> Packing and unpacking binary data, working with bits.
> How to talk to and from a background process.
> Any and all suggestions and help to get going would be welcome.  I do 
> understand the principles of Smalltalk and can read code OK.

So this is kind of done ;-)

I suggest you just learn it. Sven is according to me one of the best pharo code 
out there ;-)
Do the Mooc(slides and video too).

Cheers,

Cédrick


> 
> Thanks,
> Steve
> 
> 
> 



[Pharo-users] I feel like an overwhelmed maintenance programmer - how to get some toeholds?

2019-12-18 Thread Steve Davies
Hi,

I'm having yet another go to get to grips with Pharo.

My project is for home automation.  It seems in principle a great match
since object inside Smalltalk are obviously a great match for physical
objects being controlled.

I started at the Pharo Wiki on Github "Setting up a new project".

I'm a career programmer but I'm nearly 60 and sadly I can't absorb
information like I used to be able to, and I'm just finding Pharo so
overwhelming - I feel like a maintenance programmer trying to find a way
into a million lines of code when you don't understand the principles of
organisation and the conventions of the developers.

Is there no way to have some sort of "progressive revelation" of the
insides of Pharo?  Just documentation on most classes, examples of how to
use the class, without the implementation being exposed initially?

The stuff I need to look into for my project is mixed in with 1000s of
classes that I (hopefully) can ignore for now - but there seems to be no
way to hide away all the irrelevant stuff.

Traditionally if I was trying to get to grips with a large unfamiliar code
base I would use grep to search, skim through source files getting a sense
of it.  With the browser in Pharo I feel like I'm looking through a
keyhole.  No doubt this is just unfamiliarity and I just need to learn the
tools better.

Please read this as a request for help as to how to get a finger hold and
how to shake this feeling of drinking from the firehose?  It's not intended
as a complaint.

My first task is to write an MQTTClient.  MQTT is a messaging protocol.
MQTT has "clients" - who subscribe for "topics" and receive matching
messages, and which can publish to topics.  And there are brokers which
distribute published messages to subscribing clients.

I only need to implement a client.  The protocol is binary, not text.  It
runs over TCP.  Here's a description of the messaging

SInce I envision objects inside Pharo that model the real external objects
then I will need some sort of background process running the connection to
the mqtt broker, and each object would receive and send MQTT messages via
that process.

So to tackle this I need to understand:

   1. How to implement a TCP client (subclass ProtocolClient?  Or do I need
   to work at a lower level with SocketStream?)
   2. Packing and unpacking binary data, working with bits.
   3. How to talk to and from a background process.

Any and all suggestions and help to get going would be welcome.  I do
understand the principles of Smalltalk and can read code OK.

Thanks,
Steve