Re: [Pharo-users] [ANN] Teapot was moved to GitHub

2018-11-28 Thread Attila Magyar
Esteban A. Maringolo wrote
> Excellent material.
> I also liked that you not only provided instructions for installation,
> but also to set Teapot as a dependency.
> 
> Please add the `pharo` tag to the repository, so it gets listed in the
> topics section [1] and also helps bumping Pharo topic to the home of
> the Topics page.
> 
> [1] https://github.com/topics/pharo?o=desc=updated
> 
> Esteban A. Maringolo

Yeah, many of these were added by a contributor @fortizpenaloza, so big
thanks to him. 

Sure, I added the tags. 



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



Re: [Pharo-users] [ANN] Teapot was moved to GitHub

2018-11-28 Thread Attila Magyar
Esteban A. Maringolo wrote
> Excellent material.
> I also liked that you not only provided instructions for installation,
> but also to set Teapot as a dependency.
> 
> Please add the `pharo` tag to the repository, so it gets listed in the
> topics section [1] and also helps bumping Pharo topic to the home of
> the Topics page.

Yeah, many of these were added by a contributor @fortizpenaloza, so big
thanks to him.

Sure, I added the tags.




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



[Pharo-users] [ANN] Teapot was moved to GitHub

2018-11-27 Thread Attila Magyar
Hi,

I just want to let you know that the source code of Teapot was moved from
Smalltalkhub to GitHub.

The new repository is located at:

https://github.com/zeroflag/teapot   

Attila



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



Re: [Pharo-users] Teapot and Websockets

2017-09-07 Thread Attila Magyar
Teapot already supports conditional routes, maybe using them instead of
adding the WS: message would be better.

I'm thinking domething like:

Teapot on 
GET: '/chat' -> whatever; when: [:req | req isWebSocket];
start.

or just

Teapot on 
GET: '/chat' -> whatever; when: #isWebSocket
start.

I'll play with this idea sometime.




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



Re: [Pharo-users] Teapot and Websockets

2017-09-07 Thread Attila Magyar
Teapot already supports conditional routes, maybe using them instead of
adding the WS: message would be better.

I'm thinking domething like:

Teapot on 
GET: '/chat' -> whatever; when: [:req | req isWebSocket];
start.

or just

Teapot on 
GET: '/chat' -> whatever; when: #isWebSocket
start.

I'll play with this idea sometime.




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



Re: [Pharo-users] Teapot and Websockets

2017-09-07 Thread Attila Magyar
Hi Georges, 

This is not supported at this moment. If I understand your example correctly
then

WS: '/ws-chatroom'  would match on an incoming WebSocket handshake request
and it would create and return new websocket. The same websocket would be
passed to the handler block for doing additional setup.

But seeing a more complete example would be helpful.



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



Re: [Pharo-users] Teapot and Mustache in Pharo 6?

2017-08-21 Thread Attila Magyar
Hi Hannes,

You can find some examples in the Enterprise Pharo book
(http://files.pharo.org/books/enterprise-pharo/).

Teapot on
   GET: '/greet' -> {'phrase' -> 'Hello'. 'name' -> 'World'};
   output: (TeaOutput mustacheHtml: '*{{phrase}}*
/{{name}}/!'); 
   start.

The {'phrase' -> 'Hello'. 'name' -> 'World'} servers as a model for the
template engine. Imagine that this was returned by some domain logic.

Anyway my preferred way of using Teapot is to use it as a REST (-like)
backend and consume/produce JSON (or whatever) objects, instead of
generating HTMLS on the server side via Mustache.

Attila



--
View this message in context: 
http://forum.world.st/Teapot-and-Mustache-in-Pharo-6-tp4963156p4963167.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Looking for small boards and tiny computers which can run Pharo

2017-07-25 Thread Attila Magyar
The esp32 is not capable of running Pharo unfortunatelly. It's not Linux
based, it has a realtime operating system called FreeRTOS and the amount of
memory it has is also quite limited. It's more like a microcontroller than a
single board computer.



--
View this message in context: 
http://forum.world.st/Looking-for-small-boards-and-tiny-computers-which-can-run-Pharo-tp4956582p4956674.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Why do we separate class/instance methods in the browser?

2017-07-23 Thread Attila Magyar
Maybe if the protocol list was a tree instead of a list then it would make
sense to include the class methods there. This would also make easier to
move methods from class side to instance side or vica versa with simple drag
and drop (without relying on the refactor/move to class side option).



--
View this message in context: 
http://forum.world.st/Why-do-we-separate-class-instance-methods-in-the-browser-tp4956231p4956439.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Teapot and POST:

2017-06-25 Thread Attila Magyar
Hi Stef,

Yeah, I've just sent a pull request.

Attila



--
View this message in context: 
http://forum.world.st/Teapot-and-POST-tp4951616p4952553.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] How to use HTTPS (SSL) with Zinc

2017-06-24 Thread Attila Magyar
Gofer it 
smalltalkhubUser: 'zeroflag' project: 'Teapot'; 
configuration; 
loadDevelopment.



--
View this message in context: 
http://forum.world.st/How-to-use-HTTPS-SSL-with-Zinc-tp4952461p4952507.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] How to use HTTPS (SSL) with Zinc

2017-06-24 Thread Attila Magyar
Sven Van Caekenberghe-2 wrote
> (In regular mail, I don't see you code snippet, I copy it here). 


Hmm, maybe because of the raw text tags. Is this visible?

Transcript 
show: 'Hello world';
cr.




--
View this message in context: 
http://forum.world.st/How-to-use-HTTPS-SSL-with-Zinc-tp4952461p4952503.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] How to use HTTPS (SSL) with Zinc

2017-06-24 Thread Attila Magyar
Teapot uses ZnServer defaultServerClass by default, but you can configure
Teapot to use other kind of ZnServers like this.



This is available only in the latest development version.



--
View this message in context: 
http://forum.world.st/How-to-use-HTTPS-SSL-with-Zinc-tp4952461p4952501.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Teapot and POST:

2017-06-16 Thread Attila Magyar
I added it to the doc.



--
View this message in context: 
http://forum.world.st/Teapot-and-POST-tp4951616p4951702.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Teapot and POST:

2017-06-16 Thread Attila Magyar
It's basically the same as GET and the others. The request object contains
the url encoded form data or whatever was posted. The request object is the
same as ZnRequest with a few additional methods. There is a generic at:
method that can be used to access both path and queryOrFormParams.






--
View this message in context: 
http://forum.world.st/Teapot-and-POST-tp4951616p4951660.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Teapot: Managing authentication by a third party (Fossil)

2017-06-09 Thread Attila Magyar
IMO it depends on how the API works. Most REST APIs are stateless and the
authentication token or api key is sent in each request, there is no
login/logout operation. In this case you can setup a before filter and check
the authentication token in the filter. If you use normal form based login
then using http sessions is the way to go. You can check the session
attribute in a before filter similarly, and redirect the user to the login
page if there is no session info.

Teapot on 
before: '/secure/*' -> [:req | 
req session 
attributeAt: #user 
ifAbsent: [req abort: (TeaResponse redirect location:
'/loginpage')]];
GET: '/loginpage' -> ...show login form...
GET: '/secure' -> 'protected';
start.

You should clean the session when the user logs out manually. As far as I
know ZnServer automatically cleans up inactive sessions after a while, so
there is no need to worry about cleanup.



--
View this message in context: 
http://forum.world.st/Teapot-Managing-authentication-by-a-third-party-Fossil-tp4950560p4950653.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Wiring objects, IoC and Service Locator

2017-06-08 Thread Attila Magyar
Peter Uhnak wrote
> Scale can make all the difference. 


I don't think it should. If you have a small cluster of objects where you
can manage the dependencies yourself, you can compose larger objects from
them and manage the dependencies the same way. By doing so, you'll get an
object that is simpler from the outside than it's parts in the inside, and
you'll need to solve the smaller problem again. In other words we shouldn't
write large software, but compose large software from smaller ones. But the
same can be done with objects (that's why I'm not a big fan of microservices
despite they solve this problem similarly).
If you have a flat structure (where objects don't form higher level
abstractions) and everything needs to know about everything else, then the
DI container will make it easier to work with this structure. But I don't
think this is the right way to organize a software.




--
View this message in context: 
http://forum.world.st/Wiring-objects-IoC-and-Service-Locator-tp4949280p4950535.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Wiring objects, IoC and Service Locator

2017-06-08 Thread Attila Magyar
Vitor Medina Cruz wrote
> This is exactly my concern! Sure, for small stuff that is not a problem,
> but what if you have a big app?

I don't think it makes any difference. You have to decide in each case
whether an object is an internal (implementation detail) and therefore it
must be created from inside the class that uses it, or a dependency (or
peer) that should be passed as an argument. In the later case you
instantiate the object from the outside and hand it over to the object that
requires it. 
Most applications have a few major top level abstractions. Let's call them
subsystems. I would use more domain specific names in a concrete case but
this is a general example. These subsystems are instantiated at the entry
point of the application. If there are shared dependencies between them,
those are instantiated here as well. Then each subsystem can build up some
object graph that is required by the actual subsystem (Not everything needs
to know about everything else. There are clusters of objects that represent
domain level abstractions). The same things applies here as well. Some
dependencies are passed through (peers), others are instantiated (internals)
from the inside. This can go on and on further and it will result a fractal
like structure. The whole application is one object. It consists of few
other objects. Those object consists of further objects. In a typical Spring
application there is big blob of object soup with full of equivalent
objects, everyone can access to everything else and this fractal structure
is missing.



--
View this message in context: 
http://forum.world.st/Wiring-objects-IoC-and-Service-Locator-tp4949280p4950508.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Wiring objects, IoC and Service Locator

2017-06-08 Thread Attila Magyar

> It seems to be broken.

Here is an archived version. http://archive.li/GCbEY#selection-755.0-755.38




--
View this message in context: 
http://forum.world.st/Wiring-objects-IoC-and-Service-Locator-tp4949280p4950480.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Wiring objects, IoC and Service Locator

2017-06-06 Thread Attila Magyar
I don't think using a DI container worth the effort. They add lots of
complexities and solve very little. For some reason DI containers became
very popular in the Java world, but if you take a look at other programming
communities you'll realize that many people are perfectly happy without
using these containers. Using DI and using a DI container is orthogonal. As
you also said you can just pass dependencies to objects to achieve loose
coupling. Yes, you have to do this manually but what's the big deal? We're
talking about code with cyclomatic complexity of 1. Calling a constructor is
not a problem that need to be solved. Using an external XML configuration to
describe object wiring is the worst idea ever.

Here is an article about using plain old object composition to do DI

http://blog.davidpeterson.co.uk/2011/01/object-oriented-example.html

Some more thoughts about the problems associated with DI containers:

http://www.natpryce.com/articles/000783.html
http://higherorderlogic.com/2011/07/is-dependency-injection-like-facebook



--
View this message in context: 
http://forum.world.st/Wiring-objects-IoC-and-Service-Locator-tp4949280p4949720.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Pharo for Raspberry Pi

2017-05-09 Thread Attila Magyar
As I remember, last time I used the standard squeak vm that is shipped with
the rpi3, and it worked fine with Pharo. I don't remember whether it was a
spur image or not, but it worth trying out.



--
View this message in context: 
http://forum.world.st/Pharo-for-Raspberry-Pi-tp4945740p4946015.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] [ANN] Enterprise Pharo book is released!

2016-06-10 Thread Attila Magyar
Good news, I've just ordered one.



--
View this message in context: 
http://forum.world.st/ANN-Enterprise-Pharo-book-is-released-tp4900390p4900399.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



[Pharo-users] [ANN] PBMAuthenticator

2016-06-10 Thread Attila Magyar
Hi,

I made a library for an online 2 factor authentication service called 
PassBy[ME]   . 

This a service that provides PKI based 2nd factor authentication (using
smartphones) among other things like message sending and electronic
signatures.

The library lets you start new authentication sessions and send messages to
the user's phone.

For more info:

http://smalltalkhub.com/#!/~zeroflag/PBMAuthenticator

Attila



--
View this message in context: 
http://forum.world.st/ANN-PBMAuthenticator-tp4900393.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] How much abuse can Teapot take?

2016-06-07 Thread Attila Magyar
Since Teapot is just a pretty thin layer on top of the ZnServer, I'd guess it
can roughly take the same amount. The route finding algorithm is a simple
linear one (like most of the other micro webframeworks use), but it
shouldn't be a problem unless you have an enormous amount of urls. But I
recommend to do some measurements.



--
View this message in context: 
http://forum.world.st/How-much-abuse-can-Teapot-take-tp4899452p4899730.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Teapot Cache Bug

2015-12-24 Thread Attila Magyar
Haven't you forgot to stop the old server? If you use the latest Teapot then
there will be a Teapot menu item in the world menu where you can check how
many instances are currently running. You can stop them from the context
menu. Or try to evaluate Teapot stopAll to stop all of them.



--
View this message in context: 
http://forum.world.st/Teapot-Cache-Bug-tp4868426p4868427.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] [ANN] Working with Pharo on the Raspberry Pi

2015-10-26 Thread Attila Magyar
Hi Torsten,

Have you tried the cogvm on the Pi? It is much faster than the stack vm. If
I remember correctly, I used this one last time:
http://www.mirandabanda.org/files/Cog/VM/VM.r3427/cogspurlinuxhtARM-15.33.3427.tgz

Attila



--
View this message in context: 
http://forum.world.st/ANN-Working-with-Pharo-on-the-Raspberry-Pi-tp4857895p4858039.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Customised auto-completion to give priority to specific packages

2015-08-19 Thread Attila Magyar
Attila Magyar wrote
 It would be really nice to have real message completion in the
 debugger/inspector/workspace where the types of the variables are known.
 For example, when I'm debugging a method and an instance variable is
 already initialized to a String, then the auto completion could show me
 only the messages associated to a Strings instead of showing everything in
 the image.

This is how it works in Python. After evaluating the first line the variable
/a/ becomes a list, so in the second line only list methods are shown.

http://forum.world.st/file/n4844128/screenshot_150819-191603.png 





--
View this message in context: 
http://forum.world.st/Customised-auto-completion-to-give-priority-to-specific-packages-tp4841003p4844128.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Customised auto-completion to give priority to specific packages

2015-08-19 Thread Attila Magyar
It would be really nice to have real message completion in the
debugger/inspector/workspace where the types of the variables are known. For
example, when I'm debugging a method and an instance variable is already
initialized to a String, then the auto completion could show me only the
messages associated to a Strings instead of showing everything in the image. 



--
View this message in context: 
http://forum.world.st/Customised-auto-completion-to-give-priority-to-specific-packages-tp4841003p4844125.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Teapot and Regex

2015-08-04 Thread Attila Magyar
Hi Marcus,

It seems you're trying to define a matcher on the query parameters. It's not
going to work. 

An url consist of path a the query part. These are separeted by a question
mark. 

http://localhost:1701/foo/bar?q1=xxq2=yy

In this example /foo/bar is the path, and q1 and q2 are the query params.

When you define a route in Teapot you specify the path part (either with
wildcards or with regexp). Teapot will select the matching route when a
request comes in based on the path part, and it will parse the query part
(in fact Zn does this), and make the query parameters accessible in the
request object.

For example

GET: '/foo/bar' - [:req | req at: #q1]

This matches to an url whose path part is /foo/bar, even if there is no
query part, or if it has many query parameters.

In your example, you've defined the query part in the matcher, but since it
is not part of the incoming url, you've got 404.

But if you share what you're trying to accomplish I may be able to help.

Attila





--
View this message in context: 
http://forum.world.st/Teapot-and-Regex-tp4840893p4840936.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



[Pharo-users] Multiple sockets listening on same port

2015-07-20 Thread Attila Magyar
Hi,

A number of times I ran into the situation where I started a http server but
forgot that an other one was already running. This resulted strange behavior
and led to confusion.

The Socket class doesn't detect that the given port is already bound to an
other socket.

socket1 := Socket newTCP.
socket1 listenOn: .

socket2 := Socket newTCP.
socket2 listenOn: . I expected this to fail

Both sockets are in WaitinForConnection status and isValid returns true. 

Is this normal? Is there a way to detect this anyway?




--
View this message in context: 
http://forum.world.st/Multiple-sockets-listening-on-same-port-tp4838417.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Situation - Raspberry PI and Pharo + Squeak

2015-07-05 Thread Attila Magyar
Hi Marten,

Currently I'm using this this vm from here 

http://www.mirandabanda.org/files/Cog/VM/VM.r3395/cogspurlinuxhtARM-15.26.3395.tgz

with the latest Pharo 5 spur image from here

http://files.pharo.org/image/50/latest-spur32.zip

As far as I know, spur is a new memory manager but I'm not familiar with the
details.

There is also a stack vm that works with ordinary images, but it lacks JIT
compilation therefore a lot slower than cog.

Attila



--
View this message in context: 
http://forum.world.st/Situation-Raspberry-PI-and-Pharo-Squeak-tp4835873p4835876.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



[Pharo-users] [ANN] Teapot 0.91

2015-05-09 Thread Attila Magyar
Hello,

Teapot 0.91 released today.

Teapot is micro web framework that focuses on simplicity and ease of use.

Here's a summary of changes:
 - Routes and before/after filters may include conditions (see the example
below)
 - Routes can be defined with /any:/ that serves as a wildcard matching any
http method
 - Added /charSet:/ accessor to TeaResponse

E.g.

Teapot on 
GET: 'test' - result; when: [:req | req accept = 'application/json'];
start.

More information:

http://smalltalkhub.com/#!/~zeroflag/Teapot



--
View this message in context: 
http://forum.world.st/ANN-Teapot-0-91-tp4825485.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] {ANN] TMM (Teapot, Mustache, Mongo) web application stack

2015-04-28 Thread Attila Magyar
Nice demo. If you don't mind, I added a link to your github repository on the
teapot website (http://www.smalltalkhub.com/#!/~zeroflag/Teapot).



--
View this message in context: 
http://forum.world.st/ANN-TMM-Teapot-Mustache-Mongo-web-application-stack-tp4822056p4822419.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] How not to serve an AngularJs application from Pharo

2014-10-29 Thread Attila Magyar
Also, there is a 

 serveStatic: '/statics' from: '/var/www/htdocs'

if someone wants to store something outside the image.




--
View this message in context: 
http://forum.world.st/How-not-to-serve-an-AngularJs-application-from-Pharo-tp4786980p4787433.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] BabyMock2: Stubbing individual methods from existing instance?

2014-10-28 Thread Attila Magyar
This is not supported. BabyMock is designed to test the message flow between
objects, and not the internal implementation of an object. If the part what
you want to stub out is not a private implementation detail then maybe
extracting it to an object could help, otherwise couldn't you test the whole
object?



--
View this message in context: 
http://forum.world.st/BabyMock2-Stubbing-individual-methods-from-existing-instance-tp4787228p4787303.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Client cerificate authentication with ZnClient?

2014-10-17 Thread Attila Magyar
wow, thanks. I will test it on Monday.



--
View this message in context: 
http://forum.world.st/Client-cerificate-authentication-with-ZnClient-tp4784981p4785195.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



[Pharo-users] Client cerificate authentication with ZnClient?

2014-10-16 Thread Attila Magyar
Hi,

Is certificate based authentication supported by ZnClient?

Attila



--
View this message in context: 
http://forum.world.st/Client-cerificate-authentication-with-ZnClient-tp4784981.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



[Pharo-users] [ANN] Teapot 0.8 micro web framework

2014-08-24 Thread Attila Magyar
Hello,

I'd like to announce a new micro web framework called Teapot. It follows a
similar philosophy than other lightweight frameworks like
Sinatra/Bottle/Flask/Spark. Teapot is built on top of the Zn HTTP
components, and less than 500 lines long.

More info:

http://smalltalkhub.com/#!/~zeroflag/Teapot

Attila



--
View this message in context: 
http://forum.world.st/ANN-Teapot-0-8-micro-web-framework-tp4774449.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] [ANN] Teapot 0.8 micro web framework

2014-08-24 Thread Attila Magyar
Esteban A. Maringolo wrote
 But why use uppercase selectors for HTTP methods?

I was struggling with the syntax for a while than I end up having this. I
thought it can make easier to see where the route definitions start and end
if there are many. And it looks like a HTTP method, as you said too.



--
View this message in context: 
http://forum.world.st/ANN-Teapot-0-8-micro-web-framework-tp4774449p4774454.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] [ANN] Teapot 0.8 micro web framework

2014-08-24 Thread Attila Magyar
Sven Van Caekenberghe-2 wrote
 Are there any tests ? Examples ?

There is a test package, but it is not part of the metacello config. You can
see it, if you add the repositiory and load the project from there. There
are no large examples so far, only the REST like book app on the
smalltalkhub wiki.


Sven Van Caekenberghe-2 wrote
 How do you load your dependencies, like NeoJSON or STON ?

I consider them as optional dependencies therefore they are not loaded. If
someone wants to use them they will need to load them from the config
browser. From the code I don't refer to them directly but with the
Smalltalk at: #NeoJSON expression, so the projects loads and works without
them, if they are not used. Probably I will add some metacello stuff later
to make it easier to load them. 


Sven Van Caekenberghe-2 wrote
 If you need anything from Zn that is not yet provided, please ask. I would
 be happy to help. It is impressive that you did all this without any
 direct questions !
 
 Cool name too !
 
 Sven
 
 PS: Most people don't seem to know, but you can load a #stable version in
 one expression:
 
 Gofer it
   smalltalkhubUser: 'zeroflag' project: 'Teapot';
   configuration;
   loadStable.
 
 It is just more elegant I think. There are some variants of this API as
 well, check the Gofer class.

Thanks, that's better.




--
View this message in context: 
http://forum.world.st/ANN-Teapot-0-8-micro-web-framework-tp4774449p4774467.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



[Pharo-users] Some TDD Coding Kata videos

2014-06-02 Thread Attila Magyar
I'd like to share some videos about TDDing codeing katas.

http://smalltalkhub.com/#!/~zeroflag/TDD-Kata

Most of them are solved in a TDD as if you meant it style, so the code is
written in the test at first, and factored out later. During this I tried to
use as much refactoring as possible, instead of editing texts. After doing
some tweaks, I was able to do most of the work without using the mouse too
much.





--
View this message in context: 
http://forum.world.st/Some-TDD-Coding-Kata-videos-tp4761315.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] [ANN] BabyMock 2

2014-04-24 Thread Attila Magyar
I made up an example because it makes easier to talk about this. Let's say, I
want to test the #addAll: method of the OrderedCollection. If #addAll: is
implemented as a loop that uses the #add: method (itemsToBeAdded do: [:each
| self add: each]) then would you test the #addAll: isolated from the #add:?
I think it would be a bad idea, because we're talking about an
implementation detail. The #addAll: could have been implemented in a
different way. Mocking the #add: couples the test to the current
implementation and makes it brittle. If I change the implementation of the
#addAll:, then the test will need to be changed as well, even if the
functionality remained the same.

You're right that if there is a bug in the #add: then 2 test cases will
fail, instead of one (the localization is worse but the test is less
brittle).
But if I implement it in a different way, where the 2 methods have separated
logic then only one will fail.

Don't know if this example applies to you case or not.



--
View this message in context: 
http://forum.world.st/ANN-BabyMock-2-tp4748530p4756179.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] [ANN] BabyMock 2

2014-04-24 Thread Attila Magyar
This looks like a slightly different problem to me, where something has a
hardcoded, hidden dependency (a global class object), which is not
substitutable by design, but we want to replace it from the test to
something that answers the canned value.

I understand the practical arguments that probably nobody will ever want to
replace the clock to an other one in production. But making the replaceable
clock dependency is not the only option (though, making explicit that
something is time dependent can be useful sometimes). Many times it is
possible to get rid of the clock entirely at the current level and introduce
a higher level abstraction that can respond to messages like,
#isTrialPeriodExpired, #hasDayChangedFrom, #shouldCacheBeInvalidated
depending on the domain. And this object can be mocked easily in test of its
collaborator.

Of course sometimes this is not possible or doesn't worth the effort.
jb rainsberger had an interesting post about this
http://blog.thecodewhisperer.com/2013/11/23/beyond-mock-objects/


Sean P. DeNigris wrote
 For sure, there are times when this could be abused. But the spirit of
 Smalltalk is to trust the programmer with the full power of the computer
 at every level (e.g. private methods are only a suggestion).

This is a valid argument, but my point of view is different. I think the
purpose of doing TDD is lost because of those shortcuts. It is easy to fall
back to testing mode, and focus on the problem, how do I test something,
instead of design something which is testable and therefore changeable
without those shortcuts.



--
View this message in context: 
http://forum.world.st/ANN-BabyMock-2-tp4748530p4756230.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] [ANN] BabyMock 2

2014-04-23 Thread Attila Magyar
Hi Christophe,

I'm not sure I fully understand, are you referring to partial mocking? Where
you have a real object but with some mocked methods? If this is the case,
then no, this is not supported. Some people consider this as a test smell,
and I agree with them. Maybe the object under test is too big/complex/has
multiple responsibilities, and extracting some parts from it could solve the
problem. I haven't seen legitimitate use for partial mocking so far, where
one couldn't solve the problem with redesign/refactoring in a better way.
Until this happens I'd like to skip this feature.

Attila



--
View this message in context: 
http://forum.world.st/ANN-BabyMock-2-tp4748530p4756008.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] [ANN] BabyMock 2

2014-04-23 Thread Attila Magyar
Christophe Demarey wrote
 ... but sometimes, even in a well-designed class, you may need to test a
 very small part of this class, and in this case, you need a real object
 with some mocked methods.

I assume that there is a method need to be tested, but it calls towards an
other either public or private method of the same object. And you'd like to
mock that second method. Am I understanding correctly? 
Why can't just allow the first method to call the second one? Is it slow,
complicated to setup or requires some external resource to execute? Does it
help to extract the logic from the second method to an other object? Without
a concrete example, I'm just speculating.



--
View this message in context: 
http://forum.world.st/ANN-BabyMock-2-tp4748530p4756105.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] [ANN] BabyMock 2

2014-03-12 Thread Attila Magyar
Thanks for the nice words to everyone.



--
View this message in context: 
http://forum.world.st/ANN-BabyMock-2-tp4748530p4748878.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



[Pharo-users] [ANN] BabyMock 2

2014-03-11 Thread Attila Magyar
I'm pleased to announce the 2.0 version of BabyMock. BabyMock is a visual
mock object library that supports test-driven development.

This version has a new syntax which is incompatible with the old version.
Therefore it has a new repository
http://smalltalkhub.com/#!/~zeroflag/BabyMock2
(BabyMock 1 is still available at its old location, but in the future I'd to
focus on the development of BabyMock2, so don't expect too many changes
regarding the old version).

Changes in 2.0

- A new, extensible DSL (no more should/can)
- Improved error messages, history of messages, detailed information about
argument mismatches
- An improved, Spec based GUI
- Clicking on a mock opens an inspector on the expectations
- Clicking on a message opens an inspector on the message
- Object methods can be mocked by defaults
- Blocks can be executed after receiving a message by the mock. The block
has access to the arguments of the incoming message.
- Any argument matcher
- Cleanups and simplifications in the code

I hope you don't mind the changes regarding the syntax. Personally I think
it has lot more pros than cons.

More information

http://smalltalkhub.com/#!/~zeroflag/BabyMock2

p.s. 
 It needs Pharo3.0.

Attila



--
View this message in context: 
http://forum.world.st/ANN-BabyMock-2-tp4748530.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.