my suggestion is that we start by just doing all the GoF patterns and
perhaps 3 of the PoSA patterns, so that we can see that they will be
possible. I would be worried about overloading the vocabulary at this
point. I'll have a look at the PoSA book later, but is their Proxy
similar to the GoF Proxy?
Michael, when are you coming back from your leave? We are going
completely crazy here with the magnets that you gave us :-) We spend
hours (literally) trying to construct all sorts of shapes. I tried the
wand, but could not get used to it. Also, we don't have very many IR
devices in our home. Maybe I'll take it to JavaOne and give it to
someone who will find more use for it?
Regards
Heinz
--
Dr Heinz M. Kabutz (PhD CompSci)
Author of "The Java(tm) Specialists' Newsletter"
Sun Java Champion
http://www.javaspecialists.eu
Tel: +30 69 72 850 460
Skype: kabutz
I'm back from my leave now, sorry, it took a bit longer than expected.
Your suggestion is sensible. Let's share the work and go through that this week.
Glad you like the magnets, I have another 20.000 around, so if you need more, just tell me.
I recently did a really crazy shape, one that I saw on youtube:
http://www.youtube.com/watch?v=o9eiS1i4lqY
and
http://www.youtube.com/watch?v=5HNJB0vMq6w
this one is also cool
http://www.youtube.com/watch?v=wOv0AkphLhE
Good idea with the wand but first we should perhaps get it working for your macbook, so you can give it away after using it in your talk at java one :)
I put one of the magnetic balls at the end of the wand and now have it dangling from the whiskey shelf above our couch, so I just grab it when I need a remote and put it back right afterwards. Works great.
Cheers
Michael
Back to the core:
I looked at your approach and I like it, the only drawback is that I have to look at the annotation elements to see the role.
That's why I'll try a different approach with the "test" command pattern.
Have the roles be declared inside a main "CommandPattern" annotation.
@interface CommandPattern {
@interface Invoker {
}
}
i.e. CommandPattern.Invoker
so you can either declare this structure being part of the CommandPattern in general (w/o) specifying details, or you could do detailed specs for the roles.
(we could also leave the first part out by not defining a @Target (imho)
WDYT ?
I would also like to keep the annotation on the pattern annotation that provides metadata about the Pattern.
Things that we could include there:
DesignPattern
Pattern Type
Source (I'm not sure if the packaging (although I'd keep that) is such an good way to document the source
Doc-URL (e.g. wikipedia entry or whatever)
refactorings (aka refactoring to patterns) that can lead to this pattern
Annotation[] relatedPatterns
more ... (things taken from the pattern formats that are around there)
also got all tests running, so that maven can run tests and install.
added easymock for connection testing.
Pushed all to github.
Cheers
Michael
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
Could you reformat the project with your settings and push that?
Michael
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
I would suggest we create a FileTemplate in IDEA for creating new
Annotations, then we can keep the common format and won't forget anything.
I'm at the client right, now so I'll do this this evening.
Cheers
Michael
On Mon, 09 Aug 2010 12:03:31 +0300, "Dr Heinz M. Kabutz"
<he...@javaspecialists.eu> wrote:
> Some more comments.
>
> Could you please check out your CommandPattern.java file and have a
look
> at my comments in the file?
>
> Also, I think all annotations that we define should have the
@Documented
> meta-annotation.
>
> Regards
>
> Heinz
> --
> Dr Heinz M. Kabutz (PhD CompSci)
> Author of "The Java(tm) Specialists' Newsletter"
> Sun Java Champion
> http://www.javaspecialists.eu [1]
> Tel: +30 69 72 850 460
> Skype: kabutz
>
> On 8/9/10 11:08 AM, Michael Hunger wrote:
> Sure, on both, I can remove the date and adapt the code intendation, I
> switch mine to 2.
>
> Could you reformat the project with your settings and push that?
>
> Michael
>
> Am 09.08.2010 um 09:51 schrieb Dr Heinz M. Kabutz:
>
> Hi Michael,
>
> can we standardize on date formats in the code? Either 2010-08-09
> (yyyy-MM-dd) or 9 Aug 2010? I usually don't write dates into my code.
>
> Also, I prefer two spaces for indentation, whereas you are using 4. I've
> been using 2 for many years, but don't mind changing to 4 for this
project.
> However, we need to be consistent. Do you know how to export the code
> formatting rules from IntelliJ so we can include them in the project?
> Regards
>
> Heinz
> --
> Dr Heinz M. Kabutz (PhD CompSci)
> Author of "The Java(tm) Specialists' Newsletter"
> Sun Java Champion
>
> http://www.javaspecialists.eu [2]
we can leave of author and date information.
It is just that I've seen it in the JDK, many libs etc. And people don't
have access to the git repo when just reading javadoc :)
Regarding the information repetition:
Normally you would annotate the annotation (the pattern annotation) for
that
Most people are not familiar with the annotation on annotation approach.
That's why most
uses rather have an annotation as parameter
@CommandPattern(info = @PatternInfo(comment="",....))
but that means you still have to have at least one duplicated parameter.
Regarding the adapter, as this is a part of the pattern itself, I would
create separate pattern annotations for those.
Michael
> http://www.javaspecialists.eu [1]
> Tel: +30 69 72 850 460
> Skype: kabutz
>
> On 8/9/10 11:08 AM, Michael Hunger wrote:
> Sure, on both, I can remove the date and adapt the code intendation, I
> switch mine to 2.
>
> Could you reformat the project with your settings and push that?
>
> Michael
>
> Am 09.08.2010 um 09:51 schrieb Dr Heinz M. Kabutz:
>
> Hi Michael,
>
> can we standardize on date formats in the code? Either 2010-08-09
> (yyyy-MM-dd) or 9 Aug 2010? I usually don't write dates into my code.
>
> Also, I prefer two spaces for indentation, whereas you are using 4. I've
> been using 2 for many years, but don't mind changing to 4 for this
project.
> However, we need to be consistent. Do you know how to export the code
> formatting rules from IntelliJ so we can include them in the project?
> Regards
>
> Heinz
> --
> Dr Heinz M. Kabutz (PhD CompSci)
> Author of "The Java(tm) Specialists' Newsletter"
> Sun Java Champion
>
> http://www.javaspecialists.eu [2]
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu
Tel: +30 69 72 850 460 Skype: kabutz
What would you put in the other packages ?
Cheers Michael
On Mon, 09 Aug 2010 16:06:46 +0300, "Dr Heinz M. Kabutz"
<he...@javaspecialists.eu> wrote:
> Should we perhaps use org.jpatterns.annotations as our root
> package? Hopefully we can get enough traction to eventually build some
> interesting tools around the annotations.
>
> Regards
>
> Heinz
> --
> Dr Heinz M. Kabutz (PhD CompSci)
> Author of "The Java(tm) Specialists' Newsletter"
> Sun Java Champion
> http://www.javaspecialists.eu [1]
> Tel: +30 69 72 850 460
> Skype: kabutz
>
> http://www.javaspecialists.eu [3] [1]
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu
Tel: +30 69 72 850 460 Skype: kabutz
Michael
On Mon, 09 Aug 2010 17:24:05 +0300, "Dr Heinz M. Kabutz"
<he...@javaspecialists.eu> wrote:
> org.jpatterns.annotations
> org.jpatterns.tools
> org.jpatterns.?
>
> Regards
>
> Heinz
> --
> Dr Heinz M. Kabutz (PhD CompSci)
> Author of "The Java(tm) Specialists' Newsletter"
> Sun Java Champion
> http://www.javaspecialists.eu [1]
> Tel: +30 69 72 850 460
> Skype: kabutz
>
> On 8/9/10 4:49 PM, Michael Hunger wrote:
> I hope so too,
> and with the JetBrains guys at our disposal :) we could for instance
get
> their UML plugin recognize the annotations?
>
> What would you put in the other packages ?
>
> Cheers Michael
>
> On Mon, 09 Aug 2010 16:06:46 +0300, "Dr Heinz M. Kabutz"
> [2] wrote:
>
> Should we perhaps use org.jpatterns.annotations as our root
> package? Hopefully we can get enough traction to eventually build some
> interesting tools around the annotations.
>
> Regards
>
> Heinz
> --
> Dr Heinz M. Kabutz (PhD CompSci)
> Author of "The Java(tm) Specialists' Newsletter"
> Sun Java Champion
> http://www.javaspecialists.eu [3] [1]
> Tel: +30 69 72 850 460
> Skype: kabutz
>
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu
Tel: +30 69 72 850 460 Skype: kabutz
I made a first attempt for an annotation. I took a simple one
(Singleton) and created a test also. Creating this test, I was not
sure what really to test...
Any advice is very welcome.
For the singletone pattern I chose a variation EAGER and LAZY, but
maybe I should have taken volatile, synchronized, singletonholder,
other? Or add threadsafe and not threadsafe as choice?
Please let me know your thoughts.
Annotation:
package org.jpatterns.gof.singleton;
=========
import org.jpatterns.*;
import java.lang.annotation.*;
/**
* @author Alex Gout
* @since 2010-08-08
*/
@Retention(value = RetentionPolicy.RUNTIME)
@Target(value = ElementType.TYPE)
@Documented
@DesignPattern(type = Type.CREATIONAL)
public @interface SingletonPattern {
Variation variation() default Variation.LAZY;
@Retention(value = RetentionPolicy.RUNTIME)
@Target(value = ElementType.METHOD)
@Documented
public @interface SingletonMethod {
}
public enum Variation {
LAZY, EAGER
}
}
============
Singleton mock:
package org.jpatterns.gof.singleton;
/**
* @author Alex Gout
* @since 2010-08-09
*/
@SingletonPattern(variation = SingletonPattern.Variation.EAGER)
public class Singleton {
private static Singleton INSTANCE = new Singleton();
private Singleton(){
}
@SingletonPattern.SingletonMethod
public static Singleton getInstance(){
return INSTANCE;
}
}
==========
test class:
package org.jpatterns.gof.singleton;
import org.junit.Test;
import static junit.framework.Assert.assertSame;
/**
* @author Alex Gout
* @since 2010-08-08
*/
public class SingletonTest {
@Test
public void testSameInstance() {
Singleton singleton = Singleton.getInstance();
Singleton singleton2 = Singleton.getInstance();
assertSame(singleton, singleton2);
I think the LAZY / EAGER variations are enough. Nice work :-) Remember
to "git push" your changes up to the server.
I'd like to add some tests to differentiate between eager and lazy
singletons. Something like:
package org.jpatterns.gof.singleton;
import org.junit.Test;
import static junit.framework.Assert.assertSame;
/**
* @author Alex Gout
* @since 2010-08-08
*/
public class EagerSingletonTest {
@SingletonPattern(variation = SingletonPattern.Variation.EAGER)
public class EagerSingleton {
private final static EagerSingleton INSTANCE = new EagerSingleton();
private EagerSingleton() { }
@SingletonPattern.SingletonMethod
public static EagerSingleton getInstance(){
return INSTANCE;
}
}
@Test
public void testEagerness() {
assertNotNull(EagerSingleton.INSTANCE);
assertNotNull(EagerSingleton.getInstance());
}
}
and
package org.jpatterns.gof.singleton;
import org.junit.Test;
import static junit.framework.Assert.assertSame;
/**
* @author Alex Gout
* @since 2010-08-08
*/
public class LazySingletonTest {
@SingletonPattern(variation = SingletonPattern.Variation.LAZY)
public class LazySingleton {
private volatile static LazySingleton INSTANCE;
private LazySingleton() { }
@SingletonPattern.SingletonMethod
public static LazySingleton getInstance(){
LazySingleton result = INSTANCE;
if (result == null) {
synchronized(LazySingleton.class) {
result = INSTANCE;
if (result == null) {
INSTANCE = result = new LazySingleton();
}
}
}
return result;
}
}
@Test
public void testLaziness() {
assertNull(LazySingleton.INSTANCE);
assertNotNull(LazySingleton.getInstance());
assertNotNull(LazySingleton.INSTANCE);
}
}
Regards
Heinz
--
Dr Heinz M. Kabutz (PhD CompSci)
Author of "The Java(tm) Specialists' Newsletter"
Sun Java Champion
http://www.javaspecialists.eu
Tel: +30 69 72 850 460
Skype: kabutz
I've created empty annotations for all of the GoF patterns (except for
Singleton, waiting for Alex to submit his).
Now that we are storing the enums inside the annotations, we have lots
of packages with a single class. I think we should get rid of the
subpackages and store all the GoF patterns in org.jpatterns.gof. Any
objections?
Regards
Heinz
--
Dr Heinz M. Kabutz (PhD CompSci)
Author of "The Java(tm) Specialists' Newsletter"
Sun Java Champion
http://www.javaspecialists.eu
Tel: +30 69 72 850 460
Skype: kabutz
Michael
> --
> You received this message because you are subscribed to the Google Groups "jpatterns" group.
> To post to this group, send email to jpat...@googlegroups.com.
> To unsubscribe from this group, send email to jpatterns+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jpatterns?hl=en.
>
No objections, good idea.
-- Alex
Op 9 aug 2010, om 20:12 heeft Dr Heinz M. Kabutz het volgende
geschreven:
> Hi chaps,
I was struggling with Git, I got some nasty connection errors. Now I
see my commit of the Singleton actually worked, but somehow I managed
to get a merge though, which I really cannot explain. Anyhow... I hope
this is not too serious. First thing I did was pulling Heinz'
additions, then I tried to commit mine.
Sorry.. I hope I didn't make a bad mistake!
Op 9 aug 2010, om 20:12 heeft Dr Heinz M. Kabutz het volgende
geschreven:
> Hi chaps,
I will update the tests tomorrow, or you can do it if you still have
time ;)
-- Alex
Op 9 aug 2010, om 19:33 heeft Dr Heinz M. Kabutz het volgende
geschreven:
> Hi Alex,
Regards
Heinz
--
Dr Heinz M. Kabutz (PhD CompSci)
Author of "The Java(tm) Specialists' Newsletter"
Sun Java Champion
http://www.javaspecialists.eu
Tel: +30 69 72 850 460
Skype: kabutz
You should use the ssh connection, rather than http.
g...@github.com:jexp/jpatterns.git
Regards
Heinz
--
Dr Heinz M. Kabutz (PhD CompSci)
Author of "The Java(tm) Specialists' Newsletter"
Sun Java Champion
http://www.javaspecialists.eu
Tel: +30 69 72 850 460
Skype: kabutz
initial clone:
git clone g...@github.com:jexp/jpatterns.git
then:
do your local changes & local commits (repeat as often as you'd like):
git add <files> or git add .
git commit -m"message"
if you want to share/push changes
first pull last public state
(--rebase is better than normal pull because it first fetches the clean remote branch and then _reapplies_ your commits one after another on top of that, instead of doing a big merge of the remote branch on top of your changed HEAD state.
git pull --rebase origin master
then push your changes
git push origin master
Done.
Cheers
Michael
You did correctly with the maven for source/test versions.
If I understood you correctly you want one jar in the root directory? What for?
It is in target after maven install and also in your local repository,
so if you ever want to use jpatterns in a different project you just include the dependency in your pom (or ivy, gradle, grapes or whatever build tool) like
<dependency>
<groupId>org.jpatterns</groupId>
<artifactId>jpatterns</artifactId>
<version>1.0</version>
</dependency>
Nothing else needed.
We should look into pushing it to mvnrepository.com but I have to look that up, then it is globally available.
Michael
another thing: do we want to keep the gifs in the source directory or do we want to do a separate directory with them.
We should also use javadoc in the annotations and there include an <img src=""/> to the source of the images so that they'll be included in generated javadoc.
(there are also maven plugins for that if we want to provide javadoc besides the jar file)
Michael
Am 09.08.2010 um 22:49 schrieb Michael Hunger:
Good question: I'd rather repeat what is in the books because then people could reuse jpatterns (annotations + javadoc) as a compact DesignPatterns catalogue that is always at hand, within your IDE.
And people don't have to write that themselves but they can look it up if they want to.
Btw. is there a really good site for documented design patterns out there? (Besides wikipedia?), perhaps we should/could create sth like that at jpatterns.org ? (just an idea for community involvement).
Michael
I would merge them, to PatternInfo.
and I would set their target to Annotation, so that the Pattern annotation itself is documented.
WDYT ?
Michael
and the PatternComment + PatternParticipants to jpatterns.doc
I added javadoc to the pom, so you can mvn javadoc:javadoc for generating javadoc.
we could also create a maven site that is automatically updated at mvn release and could contain javadoc, jars to download, mvn info etc. (hosted at jpatterns.org)
I would like to move the build number to 0.1 or sth like that and also have the current dev labeled as snapshot.
We can then do a release with mvn release (that increases the build # and pushes non-snapshot versions to mvnrepository).
Michael
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu
Tel: +30 69 72 850 460 Skype: kabutz
They have to be in src/main/ressources for maven to copy them to the target.
Exactly that was what I meant.
Sure there is a simple way to build it and store it in a certain location.
The question is at what times do we want to build it? Everytime or just at "release" times.
If we build it at release times and push it to mvnrepository.com there is a simple way for people to download just the jar.
Here is a howto:
http://maven.apache.org/guides/mini/guide-central-repository-upload.html
what license do we want to use for jpatterns?
Michael
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
But for external people release versions should be enough.
Michael
You just have to install maven. But don't do that now.
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
Sorry then I was thinking in the wrong terms about ElementType.ANNOTATION. (not good) having metadata on top of metadata would have been much cooler.
Michael
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
Hmm it seems to be more complicated than this for maven central upload :(
They have a 4 week delay for manual updates. otherwise one is required to use one of the public forges.
Currently approved Forges:
• Apache (open to Apache Projects)
• Codehaus (open to Codehaus Projects)
• Sonatype Forge (open to any OSS Project)
• Fusesource Forge (Focused on FUSE related projects)
I'd suggest codehaus but have to look if they integrate with github (otherwise we would have to use the git-svn bridge to update their repo).
The advantage of that is that the public forges have automated builds and we don't have to setup anything.
Although sonatype also reads good: http://nexus.sonatype.org/oss-repository-hosting.html (They do just repo hosting that is synced to mvn-central).
Michael
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
http://junit.sourceforge.net/cpl-v10.html
Michael
But perhaps your're right first and we just add the jar to github and serve it from there as first step.
and do the repo-publishing stuff a bit later, we have to finish the patterns first.
Michael
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu
Tel: +30 69 72 850 460 Skype: kabutz
Michael
On Tue, 10 Aug 2010 14:31:41 +0300, "Dr Heinz M. Kabutz"
<he...@javaspecialists.eu> wrote:
> Moved the classes as suggested and added UML to some of the javadocs,
> together with intents. Also filled in the related for some annotations.
>
> Regards
>
> Heinz
> --
> Dr Heinz M. Kabutz (PhD CompSci)
> Author of "The Java(tm) Specialists' Newsletter"
> Sun Java Champion
> http://www.javaspecialists.eu [1]
> Tel: +30 69 72 850 460
> Skype: kabutz
>
> We should also use javadoc in the annotations and there include an to
the
> source of the images so that they'll be included in generated javadoc.
>
> (there are also maven plugins for that if we want to provide javadoc
> besides the jar file)
>
> Michael
>
> Am 09.08.2010 um 22:49 schrieb Michael Hunger:
>
> basic workflow should be sth like the following:
>
> initial clone:
> git clone g...@github.com:jexp/jpatterns.git [2]
>
> then:
>
> do your local changes
> http://www.javaspecialists.eu [7] [1]
> Tel: +30 69 72 850 460
> Skype: kabutz
>
> On 8/9/10 4:49 PM, Michael Hunger wrote:
> I hope so too,
> and with the JetBrains guys at our disposal :) we could for instance
>
> get
>
> their UML plugin recognize the annotations?
>
> What would you put in the other packages ?
>
> Cheers Michael
>
> On Mon, 09 Aug 2010 16:06:46 +0300, "Dr Heinz M. Kabutz"
> [2] wrote:
>
> Should we perhaps use org.jpatterns.annotations as our root
> package? Hopefully we can get enough traction to eventually build some
> interesting tools around the annotations.
>
> Regards
>
> Heinz
> --
> Dr Heinz M. Kabutz (PhD CompSci)
> Author of "The Java(tm) Specialists' Newsletter"
> Sun Java Champion
> http://www.javaspecialists.eu [8] [3] [1]
> To post to this group, send email to jpat...@googlegroups.com [9].
> To unsubscribe from this group, send email to
> jpatterns+...@googlegroups.com [10].
> For more options, visit this group at
> http://groups.google.com/group/jpatterns?hl=en [11].
>
> --
> You received this message because you are subscribed to the Google
Groups
> "jpatterns" group.
> To post to this group, send email to jpat...@googlegroups.com [12].
> To unsubscribe from this group, send email to
> jpatterns+...@googlegroups.com [13].
> For more options, visit this group at
> http://groups.google.com/group/jpatterns?hl=en [14].
>
> --
> You received this message because you are subscribed to the Google
Groups
> "jpatterns" group.
> To post to this group, send email to jpat...@googlegroups.com [15].
> To unsubscribe from this group, send email to
> jpatterns+...@googlegroups.com [16].
> For more options, visit this group at
> http://groups.google.com/group/jpatterns?hl=en [17].
>
> --
> You received this message because you are subscribed to the Google
Groups
> "jpatterns" group.
> To post to this group, send email to jpat...@googlegroups.com [18].
> To unsubscribe from this group, send email to
> jpatterns+...@googlegroups.com [19].
> For more options, visit this group at
> http://groups.google.com/group/jpatterns?hl=en [20].
>
> --
> You received this message because you are subscribed to the Google
Groups
> "jpatterns" group.
> To post to this group, send email to jpat...@googlegroups.com [21].
> To unsubscribe from this group, send email to
> jpatterns+...@googlegroups.com [22].
> For more options, visit this group at
> http://groups.google.com/group/jpatterns?hl=en [23].
>
> --
> You received this message because you are subscribed to the Google
Groups
> "jpatterns" group.
> To post to this group, send email to jpat...@googlegroups.com.
> To unsubscribe from this group, send email to
> jpatterns+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/jpatterns?hl=en.
>
>
> Links:
> ------
> [1] http://www.javaspecialists.eu
> [2] mailto:g...@github.com:jexp/jpatterns.git
> [3] mailto:g...@github.com:jexp/jpatterns.git
> [4] http://www.javaspecialists.eu
> [5] http://www.javaspecialists.eu
> [6] mailto:he...@javaspecialists.eu
> [7] http://www.javaspecialists.eu
> [8] http://www.javaspecialists.eu
> [9] mailto:jpat...@googlegroups.com
> [10] mailto:jpatterns+...@googlegroups.com
> [11] http://groups.google.com/group/jpatterns?hl=en
> [12] mailto:jpat...@googlegroups.com
> [13] mailto:jpatterns+...@googlegroups.com
> [14] http://groups.google.com/group/jpatterns?hl=en
> [15] mailto:jpat...@googlegroups.com
> [16] mailto:jpatterns+...@googlegroups.com
> [17] http://groups.google.com/group/jpatterns?hl=en
> [18] mailto:jpat...@googlegroups.com
> [19] mailto:jpatterns+...@googlegroups.com
> [20] http://groups.google.com/group/jpatterns?hl=en
> [21] mailto:jpat...@googlegroups.com
> [22] mailto:jpatterns+...@googlegroups.com
> [23] http://groups.google.com/group/jpatterns?hl=en
Hi,
Yes I agree. It's a new project, lets first set it up. Many details
are in the process of evolution, let them settle in first.
I'm curious why JUnit would have such a special license?
Awesome, the work you guys do in hours. Anyway, I set up my public rsa
key, so I can use the ssh connection now. Thx Heinz for completing the
Singleton tests, looks very good. Also, in the proxy example I noticed
the Lutefisk again. I'm just wondering if it's the same thing I ate
(at least tried to eat) in Sweden last summer. It was called
Sürstrumming. It's herring in a tin, that has fermented for at least
three months. They open it when the tin looks swollen from the gasses
inside. Can't open it inside, because the house will smell for weeks.
Well, I tried to eat it the Swedish way, with potatoes, onions, tomato
and some creme-fresh on bread.. but no luck. Just fry me a chicken...
I like GitHub. Im also considering putting my private Seam test
projects there.
Anyway, I will take a look at all your work.
Regards,
Alex
> .
>
I've filled in all the inner annotations for our patterns, next we need
to do some unit tests for these patterns. This will hopefully show up
some weaknesses in our approach.
So far our unit tests have been a bit weak in my opinion. Any
suggestions on how we could improve them? Perhaps we will need to write
a tool that can extract the patterns from a set of classes and then
verify against that?
Regards
Heinz
--
Dr Heinz M. Kabutz (PhD CompSci)
Author of "The Java(tm) Specialists' Newsletter"
Sun Java Champion
http://www.javaspecialists.eu
Tel: +30 69 72 850 460
Skype: kabutz
We will improve this once we figure out how to integrate with something
like codehaus.
Downloads: http://www.jpatterns.org/?page_id=29
Javadocs: http://www.jpatterns.org/?page_id=27
Regards
Heinz
--
Dr Heinz M. Kabutz (PhD CompSci)
Author of "The Java(tm) Specialists' Newsletter"
Sun Java Champion
http://www.javaspecialists.eu
The question is, what do we want to show with the Tests? What examples do you use in the course for the patterns.
Perhaps we should take a sample application, refactor it to use patterns and annotate them.
Just had another idea (actually two).
I read somewhere that Kent and Erich tried to put as many patterns as possible into Junit (at least version 3.x).
So perhaps we should just take the JUnit source code and annotate it with our annotations, use a sourcecode-publishing tool to put it on the web.
Another example are the Game of Life from the book "Holub on Patterns" where he really crammed all known patterns in the poor game of life.
(He's got another example in the book that is an in memory database, which is actually quite nice).
So perhaps we can ask Kent (I can do this) or Allan Holub to use their code for the application of the annotations.
Michael
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
you could change the cron job, that it only updates the file if maven ends with an exit code of 0.
As I added the maven bundle plugin, we also have the bundle-jar that contains, source, javadoc and class jar.
Michael
Michael
>>>>> .
>>>>> To unsubscribe from this group, send email to
>>>>> jpatterns+...@googlegroups.com
>>>>> .
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/jpatterns?hl=en
>>>>> .
>>>>>
>>>>>
>>>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups "jpatterns" group.
>>> To post to this group, send email to
>>> jpat...@googlegroups.com
>>> .
>>> To unsubscribe from this group, send email to
>>> jpatterns+...@googlegroups.com
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/jpatterns?hl=en
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
Yes, thats why I wondered what I should put in the Singleton tests.
Every test I see now, does not actually test the usefuless of the
annotation. I think the real added value and indeed weaknesses of this
approach will show when they come to life when you can get information
concerning the used patterns compile- or runtime. Maybe even tools
like findbugs would be able to detect weaknesses in a pattern approach
used.
But I agree the first step is applying the annotations on real-life
code and see where the gaps start to show.
-- Alex
> .
>
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
As I already said, we can also create a file template in idea for creating new Patterns, then all of this comes for free.
Michael
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
Michael
Regards Heinz -- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion http://www.javaspecialists.eu Tel: +30 69 72 850 460 Skype: kabutz
This brings me onto another question for the group. How "pure" should
we keep the pattern definitions? What is our gold standard? My thought
was that we stick as closely as possible to the original. However, in
the case of the Factory Method, there are lots of different types of
factories out there (see Head First Design Patterns). Should we put
them all into the GoF Factory Method (which is where most people would
look for them) or do we add a comment to the file that explains where to
find these patterns?
Do we link from the GoF patterns to related patterns in other patterns
catalogs?
Would love to hear your opinions.
Heinz
I assume there can be lots of heated debate as everyone takes his own context and experiences into the calculation when dealing with pattern - which is a good thing!
I would also link to other patterns from other catalogues.
Perhaps we should also introduce the patternLanguage attribute at the DesignPatterns annotation then we could relate the patterns to the pattern language they belong to.
There is a comprehensive list of patterns in POSA4 and a great discussion about the philosophy of patterns in POSA5 (the latter is a very recommended read).
Cheers Michael
Perhaps we should also put a list of pattern related books on jpatterns.org (w/ amazon links and affiliate-id)?
e.g. GoF, HF DP, POSA1..5, Refactoring to patterns, William Wakes Pattern Handbook,
there was a recently released hatching patterns book from Vlissides (it think), Fowlers PoAA
and certainly others (these were just those that I thought of now).
Perhaps we should also put a list of pattern related books on jpatterns.org (w/ amazon links and affiliate-id)?
e.g. GoF, HF DP, POSA1..5, Refactoring to patterns, William Wakes Pattern Handbook, there was a recently released hatching patterns book from Vlissides (it think), Fowlers PoAA
and certainly others (these were just those that I thought of now).
Michael
Thanks for your comments. I used the book "Applied JAVA
Patterns" (Stelting & Maassen). It is somewhat more towards actual
implementations than the GoF book, hence I think the differences with
GoF. Im ok if we stick to GoF as a reference, but at least lets's make
that explicit for now.
About my comments:
Builderpattern: in AJP, they describe the Director variant, with the
Director delegating parts of the creation process to what they call
creational delegates. So, it is related to the BuildPart() method
Command: In the book, a common variant of the commandpattern in
described in an example of an undo- redo list. The command history is
a singleton. On second thought this might be too much implementation
oriented detail for a related pattern.
I agree on the Visitor - Iterator relation, as the visitor will use an
iterator to cycle the elements.
Memento: A memento is used to capture the state of an object and be
able to rewind to that state. Ofcourse, you do not need to inplement
the state pattern for this, but I felt the relation was strong enough
to mention
Strategy: AJP: "The Stragtegy method is sometimes defined as a Factory
so that the using class can use new Strategy implementations without
having to recode other parts of the application" Hence, I suggested it.
Ofcourse, if we mean to stick to GoF for now for these patterns most
of these comments are academic.
Thanks again for your comments, I hope I have explained myself ;)
I will be on holiday from sunday for 3 weeks. Be good all ;)
-- Alex
Op 13 aug 2010, om 08:12 heeft Dr Heinz M. Kabutz het volgende
geschreven:
>
> --
> You received this message because you are subscribed to the Google
> Groups "jpatterns" group.
> To post to this group, send email to jpat...@googlegroups.com.
> To unsubscribe from this group, send email to jpatterns+...@googlegroups.com
> Hi!
>
> Thanks for your comments. I used the book "Applied JAVA Patterns" (Stelting & Maassen). It is somewhat more towards actual implementations than the GoF book, hence I think the differences with GoF. Im ok if we stick to GoF as a reference, but at least lets's make that explicit for now.
>
> About my comments:
> Builderpattern: in AJP, they describe the Director variant, with the Director delegating parts of the creation process to what they call creational delegates. So, it is related to the BuildPart() method
This looks more like a pattern composition. The director could implement a template method for that, or use the other builders as strategies. If they builder form a consistent hierarchy it could also be a composite (depending on what to build).
But that is a good idea. We should address (I'm not sure how) the different kind of pattern aggregations:
POSA5 names:
* pattern collections
* pattern sequences
* pattern stories
* pattern languages
(I also think pattern compositions but am not sure, have to look it up).
> Command: In the book, a common variant of the commandpattern in described in an example of an undo- redo list. The command history is a singleton. On second thought this might be too much implementation oriented detail for a related pattern.
I agree with that. And singleton is not necessarily a good solutions for that. Imagine a application with several sessions and you want to have an undo list per user or session, then the
singleton would have to handle the thread-safe access of all users and separate that internally.
Rather have the undo-list as a part of the appropriate object,
> I agree on the Visitor - Iterator relation, as the visitor will use an iterator to cycle the elements.
> Memento: A memento is used to capture the state of an object and be able to rewind to that state. Ofcourse, you do not need to inplement the state pattern for this, but I felt the relation was strong enough to mention
Hmm I rather think the state encapsulated by the state pattern is the part of the objects functionality that varies with the state changes not necessarily its attributes, putting the attributes into the state as well would be possible but then it would not enable code sharing between objects. Most implementation of the state pattern I've seen deal only with behavior not internal state (pun intended)
> Strategy: AJP: "The Stragtegy method is sometimes defined as a Factory so that the using class can use new Strategy implementations without having to recode other parts of the application" Hence, I suggested it.
Could you explain that a bit more? You have to recode something in the app when adding new strategies, I don't know how factory protects you from that. The only thing I can imagine is to hide the selection logic from the client.
On Aug 13, 2010, at 10:22 AM, Michael Hunger wrote:
>
> Am 13.08.2010 um 10:05 schrieb Alex Gout:
>
>> Hi!
>>
>> Thanks for your comments. I used the book "Applied JAVA Patterns" (Stelting & Maassen). It is somewhat more towards actual implementations than the GoF book, hence I think the differences with GoF. Im ok if we stick to GoF as a reference, but at least lets's make that explicit for now.
>>
>> About my comments:
>> Builderpattern: in AJP, they describe the Director variant, with the Director delegating parts of the creation process to what they call creational delegates. So, it is related to the BuildPart() method
> This looks more like a pattern composition. The director could implement a template method for that, or use the other builders as strategies. If they builder form a consistent hierarchy it could also be a composite (depending on what to build).
>
> But that is a good idea. We should address (I'm not sure how) the different kind of pattern aggregations:
> POSA5 names:
> * pattern collections
> * pattern sequences
> * pattern stories
> * pattern languages
> (I also think pattern compositions but am not sure, have to look it up).
Actually, the delegates are not objects, they are methods. Thats why I suggested the elementtype.METHOD CreationalDelegate (or in GoF terms I think BuildPart, I dont have GoF handy atm).
I like the idea of addressing the aggregations.
>
>> Command: In the book, a common variant of the commandpattern in described in an example of an undo- redo list. The command history is a singleton. On second thought this might be too much implementation oriented detail for a related pattern.
> I agree with that. And singleton is not necessarily a good solutions for that. Imagine a application with several sessions and you want to have an undo list per user or session, then the
> singleton would have to handle the thread-safe access of all users and separate that internally.
> Rather have the undo-list as a part of the appropriate object,
Agree. Come to think of it.. I never saw Singleton as 'real' singleton, but more of an object that controls object creation and uniqueness in a context. The context could also be a thread or a session instead of a JVM. Regardless of how we address it in JPatterns, how do you guys look upon this?
>
>> I agree on the Visitor - Iterator relation, as the visitor will use an iterator to cycle the elements.
>> Memento: A memento is used to capture the state of an object and be able to rewind to that state. Ofcourse, you do not need to inplement the state pattern for this, but I felt the relation was strong enough to mention
>
> Hmm I rather think the state encapsulated by the state pattern is the part of the objects functionality that varies with the state changes not necessarily its attributes, putting the attributes into the state as well would be possible but then it would not enable code sharing between objects. Most implementation of the state pattern I've seen deal only with behavior not internal state (pun intended)
I don't understand this I'm sorry ;(
Can you elaborate on this?
>
>> Strategy: AJP: "The Stragtegy method is sometimes defined as a Factory so that the using class can use new Strategy implementations without having to recode other parts of the application" Hence, I suggested it.
>
> Could you explain that a bit more? You have to recode something in the app when adding new strategies, I don't know how factory protects you from that. The only thing I can imagine is to hide the selection logic from the client.
Imagine you have a family of datastructures that need to support serialization in some application. If each structure defines a strategy to do this, you could have the DataSerializer use the factorymethod on the datastructure to retrieve the appropiate strategy. When you implement a new Datastructure, you only need to associate it with the (new) strategy and the rest of the code remains untouched. That is the correlation they mean between factorymethod and strategy.