Angel \”Java\” Lopez on Blog

July 10, 2014

End Of Iteration 2014w27

Filed under: .NET, AjGenesis, C Sharp, Code Generation, Iteration, JavaScript, NodeJs — ajlopez @ 2:33 pm

Previous Post

Code Generation with AjGenesisNode

I updated and published new versions of my projects:

https://github.com/ajlopez/AjGenesisNode
https://github.com/ajlopez/AjGenesisNode-Entity
https://github.com/ajlopez/AjGenesisNode-Model
https://github.com/ajlopez/AjGenesisNode-Sinatra
https://github.com/ajlopez/AjGenesisNode-Express

Now, there are new functions to manage the model directory in AjGenesis. That directory contains the JSON files that represent the model, ie entities, project settings, db settings, etc. It resides in “./ajgenesis/models”.

The code generation for Sinatra and Express was improved. Instead of create a project and then, generate a “build” subdirectory in project directory, now the code generation acts over the current project directory. This way is more straighforward, and more aligned with other projects that generates code: there is no “build” subdirectory.

I added the preserve of code regions by name. If a generated file has a code region delimited with special text, that region is preserved even when the file is regenerated.

DylanSharp

My Dylan language interpreted in C#

https://github.com/ajlopez/DylanSharp

I added more binary operations. I should add type support, but in the current use cases, the untyped evaluation is OK.

SharpBus

My Mule-like simple service bus in C#

https://github.com/ajlopez/SharpBus

I added message transformers, message processors, instead of play payload transformers and processors. And I added a Router object. So, the implementation has/will have:

- Lambdas that operates on payload (processors, transformers, outputs, routers)
- Lambdas that operatos on message (processors, transformers, outputs, routers)
- Objects that operates on payload (processors, transformers, outputs, routers)
- Objects that operates on messages (processors, transformers, outputs, routers)

A payload is an untyped object. A message has a payload and additional properties (by name/value).

JavaScript Samples

I wrote my first AngularJS samples

https://github.com/ajlopez/JavaScriptSamples/tree/master/Angular

Dynamic Site in Express 4

Based on JSON definitions

https://github.com/ajlopez/ExpressSamples/tree/master/DynSite4

I added the support of https://github.com/ajlopez/LoadJsons to load JSON files that have references to other JSON files. The site is a prototype based on pages defined in JSON files. So you can easy change the JSON data to alter the prototyped site. Next steps: add lists based on MongoDB collections, with views. Then, code generation for differents targets (Express 4? Laravel?)

Others

I changed https://github.com/ajlopez/SharpGo with minor improvements. I also worked on three non-public projects. More fun is coming.

Stay tuned!

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

June 27, 2014

End Of Iteration 2014w25

Previous Post
Next Post

Code Generation with AjGenesis

I published a new version of

https://github.com/ajlopez/AjGenesisNode

My code generation tool, based on Node.js. Now, it can preserve files in generate tasks (if you want one of your files doesn’t overwritten). But the key change was to put models under current project directory, ajgenesis/models folder. In this way, I can put all the AjGenesis-related stuff in only one directory related to current project. So, I refactored and republished the modules and examples of:

https://github.com/ajlopez/AjGenesisNode-Express
https://github.com/ajlopez/AjGenesisNode-Entity
https://github.com/ajlopez/AjGenesisNode-Hello

Next steps: refactor https://github.com/ajlopez/AjGenesisNode-Model to use the new directory, and refactor/complete the generation process in Express, Sinatra, Laravel, Django projects.

SharpBus

I worked on

https://github.com/ajlopez/SharpBus

implemented a simplified Mule-like message flow in C#, using TDD (Test-Driven Development). Now I have: input, output, transform, processors, routers, branches in flow. It was nice to see all in place, using “baby steps”, and the powerful lambdas of C#. I implemented transformer objects too. Next steps: instead of simply process a payload, start to process a complete message.

SimpleCurry

After attending a JavaScript meetup at Buenos Aires, I wrote a simple JavaScript curryfing function library:

https://github.com/ajlopez/SimpleCurry

Since then, I started to add some additional pieces, like partial application, and composition of functions.

SimpleStates

Thanks to @fabiomaulo, I met state machine implementations in C#. So, I wrote my own version in JavaScript:

https://github.com/ajlopez/SimpleStates

It has a fluent interface to define states, with triggers and actions. Next steps: add global triggers, and hierarchical states.

Others

I added some functions to https://github.com/ajlopez/SharpMongo core and REPL. I worked on four private projects, too. More fun is comming.

Stay tuned!

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

May 14, 2014

End Of Iteration 2014w19

Previous Post
Next Post

SimpleArgs

I published a new version of:

https://github.com/ajlopez/SimpleArgs

A Node.js module to process argument options. I refactored some pieces, and now, the use of the module is more simple. The current API is inspired in the previous work, mixed with minimist project ideas, by @substack.

Code Generation for PHP Laravel

I started to write

https://github.com/ajlopez/AjGenesisNode-Laravel

using my AjGenesis code generation tool, based on Node.js. Only the first tests (models, create a project) are in place. Next steps: improve create project, and start generate site task and templates.

Clojure in C#

I updated

https://github.com/ajlopez/ClojSharp

to use multifunctions (functions that have different bodies depending on number of arguments). It was good to see TDD helping me to add this functionality.

SimpleScraper

In my project:

https://github.com/ajlopez/SimpleScraper

scraper for JavaScript/Node.js, I added a new sample (scrap news from argentinean news site). And refactor some methods and internal implementation. TDD Rocks!

Go in C#

The SharpGo project:

https://github.com/ajlopez/SharpGo/commits/master

I added new node to AST (Abstract Syntax Tree), some operators, lexer tokens, and parser tests.

I was working in three non-public projects, too.

More fun is coming.

Keep tunes!

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

April 26, 2014

Applications Creating Applications

I was working in different approaches to make programs create more programs. This post is a brief review of the path I took in the past years/months/weeks, and that it is still work in progress. I think they are interesting ways of doing programming, to be explored.

Dynamic Applications

The idea is to describe an application (entities, some relations, some code), and run it in a web runner that knows how to interpreted the application definition. I wrote a first implementation for past year Knockout competition:

More info at Dynamic Applications in Node.js.

The application could be described in a simple structure (in this example, a simple JavaScript object that can be serialized to JSON). The same structure could be interpreted and run by different host applications: a web application, an SPA, a mobile app, etc. And it could be used as a seed to generate code in a “concrete” technology, like Sinatra, Express+MongoDB, etc.

Code Generation

One of my preferred topics. I created tasks, templates and free models to generate applications in Express, and in other technologies (Sinatra, Django, Flask, PHP, all work in progress). I have implementations in C#, Ruby and Node.js. But my latest work is on Node.js:

https://github.com/ajlopez/AjGenesisNode

You can have a simple example in:

https://github.com/ajlopez/AjGenesisNode-Express

Screenshots of a simple generated application:

 

And I’m working on creating an online site where you can describe the application (the free model, the features, databases, entities, web framework to use) and then download the generated application code.

Cards

In the project:

https://github.com/ajlopez/SimpleCards

I describe each application as a set of cards (a deck). A card can have simple values, or a another card or deck. For example, a card could have an id, a name, a title to be displayed, and additional info. A card could have another deck of cards as a property (ie an Chemical Elements card could have a deck with one card by element). They can be rendered in different context: a web application, a web application as a Single Page Application, a mobile app (in Phonegap, or native). One thing is the structure and content of a card, and another thing is the render of a card. The later depends on the context of the host application.

A simple example

https://github.com/ajlopez/SimpleCards/blob/master/samples/deck/js/model.js

var model = {
    title: "My Deck",
   
    cards: [
        { title: "Card 1", text: "This is the card 1" },
        { title: "Card 2", text: "This is the card 2" },
        { title: "Card 3", text: "This is the card 3" }
    ]
}

Another sample, with screenshots:

https://github.com/ajlopez/SimpleCards

A card content could be a simple text, a long text, an URL, an image, or a widget to be displayed by the hosted application (ie a Google Map). The card description could be static or could be generated on the fly (ie, a feed could be transformed to a card/deck, or it could be retrieved from a REST API). A card could have partial content (id, title), and a resolver can retrieve the rest of its content, using the id (ie, a card could represent a Wikipedia Page, and the id would be the URL; the resolver downloads the page content, and complete the card, if needed).

More fun is coming.

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

April 15, 2014

End Of Iteration 2014w15

Previous Post
Next Post

Code Generation

I wrote new tasks, templates using my AjGenesis code generation tool. I create a simple:

https://github.com/ajlopez/AjGenesisNode-Django

to generate a Django web site, with admin page. The code generation creates the model, and admin feature allows you to edit the data, using Sqlite. It’s simple, but it is working. Next steps: create custom views, and a new project to generate Flask web site.

I added text area input fields to https://github.com/ajlopez/AjGenesisNode-Express the project that generates Express/Node.js web site from a model. Next steps: client-side validation, better server code organization, some initial tests.

I want to integrate these tools in a online app, so I started https://github.com/ajlopez/AjGenesisNodeServer to have a web site that generate codes from a model, defined at client side. You will select technology (Express, PHP, Sinatra, Django, Flask, …), the models (mainly, entities like: customer, supplier, department, employee, invoice… ), the database, the features (multiple pages, single page, angular? backbone? other?, REST API?, phonegap wrapper?), and voila. A zip will be generated with the generated solution. That is, code generation as a service. Maybe I could add an API to be externally consumed.

Python

I added a Flask web site example, work in progress, to my Python Samples:

https://github.com/ajlopez/PythonSamples/tree/master/Flask

I will use as a basis for my AjGenesis code generation version for Flask web sites.

Actor Model in C#

I refactored my project

https://github.com/ajlopez/Aktores

an Akka-like actor model implemented in C#. Now, I have a mailbox per actor, but the actor message process is executed consuming task from a queue, with n thread launched by the initial actor system. It was good to see such refactor working: all is in place, now. It is a proof that you don’t need to design everything before coding. If you follow TDD (Test-Driven Development) new ideas (or old ideas that have not implemented yet) can be added without much effort.

Erlang in C#

I started to add serialization of message to my project

https://github.com/ajlopez/AjErl

As usual, I started simple, using TDD: write input and out channel, using tests, red to green, refactoring. Instead of consuming an external library for serialization, I wrote a simple code, towards my first use case of distributed application. When the use case will be in place, I could start to think about other implementation path.

Google Code Jam

Past Saturday, I participated in Google Code Jam, Qualification Round. My code, usually written following TDD:

https://github.com/ajlopez/TddRocks/tree/master/Gcj2014

The Minesweeper problem is the tricky one. I should add the description of the problems, copying it from the original site.

Others

I added some code kata tests to my JavaScript samples https://github.com/ajlopez/JavaScriptSamples. I added metadata macro readind go my Clojure in C# https://github.com/ajlopez/ClojSharp. I started to add type checking in my node tree for Scala in C# https://github.com/ajlopez/ScalaSharp/commits/master. I added qualified name evaluation to my Rust interpreter in JavaScript https://github.com/ajlopez/RustScript. I worked on two non-public projects, too.

More fun is coming.

Keep tuned!

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

April 9, 2014

End Of Iteration 2014w14

Previous Post
Next Post

Code Generation

I updated my template engine in JavaScript, with a minor change to skip new lines in some contexts:

https://github.com/ajlopez/SimpleTpl

Then I consumed the new version in AjGenesis for Node:

https://github.com/ajlopez/AjGenesisNode

I published the first version of my Sinatra code generation tasks and templates:

https://github.com/ajlopez/AjGenesisNode-Sinatra

The simple generated site can manage list of entities, persisted using sqlite3 and data-mapper.

I removed bower from my Express code generation tasks and templates:

https://github.com/ajlopez/AjGenesisNode-Express

because I think it is more clear to have directly the assets in the repository, instead of installing via bower.

And I updated my Php tasks and templates:

https://github.com/ajlopez/AjGenesisNode-Php

so now it is using a first page with Bootstrap.

Complexo

I wrote a simple library to support complex number operations in JavaScript

https://github.com/ajlopez/Complexo

As usual, I wrote the code using TDD workflow. You can check the commit history.

Learning Node.js

I updated my

https://github.com/ajlopez/NodeSamples

with a simple sample of a web server. I recorded a Google Hangout (see Spanish post)

Others

Additionally, I started new code kata in JavaScript, https://github.com/ajlopez/JavaScriptSamples

I did a minor internal refactor in ScalaSharp https://github.com/ajlopez/ScalaSharp my Scala interpreter in C#.

I added a do operation to my https://github.com/ajlopez/SimpleAsync simple asynchronous library. The do operation launch a “parallel” function. You can chain do operations, to launch more than one operation. The next then or map operation will receive the result of the do operations as elements in an array, after full completion of the “launched” functions. Usually, those functions perform asynchronous calls.

I was working in two non-public projects, too.

More fun is coming.

Keep tuned!

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

March 25, 2014

End Of Iteration 2014w12

Filed under: AjGenesis, Code Generation, JavaScript, NodeJs, Ruby, RubySharp, RuScript — ajlopez @ 10:41 am

Previous Post
Next Post

Ruby Interpreters

I updated my projects

https://github.com/ajlopez/RubySharp
https://github.com/ajlopez/RuScript

The first in a Ruby interpreter in C#. I started to add the support to detect the local variables in an scope. In Ruby, there is the function local_variables() that returns a list of the names of local declared variables (not only the already initialized).

The second project is the seed to my next talk: it implements Ruby in JavaScript, as an interpreter. I added more support for modules and classes, and function declaration with and without arguments and parenthesis. I’m using my grammar/parser generation:

https://github.com/ajlopez/SimpleGrammar

It was updated to support new use cases (dog fooding!).

RustScript

I added some simple features to

https://github.com/ajlopez/RustScript

My Rust Programming Language interpreter in JavaScript. Not, it has function definition with arguments, let and let mut (mutable), some new arithmetic, bitwise and logical operators, with precedence. And a powerful assert! to start writing test programs.

ScalaSharp

I updated

https://github.com/ajlopez/ScalaSharp

My Scala interpreter in C#. The additions were simple: more node support. A node is the product of a parser, and define a part of the program. It has a type to be checked. That is the main difference with expression: a node has a type that can be inferred from the rest of the program, or by explicit declaration. As a typed language, an Scala interpreter cannot directly evaluate expression. I should check the types of the nodes, and THEN, generate a correct expression tree.

Code generation

I created

https://github.com/ajlopez/AjGenesisNode-Model

A new global tasks to be used by AjGenesis and related tasks to modify the model using command line. I started the new global tasks

https://github.com/ajlopez/AjGenesisNode-Php
https://github.com/ajlopez/AjGenesisNode-Django

to generate code for PHP and Django. There are only the skeletons, but I want to generate code for these languages/frameworks using a free model. Meanwhile, you can check the simple pages generated from:

https://github.com/ajlopez/AjGenesisNode-Express

The next big step: having a code-as-a-service application, written in Node.js, using AjGenesisNode, and deployed on Heroku.

I worked on two non-public projects, too.

More fun is coming!

Keep tuned!

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

February 7, 2014

New Month’s Resolutions: February 2014

Review of my January’s Resolutions:

- Start to implement Akka-like actor model in C# [complete] see repo
- Start to implement Scala interpreter in JavaScript [complete] see repo
- Work on AjErl [complete] see repo
- Work on Mass (I have many ideas to implement as module pattern and variable scope access) [pending]
- Work on DylanSharp [complete] see repo
- Start an implementation of ML (JavaScript? C#?) [pending]

I also worked on:

- Improving Scala interpreter in C# [complete] see repo
- Adding dot notation to Lisp interpreter in C# [complete] see repo
- Improving Ruby interpreter in JavaScript [complete] see repo
- Improving Clojure-like interpreter in C# [complete] see repo
- First templates, tasks generating Sinatra application in AjGenesis for Node [complete] see repo

My new month’s resolutions:

- Complete distributed messaging in AjErl
- Complete dot notation in AjLisp
- Improve ClojSharp
- Work on ScaScript
- Work on ScalaSharp
- Add variable scope to Mass
- Complete first version Aktores actor model in C#
- More code generation tasks, templates, models in AjGenesis for Node, generating Express, Meteor, Sinatra applications

More fun is coming

Keep tuned!

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

September 3, 2013

New Month’s Resolutions: September 2013

My past month’s resolutions status:

- Update SimpleProlog [complete] see repo
- Update Mass [pending]
- Update AjTalkJs [complete] see repo
- Update AjTalk [complete] see repo
- Update SimpleLisp [pending]
- SimpleLisp web server sample [pending] 
- New Google Hangout using Ruby and TDD [complete] see post 
- New Google Hangout using C# and TDD [complete] see post

Additional items:

- Another Google Hangout using C# and TDD [complete] see post
- Google Hangout using JavaScript and TDD [complete] see post
- Google Hangout about Exploring MongoDB [complete] see post
- Google Hangout about Code generation with AjGenesis for Ruby [complete] see post
- Update AjGenesis for Ruby [complete] see repo
- Update AjGenesis for Node.js [complete] see repo
- New AjGenesisNode module for Entities [complete] see repo
- Start new AjGenesisNode module for Express [complete] see repo
- New SimpleUnit node module for testing [complete] see repo
- Start ScalaSharp, Scala-like interpreter in C# [complete] see repo
- Improve left recursion in GrammGen [complete] see repo
- Update SimpleMongo [complete] see repo
- Give a talk about code generation with AjGenesis for Ruby [complete] see talks

and many node modules refactoring, using SimpleUnit

This month’s resolutions:

- Update SimpleForth
- Give a talk about SimpleMongo, SharpMongo
- Update SimpleMongo
- Update SharpMongo
- Update PageJs
- Update ScalaSharp
- Update JPyScript
- Update AjTalkJs
- Update Mass scopes
- Start Web Server example with AjTalkJs
- Update AjTalk
- Update AjLispJs
- Web Server example with AjLispJs
- Prepare a talk about Scala

Keep tuned!

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

March 17, 2013

AjGenesis Code Generation: News and Ideas

Filed under: AjGenesis, Code Generation — ajlopez @ 2:56 pm

Past week, I moved my open source code generation project AjGenesis (.NET version) from Codeplex to GitHub. The Codeplex site has a new compiled version (with source code and examples), AjGenesis 0.6 (Some time ago, GitHub removed the hosting of binaries downloads) (my posts about AjGenesis).

That new version is only the compiled one from Codeplex trunk. It has minor fixes and improvements, and it was used in real projects. Now, it’s time to work on the next version. Some ideas to implement:

- Refactor test, to use Visual Studio tools

- Refactor AjGenesis Web Studio, to ASP.MVC 3, using C#, Razor, and Bootstrap 2.0

- New console main program, renamed to ajgen (instead of AjGenesis.Console, a long name for this times).

- Support for commands in repositories. That is, there will new names to use with console program, like:

ajgen generate <parameters>

ajgen newentity <parameters>

that is

ajgen <verb> <parameters>

The verbs will be defined in repositories, and everyone can write the commands (at first, usual AjGenesis tasks). In this way, I could support code generation in a easy way: instead of specifying explicit task files and models, they could be located in predefined locations. In the previous versions of AjGenesis, I was reluctant to use such kind of search for tasks, but after reviewing other code generation tools integrated in frameworks (like Ruby on Rails, Django, Express) I want to explore this path.

The usual

ajgen <task or model files>

will be supported, too, without changes.

Long term goals:

- JSON support for models

- AjSharp/AjBasic as scripting languages for AjGenesis (now, AjBasic is internally coupled to the tool)

Don’t forget they are new versions of AjGenesis: AjGenesisNode implemented using Node.js and AjGenesisRuby using Ruby.

Keep tuned!

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



	
Older Posts »

The Shocking Blue Green Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 66 other followers