Pharo Quality Rules for Beginners

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

Pharo Quality Rules for Beginners

Pharo Smalltalk Users mailing list
Hello everyone!

My name is Esteban and I will be working on the Pharo Quality Rules for the next few months. The goal is to create different profiles for the rules according to the programming experience of the user. For example, for the beginner profile we would like to check for common mistakes made by people who are just starting with Pharo like:
  • Sending self as a message (probably because they forgot a . )
  • Using False instead of false
  • etc..
I would appreciate it if you could share with me other common mistakes that you have seen beginners do, or maybe tell me a bit of your own experience when you started using Pharo :)


Best,
Esteban Villalobos
Reply | Threaded
Open this post in threaded view
|

Re: Pharo Quality Rules for Beginners

hogoww
Hello,

First, good luck ! That seems quite interesting !

Few things i can think of:

- message priority is often hard to understand, although I'm not sure
how that could transform into a rule.

- I didn't see this one that often, but since we loose arithmetic
priority for message one, I'm pretty sure that could bother some.

- miss use of the difference between 'SubclassResponsability' and 'self
subclassResponsibility' (and other of this kind i guess, such as
shouldNotImplement (I actually just found a very old one in my code :') )


Pierre


On 15/01/2020 10:41, ESTEBAN VILLALOBOS DIAZ via Pharo-users wrote:

Reply | Threaded
Open this post in threaded view
|

Re: Pharo Quality Rules for Beginners

Kasper Osterbye
In reply to this post by Pharo Smalltalk Users mailing list
On 16 January 2020 at 14.20.03, Ben Coman ([hidden email]) wrote:
An error message like "Blah doesn't understand self" is a bit complex 
for a beginner to decipher. 

I would like to second this one!

If you want to have beginners mode, I think you need to include run-time aspects as well as Ben mentions. It should be possible to put the general doesNotUnderstand in a beginners mode, which checks for these cases

- messages send to nil, explaining what is the likely cause(s). 

- the case mentioned by Ben

- check if the message is understood by the class or object (several have mentioned the class/object side issue).

- check which classes implements the method which was sent, and perhaps even suggest to open the implementers browser

Good luck with the project!

Best,

Kasper

Reply | Threaded
Open this post in threaded view
|

Re: Pharo Quality Rules for Beginners

vince
In reply to this post by Pharo Smalltalk Users mailing list
Hello Esteban

Some of the most common mistakes I made as a beginner and from seeing other beginners are (in no particular order):

1. Not learning to use the collections properly. In other words, not knowing the appropriate ones (OrderedCollection vs Array vs Dictionary vs String etc) and the messages that they understand.

2. Not using or not using the collections iterators properly (#select:/#reject:, #collect:, #inject:into:, #detect:, #do:, etc).

3. Not using or not using streams properly.

4. Concatenating strings where one or more substrings has a "'" (single quote) in it.

5. Adding things to a collection in a loop but forgetting to add a #yourself at the end (e.g., aCollection do: [ :each | anotherCollection add: each ]).

6. Writing large methods.

7. Abuse of inheritance.

When teaching other people Smalltalk, I always recommend they look at Kent Beck's "Smalltalk Best Practise Patterns" and Klimas et als "Smalltalk with Style".

Vince

-----Original Message-----
From: Pharo-users [mailto:[hidden email]] On Behalf Of Ben Coman
Sent: Thursday, 16 January 2020 11:19 PM
To: Any question about pharo is welcome <[hidden email]>
Cc: Pharo Development List <[hidden email]>
Subject: Re: [Pharo-users] Pharo Quality Rules for Beginners

EXTERNAL: Do not click links or open attachments if you do not recognize the sender.

On Wed, 15 Jan 2020 at 17:41, ESTEBAN VILLALOBOS DIAZ via Pharo-users <[hidden email]> wrote:

>
> Hello everyone!
>
> My name is Esteban and I will be working on the Pharo Quality Rules for the next few months. The goal is to create different profiles for the rules according to the programming experience of the user. For example, for the beginner profile we would like to check for common mistakes made by people who are just starting with Pharo like:
>
> Sending self as a message (probably because they forgot a . ) Using
> False instead of false etc..
>
> I would appreciate it if you could share with me other common mistakes
> that you have seen beginners do, or maybe tell me a bit of your own
> experience when you started using Pharo :)

- Getting confused between instance-side and class-side, mixing up which side methods are on.
When getting a DNU maybe check if that message is known on the class-side.

- leaving out the end of statement trailing dot.
An error message like "Blah doesn't understand self" is a bit complex for a beginner to decipher.

cheers -ben