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
> 
> 
> 

Reply via email to