Angel \”Java\” Lopez on Blog

March 25, 2010

Hogwarts Project

Filed under: Software Development — ajlopez @ 2:07 pm

In the last months, I was working in an internal project for a customer (@southworks) named Hogwarts Project. The product owner is @MartinSalias, and the only permanent member of the team is me. We had received help and feedback from internal reviewers, and we are working hard to deliver the beta version of the initial deliverable.

But, what is Hogwarts Project? Some of you read my tweets, announcing the days I was working in the project, but without much more details. Remember, it’s an internal project for a customer, so it’s not publicly available. Maybe, in the future, more info will be public. Despite this, I can write some of the base idea and goals of the project (I encourage my product owner to post some additional clarifications).

You know that software development is a huge task, and each non-trivial project needs the help of lot of techiniques, abilities, and knowledge of a bunch of software developers, usually working in a team. But if you are a software factory, or you have a software dev house, one problem you are constantly facing is the scarcity of experienced developers. One way to supply more seniority to your staff, is increasing their abilities and knowledges. That is the context where Hogwarts Project was created (Hogwarts refers to Harry Potter’s college of magic).

The concrete outcomes of the project are deliverables (notes, presentations, examples, exercises, evaluations, and more… maybe a book with guidance?) about some topics in software development. There are many goals in the project, a mission, and vision. But the basic idea is to train software developers to increase their abilitites, knowledges and give them more seniority.

We have chosen the following subjects to attack in the first courses:

- Test Driven Development

- Inversion of Controls

- Mocks Libraries

- SOLID principles

- Use of code repositories and some other essential tools

- Write part of an real-world application using the new skills.

But, how to teach a bunch of programmers, in such topics? We are still exploring the ways to employ. Following agile principles, we are delivering parts of the project, in order to get feedback from our coworkers and devs. The feedback will be used to polish the material, change directions, or take new ways of doing things. But, initially, we are delivering:

- Instructor material, so any experienced trainer could take any course and give it to an audience. The material is composed of presentations, notes explaining the main points, examples, exercises, and evaluations, maybe virtual machines to use during exercises practice.

- Bibliography and additional resources.

- Software libraries and applications to use.

Some key points:

- It’s not only practice. Note that we are not concentrated in a technology, or platform o language. Initial versions of the outcomes are oriented to .NET and C#, based on current needs. But all the base of the courses could be readapted to other technologies and languages. You need to know WHY we are applying TDD, or a SOLID principle. We want thinking people, not repeating monkeys.

- It’s not only theory. You can see this as learning guitar. You need to practice what your instructor is talking to you.

- You need examples. Not only fancy presentations.

- You need exercises, first one should be basic, but advanced ones too.

- You need to practice in a real-world application, to integrate what you know and practice.

- You need bad and “better” examples/solutions, to grasp the base of the decisions to use some of the above topics.

- The aprentice needs to be evaluated. And she/he needs to receive feedback about her/his strong points and debilities, in order to write a plan for improvement.

Once the initial versions were reviewed and improved, the next step is to expose all these outcomes to the community. One of our goals (an ambitious one) is to create a sustained movement to help other software developers to increase their abilities, here in Argentina, and, we hope, in other countries.

We are working on the first installment of TDD and IoC courses, to be reviewed internally and by selected external reviewers. I want to write short posts, applying the ideas, discovered resources and similar material to be included in Hogwarts deliverables.

Stay tuned!

Angel "Java" Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

March 15, 2010

Scripting WatiN using AjSharp

Filed under: .NET, AjSharp, Open Source Projects — ajlopez @ 10:47 am

AjSharp is an interpreter I wrote using C#. It’s a dynamic language, with dynamic classes and objects, functional values, channels and goroutines, agents-alike entities, access to native .NET object. It was create as a derivative of my previous work on AjBasic, the dynamic language used in AjGenesis, code generation engine. My plan is to unify both language using AjLanguage core, and add them to AjGenesis, allowing other template language to be used as plugins. But all that is still only a plan.

The code of this post is in the trunk of my AjCodeKatas Google Project:

http://code.google.com/p/ajcodekatas/source/browse/

under trunk/AjLanguage/Src/AjSharp.Examples

One of the objetives in the design of AjSharp, is to serve as a light shell to invoke .NET libraries. As a proof of concept, I wrote a simple class to access WatiN, the web automation test library. This is the simple class I’m using:

class Wat
{
  var Browser;
  
  function Wat()
  {
    WatiN.Core.Settings.WaitForCompleteTimeOut = 480;
    this.Browser = new WatiN.Core.IE();
  }
  
  sub Browse(url)
  {
    this.Browser.GoToNoWait(url);
    this.Browser.WaitForComplete(480);
  }
  
  function Button(name)
  {
    button = this.Browser.Button(name);
    
    if (button.Exists)
      return button;
      
    button = this.Browser.Button(WatiN.Core.Find.ByName(name));
    
    if (button.Exists)
      return button;
      
    button = this.Browser.Button(WatiN.Core.Find.ByValue(name));
    if (button.Exists)
      return button;
      
    return null;
  }
  
  function TextField(name)
  {
    textfield = this.Browser.TextField(name);
    
    if (textfield.Exists)
      return textfield;
      
    textfield = this.Browser.TextField(WatiN.Core.Find.ByName(name));
    
    if (textfield.Exists)
      return textfield;
      
    return null;
  }
  
  function Link(name)
  {
    link = this.Browser.Link(name);
    
    if (link.Exists)
      return link;
      
    link = this.Browser.Link(WatiN.Core.Find.ByUrl(name));
    
    return link;
    
    if (link.Exists)
      return link;
      
    return null;
  }
  
  function Contains(text)
  {
    return this.Browser.ContainsText(text);
  }
  
  sub Close()
  {
    this.Browser.Close();
  }
}

You can extend it to support other features of WantiN browser. An example of use:

Include("Tests.ajs");
System.Reflection.Assembly.Load("WatiN.Core");
Include("Wat.ajs");
wat = new Wat();
wat.Browse("http://google.com");
wat.TextField("q").TypeText("Angel Java Lopez");
wat.Button("Google Search").Click();
Assert(wat.Contains("ajlopez.com"), "No content");
wat.Browse("http://www.ajlopez.net/");
Assert(wat.Contains("Java"), "No content");
Assert(wat.Link("http://ajlopez.zoomblog.com/").Exists, "No link 4");
wat.Link("http://ajlopez.zoomblog.com/").Click();
Assert(wat.Contains("Ciencia"), "No content 2");
wat.Close();
exit;

The only problem I had to invoke WatiN, it was its requirement of run inside an STAThread. So, I changed the main method of AjSharp.Console, adding STAThread attribute to it. I'm using this kind of script to test a real web application that is being developed in an agile team. I could add support for exceptions, and logging of messages.

You have more robust utilities to use over WatiN, like Wax, that enables to write tests using Excel spreedsheets. But now, the above scripting core is good enough to the simple initial tests we are using, and it was a good exercise to test AjSharp abilities in a real requirement.

Stay tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

March 5, 2010

Winning a book in Twitter

Filed under: .NET, Software Architecture, Twitter — ajlopez @ 10:44 am

Yesterday, I received a Tweet, saying that if you RT an specific message from @tobint you could win a book from Microsoft. Two winners would be selected: USA and International. Delivered via Amazon. I retwitted the message, and then…..  surprise! I won! (my entry was randomly selected). Tobin was working from Starbucks,  at his night, I guess (Redmond? another place?). Early in this morning, I received:

The book is CLR Via C# 3rd Edition (a new edition) by Jeffrey Richter

http://www.amazon.com/CLR-via-Pro-Developer-Jeffrey-Richter/dp/0735627045

Product description:

Dig deep and master the intricacies of the common language runtime (CLR) and the .NET Framework 4.0. Written by a highly regarded programming expert and consultant to the Microsoft® .NET team, this guide is ideal for developers building any kind of application-including Microsoft® ASP.NET, Windows® Forms, Microsoft® SQL Server®, Web services, and console applications. You’ll get hands-on instruction and extensive C# code samples to help you tackle the tough topics and develop high-performance applications.

Tobin Titus profile at Twitter:

You can visit his personal site Abstract Syntax

http://tobint.com/

Twitter is an astounding experience for me. I can share info, knowledge, links, jokes, moods, with interesting people, in my city, Buenos Aires, in my country, Argentine, or all around the world.

Thanks Tobin!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ahlopez

March 4, 2010

Me and my Aunt Charlotte

Filed under: Software Development — ajlopez @ 9:04 am

This is personal post. More, it will be a whining post. But it’s time to write about one “problem” I had.

I love software development. For more than thirty years, I was dedicated to software development. In this century, after met agile movement, I buy the idea of “deliverable”. For each interesting activity I do, I choose to make a deliverable. My tasks are not “Read X book”, their are more like “Read X book and write a post review". Same in software development. Every example, proof of concept, more complete library, applications, or anything else I learn or prepare for my teaching courses, in my public work, or in my spare time, it was published in some way. All that was the motivation to start my blogs years ago. Most posts are the deliverable of some activity I did. Writing down ideas, readings, sharing info and knowledge, in my opinion, are good deliverables. The evidence is here, in this blog, in my Spanish blog, and in my “non-tech” personal blog.

But sometimes, I had expected some feedback from my fellow developers: persons that I met every day, face to face, working in the same project or desks or facilities. Software developers that were my coworkers, sometimes for more than a decade. Members of my own teams. During the last two years, I did informal test about the level of awareness of my fellow devs about what I wrote: posts, source code, examples. The result was dismaying. Apparently, no one of my fellow devs read, use, comment, critic or retweet what I have published (ok, informally results, 1 in 50/60). Sometimes, somebody ask me about a topic about I wrote dozens of posts, without realizing that I wrote about that topic, producing examples, post, courses about the topic. This was the origin of one of my stereotypical phrases: “You don’t read my blog" (more info in my Spanish post Vos no lees mi blog). I have received more feedback from people around the world than in my own personal neighborhood.

And all this was the reason for another aj-phrase: “this post/code was read/downloaded only by me and my Aunt Charlotte” (imaginary aunt). Apparently, only an aunt could like or notice my work.

Maybe, I have a communication problem to work out. I just write down the "problem" in this “whining” post. Now, for a time, I will stop my expectation about feedbacks, comments, critics from my fellow devs and coworkers. I will continue to produce deliverables, sharing ideas, enjoying doing things.

Stop whining! Back to my love, software development, source code, ideas, and more.

Keep tuned, Aunt Charlotte! ;-)

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

March 1, 2010

Working on AjObjects: in-memory document/Dynamic object Base

Filed under: .NET, AjObjects, NoSQL, Open Source Projects — ajlopez @ 11:00 am

At the beginning of the century, I began to write three . NET projects: AjStorm (Simple Tool for Object Relational Mapping), AjGenesis (Code generation) and AjObjects (in-memory objects with queries). Only the second project is alive. But I learnt about reflection in the three projects, how to implement simple queries in AjObjects (now, we have LINQ in .NET). You can see some prehistoric code at:

https://sourceforge.net/projects/ajstorm/

And, after using PHP for years, I implemented dynamic objects in AjBasic, internal language of AjGenesis. Two years ago, I added dynamic objects to AjSharp as one of its base ideas. In AjBasic and AjSharp you can write:

abel.Name = "Abel"
abel.Age = 600
abel.Father.Name = "Adam"
abel.Father.Age = 800

without previous definition of the object and its properties. In AjSharp you write:

abel.Name = "Abel";
abel.Age = 600;
abel.Father.Name = "Adam";
abel.Father.Age = 800;

More recent info at:

AjSharp: Dynamic Classes and Objects

AjSharp posts

Most language over .NET and Java VMs now are recognizing the power of dynamic features (.NET 4.x have ExpandoObjects, I guess they was born with DLR Dynamic Language Runtime, see? dynamic keyword is the key :-) .

I was playing with in-memory objects for a while, recently I wrote some experiment in AjTwitter. And I play with a more “relational” implementation in AjBase. Both projects are inside the trunk of:

http://code.google.com/p/ajcodekatas

Impressed by the NoSQL movement, I dediced to push the envelop of my spare time, and as weekend code kata, I wrote the skeleton and base of something inspired by MongoDB, what is known as document-oriented database. My project is written in C#. You can see the code in the mentioned AjCodeKatas Google Project, with name AjObjects.

I defined a BasicObject (like BasicDBObject in Java driver for MongoDB):

The BasicObject can be filled using default indexed property:

BasicObject newobj = new BasicObject();
newobj["Age"] = 800;
newobj["Name"] = "Adam";

or by a factory method:

BasicObject newobj = BasicObject.CreateObject("Name", "Adam", "Age", 800);

Collection is the container for BasicObjects:

You can insert, delete objects. A new inserted object obtains a Guid. You can retrieve an object via its Guid. There is a Find(Predicate<BasicObject>) method to return a Cursor over basic objects that makes the predicate true:

The method Update(Predicate<BasicObject>,Action<BasicObject>) applies the action to the select objects in the collection.

I should work more on:

- Concurrency: Actually, Collection has locks around its method code. Cursor obtains a copy of the current list of object (copy of the list, not the objects). While using the cursor, you can update the collection, without changing the cursor content (list and objects).

- Persistence: There is a BasicObjectSerializer, to improve: more basic types, I need a BasicList implementation, too.

- Distribution: I plan to have many host with replicas, with eventual consistency (Hmmm.. I should review the current terminology).

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

Theme: Shocking Blue Green. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 28 other followers