Planet Smalltalk

October 20, 2014

Hernán Morales Durand - 10 simple survey questions about Smalltalk

Introduction

So I did a short on-line Smalltalk survey to find out where is the technology today, and what could be expected in the future, by asking people about their experiences and expectations with Smalltalk. Any programmer could participate and answer. The survey was designed to a broad developer audience.
Why is important you take this survey? Because you could help to a small(talk) community to uncover answers, to gather feedback and meaningful opinions, and to evolve by telling what you need most. The survey is open until 31/10/2014 at 3:15 a.m.

The survey is not biased towards any particular Smalltalk flavor (I am not affiliated with any particular Smalltalk provider). The following Smalltalk platforms have been included (any other not listed flavor can be added):

Methodology

I have collected a list of well-known forums containig "General Computer Programming" sub-forums, as most forums do not contain a Smalltalk sub-forum. I have rejected all programming sub-forums specific to a particular language, for example: JavaForum, PHPDevForum, "General C++ Forum", etc. Because:

  • Posts with surveys related to other programming language are not commonly accepted
  • They are marked as off-topic or closed.
  • It could be seen as promotion which is not the intent of this survey.

Results

The survey is still running! You can come back after 31/10/2014 and check responses.

Pharo Weekly - Building your own power tools: an Example

Using ZnLogEvents and GT Tools to look at HTTP traffic behind Monticello.

I love it when a plan comes together. Many small usability changes were added to GT Tools since they were included in Pharo 4. And a lot of small custom inspector presentations were added.

  http://youtu.be/rIBbeMdFCys  (be sure to select the 720p version)

This short screencast shows how to use ZnLogEvents and GT Tools in Pharo 4 to look at the HTTP traffic behing Monticello (more specifically, an MCSmalltalkhubRepository). This demonstrates how simple custom inspectors are combined to form a powerful tool - and how easy it is to learn about what is going on inside Pharo or inside your complex business app

Sven

October 19, 2014

Julian Fitzell - Declaring Seaside sub-components in the #children method

People often ask why they need to define the #children method on Seaside components. I wrote a long email today to the mailing list explaining how #children is currently used and why it's important and I thought it might be useful to post it here as well so it's easier to find and link to. 

When you render a child component you are implicitly defining a tree of components. #children simply allows the framework to walk the component tree explicitly. The reasons for needing to walk the tree explicitly have changed over time, which is part of the reason for the confusion.

At one point, for example, we used to walk the tree to give each component a chance to handle callbacks, so if your component wasn't in #children it would never even have seen its callbacks. That is no longer the case (which is actually a bit of a shame because decorations can no longer intercept them, but I digress).

If you look in the image for users of WAVisiblePresenterGuide and WAAllPresenterGuide, you will see the current cases where we need to traverse the tree:
  1. Calling #updateStates: for snapshotting/backtracking
  2. Calling #initialRequest: when a new session is started
  3. Executing tasks (they need to execute outside of the render phase to make sure the render phase does not have side effects)
  4. Calling #updateRoot:
  5. Calling #updateUrl:
  6. Displaying Halos for each component in development mode
  7. Generating the navigation path in WATree
  8. Detecting which components are visible/active to support delegation (#call:/#show:)
Keep in mind that basically all these things happen before rendering, so if you create new components inside #renderContentOn: they'll miss out: you should try to create your sub-components either when your component is initialized or during a callback. If your child component doesn't rely on any of the above (and doesn't use any child components itself that rely on any of these things) then technically everything will work fine without adding it to #children. But keep in mind that:
  • the framework may change in the future to traverse the tree for other reasons;
  • add-ons may depend on being able to walk the tree for other reasons; and
  • it's not great encapsulation to assume that, in the future, components you are rendering will never need any of the above nor start using sub-components that do. 
Finally, components are stateful by definition, so if you don't feel the need to persist your component between render phases, it probably shouldn't be a component. For stateless rendering you're better to subclass WAPainter directly or even WABrush: both of these are intended to be used and then thrown away and they will make it clearer in your mind whether or not you're using on things that depend on #children.

Pharo Weekly - Another week of effort in Pharo

40262
13606 testSlotScopeParallelism is failing

https://pharo.fogbugz.com/f/cases/13606

14085 Image blocked when halt placed on setUp method and running a whole TestCase from Nautilus

https://pharo.fogbugz.com/f/cases/14085

40261
14054 Cant load font from a path with accented characters

https://pharo.fogbugz.com/f/cases/14054

11021 MouseEvent>>blueButtonChanged

https://pharo.fogbugz.com/f/cases/11021

14075 Halt once in Rectangle>>setOrigin:corner:

https://pharo.fogbugz.com/f/cases/14075

40260
14028 PluggableThreePhaseButtonMorph should be packaged with Morphic-Widgets-Basic

https://pharo.fogbugz.com/f/cases/14028

13668 remove the last StringHolder references

https://pharo.fogbugz.com/f/cases/13668

13635 Package Spec-Extensions just contains one accessor –> can be moved to the class

https://pharo.fogbugz.com/f/cases/13635

5625 TextDiffBuilder in System-FilePackage ?

https://pharo.fogbugz.com/f/cases/5625

40259
14076 Move ProtocolRemovalException to Kernel-Exceptions

https://pharo.fogbugz.com/f/cases/14076

40258
14048 two tests failing in EmbeddedFreeTypeFontInstallerTest

https://pharo.fogbugz.com/f/cases/14048

14079 Inconsistent information in debugger (pharo 4)

https://pharo.fogbugz.com/f/cases/14079

40257
14061 windows systemfonts : wrong path in guessWindowsFontFolderPath

https://pharo.fogbugz.com/f/cases/14061

13131 Spec weirdness > MNU ToolDockingBarMorph>>popupEvent:in: on right click on button

https://pharo.fogbugz.com/f/cases/13131

14072 Failing test: BlockClosureTest>>#testTallyInstructions

https://pharo.fogbugz.com/f/cases/14072

40256
14069 Finish cleaning RGFactory

https://pharo.fogbugz.com/f/cases/14069

14077 Move PseudoClassOrganization close to PseudoClass

https://pharo.fogbugz.com/f/cases/14077

13738 MNU: CompiledMethod>>hasRun

https://pharo.fogbugz.com/f/cases/13738

13705 Shared pool incorrectly defined as global

https://pharo.fogbugz.com/f/cases/13705

40254
14071 OSWindow integration part1

https://pharo.fogbugz.com/f/cases/14071

40253
13599 ClassOrganizer-Core: move to Kernel-Protocol

https://pharo.fogbugz.com/f/cases/13599

40252
12111 (Date readFrom: 4.2.2013 readStream pattern: d.m.yy) ==>> 4 February 2020

https://pharo.fogbugz.com/f/cases/12111

13193 Regular expression field should not open debugger when making a syntax error

https://pharo.fogbugz.com/f/cases/13193

40251
3841 FinderUI gets out of sync when more than one Finder open

https://pharo.fogbugz.com/f/cases/3841

10307 Monticello FTP repo should not keep username and should behave like MC HTTP

https://pharo.fogbugz.com/f/cases/10307

14067 More cleaning of Ring Factory

https://pharo.fogbugz.com/f/cases/14067

30858
14034 add to Pharo3: substrings:

https://pharo.fogbugz.com/f/cases/14034

40250
12828 Unfullfilled subclass responsibility in JPEGReadWriter

https://pharo.fogbugz.com/f/cases/12828

40247
13879 Move Tests out of NECompletion

https://pharo.fogbugz.com/f/cases/13879

40249
14065 Spec WorldModel should not change theme background

https://pharo.fogbugz.com/f/cases/14065

40248
14057 fix the description and unique name RBFutureDeprecationWarningRule.

https://pharo.fogbugz.com/f/cases/14057

14062 Remove SmallInteger class>>#ccgCanConvertFrom:

https://pharo.fogbugz.com/f/cases/14062

14056 Missing DejaVu copyright notices

https://pharo.fogbugz.com/f/cases/14056

40246
11996 Wrong exception handler problem (parrt 5/5)

https://pharo.fogbugz.com/f/cases/11996

40245
11996 Wrong exception handler problem (4/5)

https://pharo.fogbugz.com/f/cases/11996

40244
11996 Wrong exception handler problem (Part3)

https://pharo.fogbugz.com/f/cases/11996

40243
11996 Wrong exception handler problem

https://pharo.fogbugz.com/f/cases/11996

14048 two tests failing in EmbeddedFreeTypeFontInstallerTest

https://pharo.fogbugz.com/f/cases/14048

40242
11996 Wrong exception handler problem (Part1/5)

https://pharo.fogbugz.com/f/cases/11996

40241
14055 Fix some failing tests related to Code Critics (due to accidental #halt)

https://pharo.fogbugz.com/f/cases/14055

13606 testSlotScopeParallelism is failing

https://pharo.fogbugz.com/f/cases/13606

40240
14019 add critics rule for #withFirstCharacterDownshifted-> #uncapitalized

https://pharo.fogbugz.com/f/cases/14019

14049 add String>>substrings: and lint rule for #subStrings:

https://pharo.fogbugz.com/f/cases/14049

14035 openWorldWithSpec not taking over the world

https://pharo.fogbugz.com/f/cases/14035

14045 Categorize classes in System-Announcements

https://pharo.fogbugz.com/f/cases/14045

40239
10572 Locking image with test icons (Glorp example)

https://pharo.fogbugz.com/f/cases/10572

13843 MOPTraitTes>>#testOrigin failing

https://pharo.fogbugz.com/f/cases/13843

14046 Deprecate SystemAnnouncement(class)>>fromInternal:

https://pharo.fogbugz.com/f/cases/14046

40238
14044 Selfies shot with Pharo should give visual feedback

https://pharo.fogbugz.com/f/cases/14044

14008 Tests from Nautilus-Tests need to be moved to a nautilus test package

https://pharo.fogbugz.com/f/cases/14008

13949 stackAlignment on windows should be 16

https://pharo.fogbugz.com/f/cases/13949

40237
14043 TabContainerMorph example gives DNU #instance

https://pharo.fogbugz.com/f/cases/14043

40236
14037 #recompile does not recompile the classTrait

https://pharo.fogbugz.com/f/cases/14037

40235
14038 #testSendersOfAt failing when running the tests in the image

https://pharo.fogbugz.com/f/cases/14038

14039 #testCurrent always fails when running all tests…

https://pharo.fogbugz.com/f/cases/14039

14041 Continue cleaning Ring Factory

https://pharo.fogbugz.com/f/cases/14041

40234
14026 Cleanup System-Localization package and add tests

https://pharo.fogbugz.com/f/cases/14026

40233
12873 IconicButton should absord property as instance variable

https://pharo.fogbugz.com/f/cases/12873

40232
14032 Fix test cases and access singletons using slots

https://pharo.fogbugz.com/f/cases/14032

40231
14030 MorphicTabManagerAdapter>>doesNotUnderstand: #tabSelected:

https://pharo.fogbugz.com/f/cases/14030

30857
14018 backport #uncapitalized to Pharo3

https://pharo.fogbugz.com/f/cases/14018

14025 DateModel Broken in 3.0

https://pharo.fogbugz.com/f/cases/14025

40230
14027 ensureTransparentColor is unused and looks dead

https://pharo.fogbugz.com/f/cases/14027

40229
14029 Smart Suggestion Implementors does not work in Nautilus anymore

https://pharo.fogbugz.com/f/cases/14029

14023 Nautlilus: Jump to test class should not only work on instance side

https://pharo.fogbugz.com/f/cases/14023

14012 RGMetaclassDefinition and RGMetatraitDefinition DNU #category

https://pharo.fogbugz.com/f/cases/14012

40228
14009 RBAddClassRefactoringTest should be moved close to the other refactoring tests

https://pharo.fogbugz.com/f/cases/14009

14007 DebuggerModelTest should be moved out of debugger package

https://pharo.fogbugz.com/f/cases/14007

14017 No senders of analyzeItemLabels

https://pharo.fogbugz.com/f/cases/14017

14022 Infinite loop in simple subclasses of SequenceableCollection

https://pharo.fogbugz.com/f/cases/14022

40227
14020 Add test cases which check font installation process and registration on singletons

https://pharo.fogbugz.com/f/cases/14020

14006 3 tests fail for AsmJit in the Pharo4

https://pharo.fogbugz.com/f/cases/14006

40226
13214 rename instance variable does not work on class side

https://pharo.fogbugz.com/f/cases/13214

14011 Many leftover methods after method announcement refactoring

https://pharo.fogbugz.com/f/cases/14011


October 17, 2014

Pharo Weekly - Phratch 40 is out

Phratch 4.0 is out of the box !
Phratch 4.0 is cleaner, faster and more stable than phratch 3.0.
After the version 3.0 that was a release for usability and stability, phratch 4.0 is released to prepare the future.
The new features are:
- phratch is more modular, eg having a kernel and lots of addons.
- cleaning a lot the source code
- customizable environment
- each block can be made visible or invisible
- each category can be made visible or invisible
- it is possible to add translation for addons with the pragma <phratchTranslation: ‘fr’> in the class PhratchTranslator. This make the translation more modular.
- first integration of phratch with the pharo environment. Using the pragma at the class side of any class in Pharo make the class visible and usable in phratch.
- There is a lot of things to do with phratch, you are welcome to contribute ! The documentation for new features will arrive soon.
See you on phratch.com

Smalltalk Jobs - Smalltalk Jobs – 10/17/2014

Two ads for the same job for 5+ years of java/agile/etc.  Needs English.  Located somewhere in Germany but the location is unspecified.

cwjobs

Jobserve


Filed under: Employment

October 16, 2014

Torsten Bergmann - PharoNOS - Pharo No Operating System

Booting Pharo as OS with only 55MB ISO image. Read more and take care where you use it (best on a virtual platform to not to erase disks)

Ricardo Moran - Programmable Minecraft: coding at runtime

Hello everyone! The Programmable Minecraft project is progressively growing and I’d like to share its current status with you today.

We polished the interaction mechanisms we had designed earlier, so we could begin to “expose” the code involved. Users can now carry out a few basic tasks (such as placing a block of a specific kind on a determinate position of the world). While only a very reduced number of interactions have been incorporated into the project until now, the number of applications these have is huge.

An example of application is the generation of structures of enourmous size and complexity. What would manually take days (or even weeks) can be achieved through simple algorithms in a few minutes.

Here are a few screenshots of some structures we’ve been generating to test the project:

Sierpinski Triangle

Dragon Curve

Archimedean Spiral

¡Hola a todos! El proyecto de Minecraft Programable avanza poco a poco, y vengo a compartirles su estado actual:

Puliendo un poco los mecanismos de interacción desarrollados inicialmente, comenzamos a “exponer” el código útil para dicha interacción. Ahora es posible para los usuarios realizar algunas acciones básicas mediante código (como colocar un bloque en una determinada posición del mundo). Si bien se ha incorporado un número muy pequeño de interacciones, los resultados alcanzables mediante ellas son prácticamente ilimitados.

Aquí hay algunos screenshots de las estructuras que hemos generado para probar al proyecto:

Sierpinski Triangle

Dragon Curve

Archimedean Spiral

Noury Bouraqadi - Controlling robots with PhaROS

An example of a robotic guide at Ecole des Mines de Douai. Controlling robot with PhaROS from jannik Laval on Vimeo.

Nicolas Petton - Interview with Johan Degerfeldt

Oct 16, 2014

Two months ago I moved to Stockholm, working full-time at Företagsplatsen as a software engineer. Företagsplatsen (or FTGP for short as we call it) is a really fun IT company to work at, I really enjoy the people and the culture. Just like I did with my previous job at Inria, I decided to do another series of interviews of my colleagues at FTGP.

As the CEO of the company, it only made sense to interview Johan first. I guess Johan looks like what we imagine of a viking: tall, light hair and a beard, but he is definitely more talkative than the average Swedish guy. He’s half of the time joking around and the other half really serious talking business and stuff, making him a really cool guy to work with.

Read the interview

Torsten Bergmann - Pharo 4 progressing

Pharo 4.0 is not yet released but progressing. Beside many many other stuff some of the interesting things include:


Pharo News - Pharo Consortium: New Gold Member LabWare

<p>The Pharo Consortium is very happy to announce that LabWare has joined the Consortium as a Gold Industrial Member. </p> <p>About LabWare: &quot;LabWare is recognized as the global leader in providing enterprise scale laboratory automation solutions. Our Enterprise Laboratory Platform combines the award-winning LabWare LIMS™ and LabWare ELN™, a comprehensive and fully integrated Electronic Laboratory Notebook application, which enables companies to optimize compliance, improve quality, increase productivity and reduce costs. LabWare is a full service provider offering software, professional implementation services and validation assistance, training, and world class technical support to ensure our customers get the maximum value from their LabWare products.&quot;</p> <ul><li> LabWare: <a href="http://www.labware.com">http://www.labware.com</a></li><li> Pharo Consortium: <a href="http://consortium.pharo.org">http://consortium.pharo.org</a></li></ul> <p>The goal of the Pharo Consortium is to allow companies to support the ongoing development and future of Pharo. Individuals can support Pharo via the Pharo Association: <a href="http://association.pharo.org">http://association.pharo.org</a></p>

Pharo News - Pharo Consortium: New Gold Member LabWare

<p>The Pharo Consortium is very happy to announce that LabWare has joined the Consortium as a Gold Industrial Member. </p> <p>About LabWare: &quot;LabWare is recognized as the global leader in providing enterprise scale laboratory automation solutions. Our Enterprise Laboratory Platform combines the award-winning LabWare LIMS™ and LabWare ELN™, a comprehensive and fully integrated Electronic Laboratory Notebook application, which enables companies to optimize compliance, improve quality, increase productivity and reduce costs. LabWare is a full service provider offering software, professional implementation services and validation assistance, training, and world class technical support to ensure our customers get the maximum value from their LabWare products.&quot;</p> <ul><li> LabWare: <a href="http://www.labware.com">http://www.labware.com</a></li><li> Pharo Consortium: <a href="http://consortium.pharo.org">http://consortium.pharo.org</a></li></ul> <p>The goal of the Pharo Consortium is to allow companies to support the ongoing development and future of Pharo. Individuals can support Pharo via the Pharo Association: <a href="http://association.pharo.org">http://association.pharo.org</a></p>

Smalltalk Jobs - Smalltalk Jobs – 10/15/14

Good luck with your job hunting,
James T. Savidge

View James T. Savidge's profile on LinkedIn

This blog’s RSS Feed


Filed under: Employment Tagged: jobs, Smalltalk, Smalltalk jobs

October 14, 2014

ESUG news - CfP Smalltalk Devroom at FOSDEM 2015.

Call for Participation in the Smalltalk Devroom at FOSDEM 2015. http://www.fosdem.org

A devroom for the Pharo, Squeak, Amber, GST, Etoilé, Seaside, Moose Smalltalk projects & Objective Smalltalk and Newspeak as derived languages. Smalltalk environments offer a very high development productivity, unmatched by their successors. Come do some pair programming with us and experience yourself the advantages of a real OO environment"

The meetup will take place Sunday, February 1, 2015, room S.H.2214. This room has 100 seats, a VGA video projector and wireless internet. Presentations will be video recorded (CC BY).

Proposals on content and format are welcome.

HOW TO SUBMIT:

All submissions are made in the Pentabarf event planning tool at

https://penta.fosdem.org/submission/FOSDEM15

When submitting your talk in Pentabarf, make sure to select the 'Smalltalk devroom' as the 'Track'.

If you already have an account there, please reuse it.

QUESTIONS & VOLUNTEERS

Any questions, and video volunteers, please mail to

stephan[@]stack[dot]nl

with [FOSDEM] in the subject. I will send out updates on a regular basis to the lists and anyone stating his interest.

PLANNED SCHEDULE:

Sessions of 30/60 minutes (-5 min setup), last session a two hour hands-on introduction to smalltalk. First session or lunch session can be show-us-your-project, lightning talks.

The desired time slot is meant to help you prevent conflicts with other dev rooms in which you might have a talk or your travel arrangements.

There are alternative, non smalltalk-specific tracks available: lightning talk and the main track

Please submit before December 1, 23:00 GMT+1.  

Devroom related URLs:

FOSDEM is the Free and Open source Software Developers' European Meeting, a free and non-commercial two-day weekend event that offers open source contributors a place to meet, share ideas and collaborate.

October 13, 2014

Hernán Morales Durand - Application Security 2: The CheckPoint Protocol

Introduction

As commented in my previous post, CheckPoint is a security pattern to avoid unauthorized access to a system.

The nice idea of the design pattern is to delegate complex validation behavior into specific classes which can manage events, response actions and statistics, completely transparent to your application. CheckPoints could be used to bypass validations for specific cases too. For example if you are debugging or testing your application, you don't want to be constantly bothered by timeouts and logins, you don't want to bias security statistics, and certainly you don't want to debug into someone's new bug merged in your repository, in the middle of your workflow.

The following sections describe how to use core classes for a typical application scenario.

Basic workflow

Let's assume an application is globally represented by a Singleton class, and it has different states. An state could be "in deployment mode" or "in testing mode". Each of these "modes" contain behaviors, implemented in specific CheckPoint subclasess. This simply means, you can use a Global Application class to answer a default CheckPoint class for your needs.

An example: Our Singleton manages application's state, and so it could be asked which CheckPoint should be assigned to each user, at a specific scenario he is in. This is, CheckPoint instances are associated to user sessions. Initially all newly created users will have a "invalid" or "unregistered" state. When the user begins the registration process, its session is given a CheckPoint instance to behave accordingly.

From here two different security scenarios are possible, depending on the registration state. Each scenario is represented by a CheckPoint subclass:

ASRegisterCheckPoint : Should be assigned while the (candidate) user is not confirmed as user. Maintains a registration object (ASUserRegistration), responsible to hold an unique link identifier, the registration time, and the corresponding candidate instance (ASCandidateUser). To optimize resources, a candidate user manages expiration (#hasExpiredRegistration) and that's a reason why is important to keep a #registrationDate.

ASDeployCheckPoint: This is a "common" CheckPoint which should be used for production systems, and when a registered user signs-in a system. It checks against typical login conditions, which we will se below in the Using the CheckPoint section.

Registering Users

Before anything else, create a repository and mock user to play with:

| cp newRegId |
cp := ASRegisterCheckPoint new.
newRegId := cp registrationId.
cp addNewUser: (ASCandidateUser new
entityName: 'alphabetic name';
username: 'alpha3';
password: 'alphanumeric123';
registrationId: newRegId;
yourself).
Trying to add another candidate with the same username will raise an ASUserExists exception. Ideally you should catch and handle it appropiately in the context of your application. You can now query if you can register this candidate:

cp isValidPendingRegistrationId: newRegId.
and register as valid user in your system:

cp registerCandidateAsUser: newRegId.

Using the CheckPoint

Continuing with the Session-based example, login code which uses the CheckPoint could ask for the current user CheckPoint, and perform a global validate and retrieve:

user := self checkPoint
loginUserNamed: 'myuser'
password: 'anypassword'
machine: '0.0.0.0'.
The message send performs three major steps:
  • Validate authentication settings for the provided parameters
  • Validate if passwords match.
  • Answer the user from the repository
You can also chain exceptions to manage fail conditions, logging messages or block an user:

loginExceptions
^ ASEmptyError , ASInvalidUsername , ASEntityNotFound , ASPasswordError , ASMaxUserFailCountError
, ASMaxMachineFailCountError , ASMaxGlobalFailCountError , ASDenegatedAccess
and manage the exception properly:

[ cpUser := self checkPoint loginUserNamed: usernameString password: passwordString machine: '0.0.0.0' ]
on: self loginExceptions
do: [ :ex | ^ self handleFailedLogin: ex ].

CheckPoint verifications

Login an user should perform a number of checks which, many times, are application security specific. The default implementation is naive, but useful for many cases. For specific security requirements, validation settings are customizable by subclassing ASDeployCheckPoint and specializing the method #validateAuthSettingsLogin:password:machine:. This is how looks like as in the current release:


(userString isEmpty or: [ userString isNil ])
ifTrue: [ ^ ASEmptyError signal: 'Username' ].

(passwordString isEmpty or: [ passwordString isNil ])
ifTrue: [ ^ ASEmptyError signal: 'Password' ].

(self isValidIpAddress: ipAddressString)
ifFalse: [ ^ ASDenegatedAccess signal ].

(self validationSettings allowedUsernameCharacters includesAllOf: userString)
ifFalse: [ ^ ASInvalidUsername signal: 'Invalid characters ' , userString ].

(self validationSettings allowedPasswordCharacters includesAllOf: passwordString)
ifFalse: [ ^ ASPasswordError signal: userString ].

(Remember, this is not code checking on User-Agent side, this is Application Security so your application's security can be guarantee independently of UI code).

A first look at Validation Settings

If you have ever worked with an Expert System, you already know what a Rule-Base is, and probably have figured out that all verifications could be easily written using rules. Although currently Application Security does not use rules, it seems a good point to note the direction where our model should be going to (if you want to read a really cool chapter about Rules-Based Expert Systems, try the one from Robbie T. Nakatsu in Diagrammatic Reasoning in AI)

Validation setting objects are maintained by CheckPoints and useful during registration time. They notify authorization/authentication exceptions and answer limit settings like:

  • Maximum size for characters allowed for a user name.
  • Maximim size for characters allowed for a password.
  • Characters allowed by a password.
  • characters allowed by an user name.
  • Expiration days for a password.
  • Valid IP addresses

As they are CheckPoint specific, they could be changed at run-time for an user or a group of users, which is very handy for debugging purposes. And that's all for today, in the following post I will post how to set up password rules to customize validation settings. See you soon.

October 12, 2014

Göran Krampe - Here Comes Nim!

I just posted an article comparing some silly benchmarks between Cog Smalltalk and LuaJIT2. Now... let's take a look at one of the latest "Cool Kids" on the language front, Nimrod - or as it has been renamed - Nim.

So I love programming languages. But generally I have preferred dynamically typed languages because I have felt that the static type systems that we have suffered with for the last ... 25 years or so has basically been completely awful. Perhaps not in implementation performance, but definitely in developer productivity and enabling good quality code.

Working in say Smalltalk has been like roaring free in the skies instead of crawling in the mud with C++, well, you get my point. I still recall one of the first 30 line "programs" I wrote in Smalltalk, just quickly jotted it down - and it ran perfectly at the first try. I attributed that to the concise language and "noise free" code (no static type noise!). My first stumblings in C++? Ha! Its not even funny.

But I have never been against static type information per se - I mean, its just a question of what we need to tell the compiler... so if we can have a type system that can reason around my code at compile time without bogging me down in endless typing and convoluted code that is hard to change and refactor and hard to read and hard to write... argh! Then yes, by all means.

Many new statically typed languages have started incorporating type inference. I haven't really worked with them, Haskell is perhaps one of the best known. Dart is a dynamically typed language but instead opted to adding mechanisms for static type annotation in order to help on the tooling front, a clever idea IMHO.

Rust, Go and... Nim!

In another article I wrote about Rust and Go (and more) - two new, popular and very interesting statically typed languages. But I admit that I totally missed Nim! Previously known as Nimrod, ehrm. And yes, Nim does have type inference, although to a balanced extent.

Just like LuaJIT2 has been a "Tour de Force" of a single author, so has Nim - and that is interesting in itself. I would say it has been a pattern over the years with most successful open source languages.

Ok... so enough chit chatting, let's look at that silly benchmark I played with earlier - in Gang Nim Style:

Nim silly benchmark
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
</p>

<h1>Import times for time measurements and future for some upcoming features (naked lambdas)</h1>

<p>import times, future</p>

<h1>Just a recursive function, the astute reader notes that we declare a return type of int64</h1>

<p>proc benchFib(fib) :int64 =
  if fib &lt; 2:</p>

<pre><code>return 1
</code></pre>

<p>  else:</p>

<pre><code>return 1 + benchFib(fib-1) + benchFib(fib-2)
</code></pre>

<h1>Trivial helper to measure time, discard is used to show we ignore the return value</h1>

<p>proc timeToRun(bench) :float =
  var start = epochTime()
  discard bench()
  epochTime() - start</p>

<h1>And this is the bytecode benchmark translated from Squeak</h1>

<p>proc benchmark(n) :int =
  const size = 8190
  var flags: array[1..size, bool]
  for j in 1..n:</p>

<pre><code>result = 0
# Clear all to true
for q in 1..size:
  flags[q] = true
for i in 1..size:
  if flags[i]:
    let prime = i + 1
    var k = i + prime
    while k &lt;= size:
      flags[k] = false
      inc(k, prime)
    inc(result)
</code></pre>

<h1>And echo the time to run these two, note the naked lambda syntax "() => code"</h1>

<h1>The "&amp;" is string concatenation. The $ before timeToRun is "toString"</h1>

<p>echo($timeToRun(() => benchmark(100000)) &amp; " bytecode secs")
echo($timeToRun(() => benchFib(47)) &amp; " sends secs")

Whoa! Look at that code! I mean... it looks like Python-something! And not much static type noise going on, in fact there are only 4 places where I specify types - the three return types of the three procs, and I also specify that the array has bools in it. That's it.

If you recall the numbers from LuaJIT2:

10.248302 bytecode secs
26.765077 send secs

...and Cog:

49.606 bytecode secs
58.224 send secs

...then Nim mops the floor with them:

2.6 bytecode secs
7.6 sends secs

So Nim is about 4x faster on bytecode speed and 3x faster on recursive calls compared to LuaJIT2. And about 20x faster on bytecode speed and 8x faster on recursive calls compared to Cog.

A few things of note:

  • The Nim code is just as small and readable as the Lua and Smalltalk code.
  • The brute speed comes from shoulders of giants, GCC. But it also means that the generated code is fairly C-friendly, which is fascinating given the depth of this language.
  • I used a few extra features; const for the size, let for prime (non assignable var), inc() for incrementing variables - but all these didn't affect the numbers much, it was just fun to try to make it more Nimiomatic.
  • The above little snippet compiles in 0.2 seconds to a 67kb executable on Linux using the short command "nimrod c -d:release test.nim". Nice!

Conclusion

I wrote this as a teaser - Nim is actually a brutally darn cool language. Lots of people seem to prefer it over Rust - and it has a "pragmatic" soul - Rust on the other hand is very focused on safety, safety, safety. Nimrod is more focused on developer productivity. And it has a lot of nice stuff:

  • Written all in itself, clean and nice bootstrap.
  • Compiles via C (or C++/ObjC) which gives it very good performance, platform independence and integration with C/C++/ObjC etc.
  • Has a very neat modules system
  • Has lots of really, really interesting language features. Sure, a bit featuritis perhaps - but I am not judging just yet.
  • ...and well, I just can't go through it all here! Its too much!

I would say that if you are thinking of perhaps taking a peek at the "Dark Side" (static typing) - then this is it. I think Nim will make you smile in more ways than one.

Göran Krampe - Cog vs LuaJIT2

In the open source Smalltalk community we have a pretty fast VM these days - its called Cog and is written by the highly gifted and experienced Eliot Miranda who also happens to be a really nice guy! Cog is fast and its also still improving with some more developers joining recently.

Another very fast VM is LuaJIT2 for the Lua language (version 5.1), also written by a single individual with extraordinary programming talent - Mike Pall. LuaJIT2 is often mentioned as the fastest dynamically typed language (or VM) and even though Lua is similar to Smalltalk (well, its actually very similar to Javascript) its also clearly a different beast with other characteristics. If you start looking at the world of game development - then Lua appears everywhere.

I am a language lover but I admit to having only glanced at Lua earlier and wrongfully dismissed it in the category of "less capable and quirky languages". Now that I have looked closer I realize its a similar "hidden gem" as Smalltalk is! And just as Smalltalk was given a boost of interest when Ruby hit the scene - I guess Lua gets an influx now with the Javascript craze. And the gaming world keeps infusing it with fresh code.

Lies and, well basically just lies...

In Squeak Smalltalk we have this silly little benchmark called tinyBenchmarks. It's not for benchmarking. No, let me repeat that - it really is not.

But hey, let's just ignore that for a second. :) And oh, comparing Lua vs Smalltalk - speed is only a tiny piece of the picture - there are other much more interesting characteristics of these two eco systems that would affect any kind of "choice":

  • Smalltalk implementations typically have live reflective rich IDEs, and excel at complex domain models and interactive explorative development. And very clean late bound OO. Not so good at "playing well with others" though.
  • Lua, and especially LuaJIT, is extremely good at playing with others - and specifically the C/C++ eco system. As a more traditional scripting language you have more choices in IDEs and SCM tools etc, but it is not as interactive and exploring as Smalltalk and is not focused at OO specifically, although it can do it pretty good. It does however have several good IDEs, but hardly anything matching a Smalltalk IDE.

So Smalltalk excels in interactive development - but you are often limited in integration options... while Lua excels as a dynamic language thriving as a catalyst in the C and C++ eco system.

These languages and their tools were simply born from two very different sets of goals. And Lua is also different from say Python, since Lua in contrast was designed as a minimal language (in many ways like Smalltalk was) and a language meant for embedding in a C/C++ application (almost no batteries included). This carves out a fairly unique niche for Lua.

Ok, so back to tinyBenchmarks. It consists of two small snippets of code, one measures "bytecode speed" by counting primes in a few nested loops and another is a recursive function similar to Fibonacci that just counts the number of recursive calls. Ok, so... latest Cog (binary VM.r3000) vs latest LuaJIT2 (2.1.0-alpha), here follows the Lua code I whipped up. I tried basically three different variants on the Fibonacci recursion to see how much penalty an OO design would give.

Lua silly benchmark
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
local class = require("classy")</p>

<p>-- First here is how you would do it in proper Lua, just a recursive function
local function benchFib(fib)
  if fib &lt; 2 then</p>

<pre><code>return 1
</code></pre>

<p>  end
  return 1 + benchFib(fib-1) + benchFib(fib-2)
end</p>

<p>-- Or using a metatable for a bit more manual OO style
local Bench = {}
Bench.__index = Bench</p>

<p>-- A constructor
function Bench.new()
  local bench = {}
  setmetatable(bench, Bench)
  return bench
end</p>

<p>-- And a method in it
function Bench:benchFib(fib)
  if fib &lt; 2 then</p>

<pre><code>return 1
</code></pre>

<p>  end
  return self:benchFib(fib-1) + self:benchFib(fib-2) + 1
end</p>

<p>-- A variant using the "Classy" OO lib. Another popular is called "MiddleClass"
local Benchy = class("Benchy")</p>

<p>-- And a method in it
function Benchy:benchFib(fib)
  if fib &lt; 2 then</p>

<pre><code>return 1
</code></pre>

<p>  end
  return self:benchFib(fib-1) + self:benchFib(fib-2) + 1
end</p>

<p>-- And this is the bytecode benchmark translated just as it says in Squeak
local function benchmark(n)
  local size = 8190
  local count = 0
  for j=1,n do</p>

<pre><code>count = 0
local flags = {}
for q=1,size do
  flags[q] = true
end
for i=1,size do
  if flags[i] then
    local prime = i+1
    local k = i + prime
    while k &lt;= size do
      flags[k] = false
      k = k + prime
    end
    count = count + 1
  end
end
</code></pre>

<p>  end
  return count
end</p>

<p>-- Return seconds to run fn
local function timeToRun(fn)
  local start = os.clock()
  fn()
  return os.clock() - start
end</p>

<p>t1 = timeToRun(function() benchmark(100000) end)
t2 = timeToRun(function() benchFib(47) end)
t3 = timeToRun(function() Bench.new():benchFib(47) end)
t4 = timeToRun(function() Benchy():benchFib(47) end)</p>

<p>print(t1 .. ' bytecode secs')
print(t2 .. ' benchFib send secs (normal Lua)')
print(t3 .. ' Bench send secs (OO Lua)')
print(t4 .. ' Benchy send secs (OO Lua Classy)')

And the Smalltalk code would be:

Squeak silly benchmark
1
2
Transcript show: ([100000 benchmark] timeToRun / 1000.0) asString, ' bytecode secs';cr.
Transcript show: ([47 benchFib] timeToRun / 1000.0) asString, ' send secs';cr@

I picked 100000 and 47 to get fairly long running times, so LuaJIT:

10.248302 bytecode secs
26.765077 benchFib send secs (normal Lua)
70.418739 Bench send secs (OO Lua)
71.003568 Benchy send secs (OO Lua Classy)

...and Cog:

49.606 bytecode secs
58.224 send secs

So LuaJIT2 is about 4x faster on bytecode speed and 2x faster on recursive calls.

But wait, lots of things to note here:

  • These are two trivial benchmarks meant to detect really bad regressions in VM code, not benchmarking.
  • The above. Read it again.
  • A recursive function call in Lua is not the same thing as a message send with full OO lookup in Cog. If we look at Bench and Benchy we see that 2x factor vanish!
  • Integer math is clearly different in Lua vs Smalltalk. Lua does doubles only, Smalltalk has a full math system falling back to "big ints" when needed!
  • Using Classy was the same speed as manual metatable approach. So in Lua you would definitely use such a lib instead of manual OO, much easier and with nice features.
  • And oh, both grabbed a single core by the throat doing this - Cog even managed to squeeze out 104%! :)

Conclusion

There is no real conclusion from the silly benchmark - it was just a fun exercise! I already knew Cog is pretty darn fast and LuaJIT is the King of the Hill - it even beats V8 regularly. Cog on the other hand is executing a much more refined and advanced language and object system, you really do need to keep that in mind here.

But I hope that especially Smalltalkers might get intrigued by this article and find Lua interesting. To me its much nicer than Javascript. Its also the first time in many years that I have found a language that actually can keep my interest for a longer period - despite me constantly comparing it with my beloved Smalltalk.

Python could never keep me interested, although I did try - but it kept turning me off, so unclean, lots of different mechanisms, too complicated. Same story with Ruby, too messy, no elegance and a community drug crazed with nifty tricks... IMHO.

But Lua has that smallness that Smalltalk has, it feels "designed". It has strong abstractions that it carries through all the way. In short it doesn't turn me off. And then, a lot more in this eco system is pure candy. LuaJIT2 has awesome speed. Very powerful interoperability with C and C++, in fact, the LuaJIT FFI can call C libraries as fast as C can! Tons of good libraries and tools. Very strong on mobile development. Many interesting projects like TurboLua, Tarantool, OpenResty, Lapis, Metalua etc etc.

Always nice to realize that there still is stuff out there that can attract an old Smalltalk dog... :)

October 10, 2014

Pharo Weekly - Another iteration follows another one

I’m always fascinated by the fact that when we do something every day, at the end we improved, changed, ….

40295
14201 RBAssignmentOnBlockArgumentRule does not catch all assignments to block args

https://pharo.fogbugz.com/f/cases/14201

13174 Should warn against creating class #NameOfSubclass

https://pharo.fogbugz.com/f/cases/13174

14207 failing test testBehaviorRespectsPolymorphismWithTraitBehavior

https://pharo.fogbugz.com/f/cases/14207

14209 add back #allUnimplementedCalls

https://pharo.fogbugz.com/f/cases/14209

14206 remove empty RBRenameInstanceVariableRefactoringTest

https://pharo.fogbugz.com/f/cases/14206

7291 Creating a class with empty category should be an error

https://pharo.fogbugz.com/f/cases/7291

40294
11243 Class>>copy does not preserve layout

https://pharo.fogbugz.com/f/cases/11243

14099 SmalllintManifestChecker duplicates RBSmalllintChecker>>#run

https://pharo.fogbugz.com/f/cases/14099

40293
14098 allClassesAndTraits significantly different from allClassesAndTraitsDo:

https://pharo.fogbugz.com/f/cases/14098

40292
14196 Do not use workspace as an editor

https://pharo.fogbugz.com/f/cases/14196

14086 RBSmalllintChecker is not applying rules in class-side

https://pharo.fogbugz.com/f/cases/14086

14133 UIManager should not overuse the workspace for editing

https://pharo.fogbugz.com/f/cases/14133

14195 In the ChangeSorter: DNU when trying to get a menu

https://pharo.fogbugz.com/f/cases/14195

14199 RBFindBlockArgumentAssignment is sometimes wrong

https://pharo.fogbugz.com/f/cases/14199

40291
14189 OCSemanticWarning does not need #interactive

https://pharo.fogbugz.com/f/cases/14189

13588 Rename inst var should rename accessors too

https://pharo.fogbugz.com/f/cases/13588

14166 RectangleTest#testPointNearestTo failing since 40283

https://pharo.fogbugz.com/f/cases/14166

40290
14183 Update Zn October 2014

https://pharo.fogbugz.com/f/cases/14183

40289
14191 Add #deselectAll to TreeModel

https://pharo.fogbugz.com/f/cases/14191

14188 DNU when moving a method to a package

https://pharo.fogbugz.com/f/cases/14188

14187 Replace Announcer>>#on:send:to:s senders in Keymapping-Pragmas

https://pharo.fogbugz.com/f/cases/14187

14184 Replace Announcer>>#on:send:to:s senders in GroupManager

https://pharo.fogbugz.com/f/cases/14184

14185 Replace Announcer>>#on:send:to:s senders in Kernel

https://pharo.fogbugz.com/f/cases/14185

14186 remove AllowBlockArgumentAssignment from CCompilerContext

https://pharo.fogbugz.com/f/cases/14186

40288
14175 GTools version 1.0.6

https://pharo.fogbugz.com/f/cases/14175

40287
14179 deprecate the method in UIManager “deprecated” category

https://pharo.fogbugz.com/f/cases/14179

14162 Replace Announcer>>#on:send:to:s senders in Morphic-Widgets-Tree

https://pharo.fogbugz.com/f/cases/14162

14173 remove #allowBlockArgumentAssignment preference

https://pharo.fogbugz.com/f/cases/14173

40286
14154 GTools version 1.0.5

https://pharo.fogbugz.com/f/cases/14154

40285
14161 Replace Announcer>>#on:send:to:s senders in Morphic-Widgets-Windows

https://pharo.fogbugz.com/f/cases/14161

14169 There are undeclared in Zinc in Pharo4

https://pharo.fogbugz.com/f/cases/14169

14146 Disable “store into argument”-exception in non-interactive mode

https://pharo.fogbugz.com/f/cases/14146

40284
13905 entering non existing issue numbers in slice maker

https://pharo.fogbugz.com/f/cases/13905

14164 using exampleWidget and not widgetExample

https://pharo.fogbugz.com/f/cases/14164

13088 Deleting class that is used in pool dictionaries leaves a “private” class pool entry

https://pharo.fogbugz.com/f/cases/13088

40283
14159 Update Fuel

https://pharo.fogbugz.com/f/cases/14159

14155 Replace Announcer>>#on:send:to:s senders in Morphic-Widgets-Extra

https://pharo.fogbugz.com/f/cases/14155

14131 Improving some little tests in the system

https://pharo.fogbugz.com/f/cases/14131

14117 merge menuSpec and menuItemSpec

https://pharo.fogbugz.com/f/cases/14117

40282
14119 Cleaning left over of docking bar in menu

https://pharo.fogbugz.com/f/cases/14119

40281
14153 Replace Announcer>>#on:send:to:s senders in Morphic-Base

https://pharo.fogbugz.com/f/cases/14153

14150 Replace Announcer>>#on:send:tos senders in Morphic-Core

https://pharo.fogbugz.com/f/cases/14150

14149 IRDecompiler creates an extended method state object for all methods

https://pharo.fogbugz.com/f/cases/14149

14147 add Symbolic tab to inspector for IRMethod

https://pharo.fogbugz.com/f/cases/14147

40280
14145 GTools version 1.0.4

https://pharo.fogbugz.com/f/cases/14145

40279
13719 Failing test: RBRemoveClassTest>>#testRemoveClass

https://pharo.fogbugz.com/f/cases/13719

14144 unify #usePolymorphDiffMorph and #polymorphDiffToolsUsedByDefault

https://pharo.fogbugz.com/f/cases/14144

40278
13718 Failing test: RBExtractMethodTest>>#testExtractMethodThatMovesTemporaryVariable

https://pharo.fogbugz.com/f/cases/13718

13222 HDLintReport generates invalid output

https://pharo.fogbugz.com/f/cases/13222

12774 DialogGroupAdderUI “item to add” list should be sorted, has superfluous periods after class names

https://pharo.fogbugz.com/f/cases/12774

14134 ecompletion raises DNU for some input

https://pharo.fogbugz.com/f/cases/14134

40277
14082 Remove very old repositories in ScriptLoader

https://pharo.fogbugz.com/f/cases/14082

14138 Nautilus Refactoring 9: rename “showPackages”

https://pharo.fogbugz.com/f/cases/14138

14136 Replace senders of Announcer>>#on:send:to in Versionner-Spec-Browser

https://pharo.fogbugz.com/f/cases/14136

40276
14128 “Print it” from Playground menu does not work

https://pharo.fogbugz.com/f/cases/14128

14117 merge menuSpec and menuItemSpec

https://pharo.fogbugz.com/f/cases/14117

14113 WorldSate stepList not properly cleaned when a morph is deleted

https://pharo.fogbugz.com/f/cases/14113

13641 Merge Package Key into package System-Platforms

https://pharo.fogbugz.com/f/cases/13641

14099 SmalllintManifestChecker duplicates RBSmalllintChecker>>#run

https://pharo.fogbugz.com/f/cases/14099

40275
14129 Use Announcer>>#when:send:to: in Spec-Debugger

https://pharo.fogbugz.com/f/cases/14129

14124 Remove SystemAnnouncer subclass NautilusAnnouncer

https://pharo.fogbugz.com/f/cases/14124

14126 Remove SystemAnnouncer subclass GroupAnnouncer

https://pharo.fogbugz.com/f/cases/14126

10148 IRVisitor and IRInterpreter

https://pharo.fogbugz.com/f/cases/10148

40274
14125 Remove SystemAnnouncer subclass TestAnnouncer

https://pharo.fogbugz.com/f/cases/14125

14122 Classes in Morphic-Examples should include real #example methods

https://pharo.fogbugz.com/f/cases/14122

12973 ChangeSorter CMD-W with menu open causes error

https://pharo.fogbugz.com/f/cases/12973

14120 decompiler view for GTInspector

https://pharo.fogbugz.com/f/cases/14120

40273
14123 removed backgroundColor, fixed playgroundpage>>contents

https://pharo.fogbugz.com/f/cases/14123

40272
13931 Integrate GTools

https://pharo.fogbugz.com/f/cases/13931

40271
14100 use Announcer>>#when:do: and Announcer>>#when:send:to in Spec-Core

https://pharo.fogbugz.com/f/cases/14100

14116 RGDefinition is mispelled and its comment doesnt make sense

https://pharo.fogbugz.com/f/cases/14116

14101 Use Announcer>>#when:send:to: in Spec-MorphicAdapters

https://pharo.fogbugz.com/f/cases/14101

14102 Use Announcer>>#when:send:to: in Spec-Tools

https://pharo.fogbugz.com/f/cases/14102

12841 #testDebuggerTempAccess failures

https://pharo.fogbugz.com/f/cases/12841

40270
14115 Merge RGDefinition and RGNamedDefinition

https://pharo.fogbugz.com/f/cases/14115

14114 use SizeMismatch, not just #error

https://pharo.fogbugz.com/f/cases/14114

13518 Strange color and wrong positions in the Find & Replace dialog

https://pharo.fogbugz.com/f/cases/13518

40269
14111 Handle isInDockingBar conditional logic

https://pharo.fogbugz.com/f/cases/14111

40268
14112 Hook decompiler into source access logic

https://pharo.fogbugz.com/f/cases/14112

14014 translatedIfCorresponds

https://pharo.fogbugz.com/f/cases/14014

14110 Remove RGObject

https://pharo.fogbugz.com/f/cases/14110

40267
14090 use Announcer>>#when:do: in packages Announcements

https://pharo.fogbugz.com/f/cases/14090

14103 Use Announcer>>#when:send:to: in Spec-Inspector.

https://pharo.fogbugz.com/f/cases/14103

14087 use Announcer>>#when:send:to in packages Announcements

https://pharo.fogbugz.com/f/cases/14087

14095 use Announcer>>#when:send:do: and Announcer>>#when:do: in AnnouncementsTutorial

https://pharo.fogbugz.com/f/cases/14095

40266
13864 Deleting last tab removes the toolbar and we cannot add tabs anymore

https://pharo.fogbugz.com/f/cases/13864

14088 procotol -> protocol

https://pharo.fogbugz.com/f/cases/14088

13607 Remove iVar MorphicModel: accessor

https://pharo.fogbugz.com/f/cases/13607

40265
14105 Nautilus Refactoring 8.5: rename “showHierarchy”

https://pharo.fogbugz.com/f/cases/14105

12826 Zip FileSystem does not work

https://pharo.fogbugz.com/f/cases/12826

40264
13867 MessageBrowser does not inform about certain syntax error

https://pharo.fogbugz.com/f/cases/13867

13293 We should add definedSelectors and extensionSelectors to ClassDescription

https://pharo.fogbugz.com/f/cases/13293

13934 Extra characters in string returned by String class>>new:streamContents:

https://pharo.fogbugz.com/f/cases/13934

40263
13742 PluggablePanelMorph looks empty and is only used once in the system

https://pharo.fogbugz.com/f/cases/13742

14094 Deprecate a few unused String methods

https://pharo.fogbugz.com/f/cases/14094

13337 Moving a class to a package does not work anymore

https://pharo.fogbugz.com/f/cases/13337

13331 moving a group of methods class side raises an error

https://pharo.fogbugz.com/f/cases/13331

11475 Optimize FuelTests >> #tearDownTraits

https://pharo.fogbugz.com/f/cases/11475


October 09, 2014

Ricardo Moran - Congreso + Decálogo para utilizar y disfrutar Etoys

¡Hola, amigos!

Espero que anden bien. Voy a dividir el post en dos:

La primer parte se trata de nuestra participación en el congreso de tecnología informática organizado por la UAI (CIITI 2014).

El congreso estuvo muy interesante y mostramos nuestros desarrollos en un stand. Además, Gonzalo y Richi dieron dos charlas tituladas Plataforma de Hardware para Robótica Educativa y Plataforma de Programación Physical Etoys dentro del marco de los bloques Robótica Aplicada y Arquitecturas y Desarrollos Tecnológicos Innovadores.

Acá pueden hacer click para agrandar algunos comentarios que nos hicieron por Twitter:

prensa twitter

 

Además, publicamos los pósters que hicimos para el congreso. Si quieren tener una idea bien concreta arcerca de lo que estamos trabajando y qué pretendemos con nuestro trabajo, les recomiendo que los vean:

Poster Mendieta

Poster Minecraft

Poster Physical Etoys

La segunda parte de este post se trata de un documento que armé antes de dar un taller de Etoys hace un tiempo. El mismo se llama decálogo para utilizar y disfrutar Etoys. El mismo está basado en algunas ideas de Alan Kay y en mi experiencia al usar Etoys.

1-La computadora es un instrumento musical cuya música son las ideas. La música no está en el instrumento sino en los docentes y en los alumnos.

2-Si quiero transmitir una idea, tengo que pensar en qué objetos intervienen y cómo colaboran para lograr ese objetivo.

3-La esencia de Etoys es la interacción. Si no hubiera interacción ¿Qué lo diferenciaría de un libro o de unas diapositivas?

4-La metáfora de un mundo vivo que late constantemente en donde el error es algo natural dentro de la programación es poderosísima para programar nuestros objetos.

5-Exploren, construyan y rompan todo si es necesario para aprender. Etoys está para eso.

6-Etoys es transversal a la currícula. No tienen por qué casarse con matemática, física o tecnología. Existen proyectos de música, pintura, literatura y animación.

7-No es lo mismo consultar un valor que asignarlo. Por lo tanto, hay que considerar desde dónde arrastramos a los bloques.

8-Realizar tutoriales, compartir proyectos y sugerir mejoras hace que la experiencia de Etoys sea mejor no sólo en tu escuela sino en todo el mundo. Nada más lindo que enseñarle a un chico a hacer proyectos para que otros chicos puedan aprender una idea. 

9-Utilizar bien Etoys requiere constancia pero por sobre todo humildad. Nosotros guiamos a los chicos pero ellos pueden mostrarnos muchas cosas que descubrieron en sus casas. Más se les enseña, más nos enseñan.

10- Diviértanse. Si no es divertido para ustedes ¿Por qué habría de serlo para los chicos?

Bueno, espero que les sirva esto como guía y que les haya gustado.

Les voy a decir una cosa más: Physical Etoys está más vivo que nunca. Y cierro el post con un video emocionante que nos llegó de la provincia de Salta :D

Que se diviertan!

 

October 08, 2014

Marten Feldtmann - PUM 1.2.59

More work done towards a general REST generator (model and GUI change):

-> Projects may now have a class prefix attribute. This string is added to all created classes

-> Classes may now have “roles”. The code generators may use this “roles” during code generation.

-> Classes/Attributes have now “shadow” objects.

-> Menu entry added to jump directly to the error definition page

-> Menu entry added to create all classes within the model needed to have initial REST support.


Filed under: Smalltalk Tagged: Gemstone, PUM, Smalltalk

Pharo Weekly - Pharo Android VM is now working

Jean-Baptiste Arnaud just announced it…
Now the prototype of the Pharo Android VM works.
- Events are managed
- Resolution up to 1080p is managed.
- Most of the plugins seems to work.
- File plugin allows you to browse the sd card.
Next:
- fix the generator then jenkins. Merge with Pharo/Cog main and Make it available for the public.
- allow easy personalisation of the packaging, allow you to rename and change icon easily (for your own application, Squeak/Pharo Android VM, Phratch, DR geo, etc.).
- refine the jumpout logic to have a better graphical update and a better idle process (less consumption, faster reactive UI, UI updating during heavy computation, etc. ).
- package the android feature in the android plugin, show/hide the keyboard via primitive, etc. etc. + init configuration.
-many cool ideas but for later :)
Here is a youtube video to show the result:

Marten Feldtmann - PUM 1.2.54

Critical Error fixed: when changing the cardinality of an already existing association this change has not been told to the corresponding attribute. This was a structural error in the model. The attribute itselfs does not need to have a cardinality attribute at all. All code places changed where this cardinality has been queried.


Filed under: Smalltalk Tagged: Gemstone, PUM, Smalltalk

October 07, 2014

Marten Feldtmann - PUM 1.2.52

Topaz CG has been changed:

-> it is much better to create a bash script including the source code and put all the connection code to connect to the stone process in there. The only thing you now need within PUM is the defSource file which normally is available for each stone. 2Mb source code is now imported/commited within 40 seconds (without instance migration) – that’s ok


Filed under: Smalltalk Tagged: Gemstone, PUM, Smalltalk

Marten Feldtmann - PUM 1.2.51

Topaz Codegenerator changed and enhanced:

-> optional force Gemstone to forget the class history before filing in

-> optional force Gemstone to enable AutoMigration

-> Topaz script now contains login to a named stone, a user login and a user password

The usage of ordered classes in associations has been stopped. The default behaviour is now the use of unordered classes.

-> the default class for dictionary like associations is now RcKeyValueDictionary

-> the default class for unordered collection associations is now IdentityBag

-> the default class for unordered collection associations (reduced conflicts) is now RcIdentityBag


Filed under: Smalltalk Tagged: Gemstone, PUM, Smalltalk

Pharo Weekly - New version of the QR Code generator

Jochen Rick announced a new version of his QRCode :)

I’ve got a new version of the QR Code generator: http://smalltalkhub.com/#!/~JochenRick/QRCode

This one includes support for MicroQR, for UTF-8 encoding and other aspects of the latest QR standard (e.g., mirroring). I’ve also written a small Zinc web app which makes it easy to try out.
Enjoy!

October 06, 2014

Travis Griggs - Initial Thoughts about Swift

Back in June, Apple announced the new language platform, Swift. I took a brief look at it and then put it aside for the time being. I figured the early adopters could vet things out without me, run around in circles of hysteria for a bit.

Fast forward a few months, iOS 8 and Xcode 6 are both official now, no longer beta. I have a prototype app written in Objective-C, that it's time to kind of do version 2 of. Is now a good time to try and grab hold of the train and jump on? I don't know yet. I'm trying to keep an open mind. Here's a couple of thoughts so far...

Out of Date Information
One of the most difficult bits, is that a lot of the information out there on the web is already slightly (or very) obsolete. Much of the initial traffic generated after the announcement was quick from-the-cuff responses, often just there to generate clicks. Looking for really useful and helpful content, one still must filter through a lot of noise. Hopefully, with time, the ratio will tip in favor of the more useful.

I found this to be very true with the first batch of tutorials that were quick to hit the streets. Most are just so flat out trite, they don't really teach you anything. An app that is a little more than "Hello World" doesn't really teach you much. Furthermore, many of them have issues in their purported source code that prevent you from finishing if you can't figure out what's changed (a common example I saw was issues with the optionals mechanism).

In the end, I found a Tetris game tutorial that I was actually able to complete (Swiftris). As a tutorial it's OK, it has a fun flippant style, and it actually goes through a bit of stuff. And it distinguished itself by not being overly trivial and actually producing a working program. Most of the following thoughts were generated from this tutorial, as well as reading quite a bit of the Apple Swift Docs.

Replacing one Legacy with Another
Back when Craig Federighi announced Swift, one of the catch phrases was "Objective C without the C". Computer language historians will describe Objective-C as a somewhat unholy union of two very different languages: Smalltalk and C. While somewhat effective, it's a weird experience. Being accomplished at both Smalltalk and C, I can personally attest to Objective-C's weirdness. I often giggle when coding Objective-C. In an ideal world, you'd be thrilled at being able to leverage the best of both worlds. But it's usually the case that each is holding the other back in amusing or annoying ways.

So supposedly Apple ditched the C. It's a typed Object Oriented language with a syntax that us more C like than the Smalltalk keyword style. In the end, I'd say they ditched both, and it's just its own language.

But like Objective-C which always had to play fiddle to its C heritage, Swift plays fiddle too. You may see posts pitching things as better or innovative, but what I perceive often is "since we're still using the Cocoa runtime, we had to come up with something." So while C is gone. The Cocoa libraries and runtime are not. And ultimately, Swift has to bend to fit that model. Just like with Objective-C where I would giggle at how C would force something silly into the marriage, I find myself asking "why did they do that??" and usually the answer is "ah, because the Cocoa runtime forced their hand there."

The Law of Conservation of Ugly wins again.

Head Turning Paradigm
One of the things that messed with me at first, is that Swift function signatures are backwards. In C, a function signature/definition might look something like:

  float doSomething(int arg1, double arg2)

Or in a more abstract sense

  returnType functionName(typeQualifier1 argName1, typeQualifier2 argName2)

This is a pretty common pattern in many languages. But in Swift, there's a game of musical chairs that is played so that we end up with things in different order. The equivalent Swift variant is

  func doSomething(arg1: Int, arg2: double) -> float

And put abstractly

  func functionName(argName1:typeQualifier, argName2:typeQualifier2) -> returnType

I don't know how I feel about it. It's different, so it kind of feels fresh and new. OTOH, my brain has spent a lot of years learning how to scan the opposite order, where qualifiers precede what they annotate, rather than post cede them.

:, :, and :
One of the things that makes the C part of Objective-C annoying, is that C with its many years of evolution can often feel complex to parse. You have to look at the context to figure out what a given character does. However, the : character doesn't play to much of a role in C. While cleaning up use of other infix characters, Swift decided to celebrate the : character.

So far, I've counted at least three different uses of this character that I have to press the shift key for (Swift has relegated the easier to type semicolon to near nothingness, using it as a
multiple; statements; on; the; same; line; separator just as in Python).

The first, as shown above, is that it is used in function signatures to "attach" the type of an argument to the back side of it.

The second, is that it can be used when calling a function (or method). It looks subtly, similar to a keyword style invocation.

  Point(x: 4, y: 2)

Yes folks, Swift lets you type not only a comma separated argument list (C style) or a colon delineated keyword list interspersed with arguments (Smalltalk style), but you get to (must) do both! Type out the function name, the parens, the commas, the keywords, and the colons. It's like a politically correct function signature. It's so all inclusive.

What I find particularly disingenuous about the readability of this though, is that it undos what I just got used to. I had decided that : was how I attached annotating information to a keyword (e.g. the type), but here the annotating or qualifying element precedes it.

This is not a show stopper. But what it means is that your brain can't use a simple pattern match to put the pieces together.n You can't see a code and instantly know if you're looking at a function definition or call. Instead you have to parse the surrounding context to figure out what you're seeing.

The third use, is to indicate that a list (array) is not a list, it's a dictionary. Dictionaries and Lists both start and stop with the [ ] characters in Swift, and the elements are separated by commas. But to figure out whether it's a literal Dictionary or List, you'll have to peer inside of it, scanning it's contents to see if you can find a :. If you do find one, then you have a Dictionary. Then please scan back to the beginning to see if it all started with a [ or a (, so you can disambiguate whether it was a function call, or a dictionary.

Keep on open mind, I keep muttering to myself about this one. Maybe some zen unifying principle will befall me eventually, and I'll see the wisdom in the ambiguities.

Wrap, Unwrap, Ugh
Objective-C uses the nil message eating pattern. You can send messages to the nil object, and things don't blow up. It just silently does nothing. It's not really Objective-C per se, it's the implementation of the Objective-C runtime engine. And since that doesn't go away with Swift, they had to allow for that kind of thing with Swift. The solution is to support optional types.

  var TheAnswer:Int? = 42

That says that TheAnswer can be an Int or it can be a nil. Anytime I want to access it though, I have to know that I declared it with a ? and use a ! to get the value out. But if that bothers me too much, I can live a little dangerously and declare it as

  var TheAnswer:Int! = 42

This says that it must be an Int, but it recognizes that until I get it initialized it might not yet be, so I'll have to be careful.

This need to paper over the Objective-C/Cocoa patterns of nil, is one of those cases where I see the legacy as compromising the new. Maybe I'll be wrong and become a big fan of the optionals system. So far though, the compiler is constantly nagging me to add !'s or ?'s here and there. Sometimes, I don't understand entirely why. So I'm not sure it's a productivity winner for me at all yet. We'll see how the lay app developer of iOS apps deals with it.

Refactoring
Finally for now, with all this type goodness, and the improved completion and playground, I was surprised to find that if you highlight a chunk of Swift code and choose the Xcode Refactor menu option, you'll be rewarded with this wonderful message:



Hopefully, we'll see that go away as Apple continues to mainstream its new darling language.