Angel \”Java\” Lopez on Blog

July 17, 2014

ScalaSharp Simple Scala In C# (1) The Idea

Filed under: .NET, C Sharp, Open Source Projects, Programming Languages, Scala, ScalaSharp — ajlopez @ 6:32 pm

I wrote something in this blog, but it’s time to introduce it to society. Last year a few months ago, I started the project:

https://github.com/ajlopez/ScalaSharp

A simple interpreter for a simplified Scala, C #. I do not intend to implement all Scala as a compiler for CLR. NET. My intention is to explore an alternative implementation of interpreter, adopting only some “light” features of Scala.

Without being a Scala programmer (or amateur or professional) my impression is that Scala as a language and library, is something like "too much", a bit overwhelming. People adopts Scala because it is more flexible, less need "boilerplate" etc.. But it seems like Scala went too far. Having programmed in Java and C#, I think the latter, adding a few things (delegates years, lambdas, extension methods, "generics" in the VM, and recently, in asynchronous input/output, async, await), has managed to stay healthy, without major complications. See how easy it has been to implement LINQ with evaluation "lazy" and others.

Instead, Scala seems to me like it’s too many things, all together. From what I saw, type inference is a feature that is not so necessary in the real projects. And yet I can not accept that the list of operators in Scala occupies more than one web page. But hey, that’s the current state of things. People Scala is working on a new implementation, called Dotty. But if you are just doing after years of language definition, I have to declare: "too little, too late."

That does not preclude recognizing that Scala has great triumphs, non-trivial applications like Play Framework and Akka. Akka is a very interesting project. I think we don’t need so many new language features (just the ones I mentioned for C #). We need more libraries that solve some issues (such as the implementation of an asynchronous HTTP message distribution server or distributed processing among actors).

To experiment with a simplified Scala, and to deliberately practice TDD (Test-Driven Development) in C #, I started the project ScalaSharp.

It is a challenge for me, because it is not a simple interpreter. I want to implement an AST (Abstract Syntax Tree) that detects inconsistencies between types. In my previous experiences, as RubySharp, PythonSharp, and Mass language, it was only necessary to assemble a tree expressions / commands and evaluate it. Now I’ll have to check that the types are correct. For example, one variable that is typed, and that their assignments, the expression to be evaluated and assigned for the type of the variable. You can see some of the work in progress:

https://github.com/ajlopez/ScalaSharp/tree/master/Src/ScalaSharp.Core/Ast

where there is a node tree with types, versus commands and expressions to be executed and evalauted:

https://github.com/ajlopez/ScalaSharp/tree/master/Src/ScalaSharp.Core/Commands
https://github.com/ajlopez/ScalaSharp/tree/master/Src/ScalaSharp.Core/Expressions

Upcoming topics: implementation details, control types in the AST transformation commands / expressions. The good thing to do with TDD is that it allows me to go implemented the solution as I define use cases.

Stay tuned!

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

July 11, 2014

Play Framework: Links and Resources (1)

Filed under: Java, Links, Play Framework, Scala, Web Development — ajlopez @ 1:56 pm

http://en.wikipedia.org/wiki/Play_Framework

Play is an open source web application framework, written in Scala and Java, which follows the model–view–controller (MVC)architectural pattern. It aims to optimize developer productivity by using convention over configuration, hot code reloading and display of errors in the browser.[1]

Support for the Scala programming language has been available since version 1.1 of the framework.[2] In version 2.0, the framework core was rewritten in Scala. Build and deployment was migrated to SBT, and templates use Scala instead of Groovy.

http://www.playframework.com/

Advanced routing in Play Framework – all that jazz
https://jazzy.id.au/default/2013/05/08/advanced_routing_in_play_framework.html

Christopher Hunt on Software Development: Play-ing with WebJars
http://christopherhunt-software.blogspot.com.au/2013/05/play-ing-with-webjars.html

JsZipper : Play2 Json advanced (& monadic) manipulations – Mandubian Blog
http://mandubian.com/2013/05/01/JsZipper/

huntc/play-spring · GitHub
https://github.com/huntc/play-spring
A sample Play application with the minimum configuration required to support Spring JSR-299 and JSR-330

guillaumebort/play20-spring-demo · GitHub
https://github.com/guillaumebort/play20-spring-demo
Using Spring from within a Play 2.0 application

Stupid Java Tricks » Play Framework 2.1: The Bloom is Off The Rose
http://www.stupidjavatricks.com/?p=278

Observations on the Play! framework | James Gregory’s Blog
http://lostechies.com/jamesgregory/2011/09/18/observations-on-the-play-framework/

#98 Support for optional trailing slash – Play framework 2.0 – play
http://play.lighthouseapp.com/projects/82401/tickets/98-support-for-optional-trailing-slash

Abnorm: A better non-ORM // Speaker Deck
https://speakerdeck.com/marconilanna/abnorm-a-better-non-orm

Play CMS
https://github.com/joergviola/play-cms
https://github.com/codeborne/play-cms
https://github.com/TheOrganisationOn/play-cms
A simple CMS to be able to edit pages, page fragments and images using a WYSIWYG editor

parroit76-play-cms – port of play-cms to version 2.0 of play framework – Google Project Hosting
https://code.google.com/r/parroit76-play-cms/

julienrf/play-scala.g8 · GitHub
https://github.com/julienrf/play-scala.g8
g8 template for Play applications

What startups or tech companies are using Play Framework? – Quora
http://www.quora.com/What-startups-or-tech-companies-are-using-Play-Framework

yobriefca screencast
http://yobriefca.se/screencasts/

Introduction to Play Framework
http://blueskybd.vo.llnwd.net/o16/oracle/CON3845_mp4_3845_001.html

yanns/play2-scala-DI · GitHub
https://github.com/yanns/play2-scala-DI
Technical prototyp to test different dependency injection solutions.

Sadek Drobi, the Play 2.0 Story and what’s new in 2.1
http://www.infoq.com/interviews/sadek-drobi-play2-story-new-21
CTO of Zenexity, a Web Oriented Architecture Company, Sadek is a software engineer specialized in bridging the gap between the problem domain and the solution domain. As core Play developer and co-creator, he works on the design and implementation of the framework. Twitter: @sadache Photos: http://www.flickr.com/photos/37675274@N03/ Blog: http://sadache.tumblr.com

Iteratees in Big Data at Klout « Klout Engineering
http://engineering.klout.com/2013/01/iteratees-in-big-data-at-klout/
In this blog post we describe the usage of Play! Iteratees in our redesigned data collection pipeline.

My Links
http://delicious.com/ajlopez/playframework

Stay tuned!

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

May 13, 2014

Akka: Links, News And Resources (8)

Filed under: Akka, Distributed Computing, Java, Links, Scala — ajlopez @ 10:08 am

Previous Post

Streaming Twitter API in Akka and Spray | Cake Solutions Team Blog
http://www.cakesolutions.net/teamblogs/2013/12/08/streaming-twitter-api-in-akka-and-spray/

Akka persistence webinar
http://www.slideshare.net/patriknw/akka-persistence-webinar

Intro to Akka persistence with Patrik Nordwall – YouTube
https://www.youtube.com/watch?v=r5lecCBazvE

Community Page Reinvisioned | Akka
http://akka.io/news/2014/03/12/community-page-update.html

Prabhath’s Bolg: Integrating an Akka.io actor system with Play framework (A distributed message classifier with Akka.io and Play framework)
http://psuminda.blogspot.com.es/2014/02/integrating-akkaio-actor-system-with.html

Martin’s Programming Blog: Distributed Actors in Clojure
http://martinsprogrammingblog.blogspot.com.ar/2012/05/distributed-actors-in-clojure.html

Fun doesn’t mean compromising scalability – all that jazz
http://jazzy.id.au/default/2013/12/17/fun_doesnt_mean_compromising_scalability.html

Using Scala Implicits to Implement a Messaging Protocol
http://derekwyatt.org/2014/01/01/using-scala-implicits-to-implement-a-messaging-protocol.html

Camel — Akka Documentation
http://doc.akka.io/docs/akka/snapshot/scala/camel.html

Post: Akka Extras Email
http://blog.eigengo.com/blog_posts/akka-extras-email

oxlade39/STorrent
https://github.com/oxlade39/STorrent
BitTorrent client written in Scala using Akka

scala – How to create minimal Akka actor? – Stack Overflow
http://stackoverflow.com/questions/17632234/how-to-create-minimal-akka-actor/17638135#17638135

scala/src/library/scala/concurrent/impl/ExecutionContextImpl.scala at master · scala/scala
https://github.com/scala/scala/blob/master/src/library/scala/concurrent/impl/ExecutionContextImpl.scala#L33

My Links
http://delicious.com/ajlopez/akka

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 3, 2014

New Month’s Resolutions: April 2014

Review of my March’s resolutions:

- Work on DictSharp [complete] see repo
- Give talk about Node.js Distributed Applications [complete] see repo see online slides
- Improve SimpleGammon [complete] see repo
- Improve Annalisa [complete] see repo
- Add @for to Templie [pending]
- Work on PreciosaAnnalisa online web services [complete] see repo
- Improve my Node.js Distributes Applications samples [complete] see repo see repo see repo
- Work on ScalaSharp [complete] see repo
- Improve ClojSharp [complete] see repo
- Improve SimpleAsync, do operation (functions in parallel) [pending]
- Improve Aktores [pending]
- Distributed messages in AjErl [pending]
- Add variable scope to Mass language [pending]
- Start code generation as a service [partial]

Additionally, I worked on:

- Complexo, simple complex numbers operations in JavaScript [complete] see repo
- Started RustScript, a Rust programming language interpreter in JavaScript [complete] see repo
- Continue RuScript, a Ruby interpreter in JavaScript [complete] see repo
- Continue RubySharp, a Ruby interpreter in C# [complete] see repo
- Started AjLispScala, a Lisp interpreter in Scala, using TDD and SBT [complete] see repo
- Recorded a second video Node.js Spanish tutorial [complete] see post

For this new month, my resolutions are:

- Continue AjLispScala
- Continue AjGenesisNode-Express
- Continue AjGenesisNode-PHP
- Continue RuScript
- Continue RustScript
- Distributed Messages in AjErl
- Give a talk Intro to Node.js
- Publish a new Node.js video tutorial

More fun is coming.

Keep tuned!

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

April 1, 2014

End Of Iteration 2014w13

Previous Post
Next Post

AjGenesis Agents

I started to add agents support to AjGenesis for Node, Express tasks:

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

The idea of agents is: instead of having code to render or produce page, code, classes, the agents are queried to solve problems: render this field, render this input, create the validation code, etc. Each agent could accept or not the problem: if an agent specialized in Angular detects that Angular is not being used in the application, then it is not loaded. Work in progress.

Ruby in C#

I updated:

https://github.com/ajlopez/RubySharp

My Ruby interpreter in C#. I added local variables detection. Ruby is a language where the local variables used in an scope can be listed. I wrote code to retrieve the name of local variables from expressions.

Clojure in C#

I worked on:

https://github.com/ajlopez/ClojSharp

There are a few new primitived forms and special form, and more parser/lexer support.

Scala in C#

I started to add dynamic object support to

https://github.com/ajlopez/ScalaSharp

The idea is to have objects with defined methods. Maybe, I will re-implement the object without dynamic methods: these should be defined at compile time, instead of runtime. I’m thinking about the definition of classes for many objects, and singleton classes for only one object.

Rust in JavaScript

I updated my Rust interpreter in JavaScript:

https://github.com/ajlopez/RustScript

with the support of modules, and public functions exposed in modules. I should add the references to them, using double colon operator.

AjLisp in Scala

To practice TDD and the use of SBT (Simple Build Tool), I started:

https://github.com/ajlopez/AjLispScala

Where I’m reimplemented AjLisp ideas in Scala, using scalatest library for TDD

JavaScript Samples

To explore WebGL, canvas, and implement some code katas, I created:

https://github.com/ajlopez/JavaScriptSamples

WebGL is not easy: lot of details to setup an scene. Canvas examples were borrowed from other of my projects. To practice TDD, I started to wrote simple code katas, using SimpleUnit and Node.js

I was working on two non-public projects, too. More fun is coming.

Keep tuned!

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

March 8, 2014

New Month’s Resolutions: March 2014

Filed under: AjErl, C Sharp, ClojSharp, Clojure, Erlang, Open Source Projects, Scala, ScalaSharp — ajlopez @ 7:27 pm

Review of my February’s Resolutions:

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

To compensate missing coding, I worked on:

- Create Annalisa [complete] see repo with online web services and demo
- Start SimpleAsync [complete] see repo
- Create my first Meteor samples [complete] see repo
- Start Templie, a simple template engine in Java [complete] see repo
- Start SimpleScraper, a simple scraper in JavaScript/Node.js [complete] see repo

And I made minor improvements on DylanSharp

New month’s resolution:

- Work on DictSharp
- Give talk about Node.js Distributed Applications
- Improve SimpleGammon
- Improve Annalisa
- Add @for to Templie
- Work on PreciosaAnnalisa online web services
- Improve my Node.js Distributes Applications samples
- Work on ScalaSharp
- Improve ClojSharp
- Improve SimpleAsync, do operation (functions in parallel)
- Improve Aktores
- Distributed messages in AjErl
- Add variable scope to Mass language
- Start code generation as a service

More fun is coming.

Keep tuned!

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

February 24, 2014

Akka: Links, News And Resources (7)

Filed under: Akka, Distributed Computing, Java, Links, Scala — ajlopez @ 11:11 am

Previous Post
Next Post

ThreadPools
http://www.playframework.com/documentation/2.2.x/ThreadPools

chanan/AkkaGuice
https://github.com/chanan/AkkaGuice

typesafe.com
http://typesafe.com/blog/running-a-2400-akka-nodes-cluster-on-google-compute-engine

Distributed Publish Subscribe in Cluster — Akka Documentation
http://doc.akka.io/docs/akka/2.2.3/contrib/distributed-pub-sub.html

Microkernel — Akka Documentation
http://doc.akka.io/docs/akka/2.2.3/scala/microkernel.html

Typesafe Blog – PlayFramework – Blog – Typesafe
http://typesafe.com/blog/PlayFramework

yngui/akka-disruptor
https://github.com/yngui/akka-disruptor

Dispatchers — Akka Documentation
http://doc.akka.io/docs/akka/snapshot/scala/dispatchers.html

rogeralsing/Pigeon
https://github.com/rogeralsing/Pigeon
Akka in C#

Getting Started Tutorial (Scala): First Chapter — Akka Documentation
http://doc.akka.io/docs/akka/2.0.2/intro/getting-started-first-scala.html

My Links
http://delicious.com/ajlopez/akka

Keep tuned!

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

February 19, 2014

End Of Iteration 2014w07

Filed under: .NET, C Sharp, Iteration, JavaScript, NodeJs, Open Source Projects, Scala, ScalaSharp — ajlopez @ 7:15 pm

Previous Post
Next Post

A lot of interesting topics and code.

MeteorSamples

I started to explore Meteor:

https://github.com/ajlopez/MeteorSamples

You can see one of my samples deployed at:

http://mycompany.meteor.com/

A simple CRUD (WIP) application. Next steps: code generation using AjGenesis for Node.js, mobile look, and wrap up as a PhoneGap application.

I also wrote posts:

Programming Meteor (1) First Steps
Meteor: Links And Resources (1)

ScalaSharp

My Scala interpreter in C#:

https://github.com/ajlopez/ScalaSharp#

I started to switch from a tree of expression to a tree of nodes (a classical AST). In this way, I could implement type checking, compilation, etc… visiting the node tree. There are differences between an expression and a node. A node could be a name, but that name, in Scala, could be a val, a var, or a def. I have not the full context to decide what kind of expression to invoke. So, I need a previous step. A node is the first parser output. A tree node could be visited, performing type checking and then producing the correct expression.

SimpleReact

Inspired by Meteor .autorun method, I wrote a react library in JavaScript

https://github.com/ajlopez/SimpleReact

As usual, simple code, using TDD workflow.

SimpleScraper

I continue adding features to

https://github.com/ajlopez/SimpleScraper

A simple JavaScript library to process an HTML string. I should add more features, and write a sample, scraping an e-commerce site.

Others

A minor addition in ClojSharp https://github.com/ajlopez/ClojSharp using recur in a function

Completing the model in https://github.com/ajlopez/AjGenesisNode-Express supporting that an entity references another entity.

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 14, 2014

Akka: Links, News And Resources (6)

Filed under: Akka, Distributed Computing, Java, Links, Scala — ajlopez @ 3:23 pm

Previous Post
Next Post

You know: I’m interested in actor models in general, and Akka implementation in particular, having distributed applications. I started two projects implementing Akka ideas, in Node.js and in C#:

https://github.com/ajlopez/SimpleActors
https://github.com/ajlopez/Aktores

Now, more links of my collection of links:

mrb: Distributed Systems Archaeology: Ricon West, 2013.10.30
http://michaelrbernste.in/2013/11/22/distributed-systems-archaeology.html

Using Akka in Scala IDE – Stack Overflow
http://stackoverflow.com/questions/13585927/using-akka-in-scala-ide

Pacific Northwest Scala 2013 Akka in Production: Our Story by Evan Chan – YouTube
http://www.youtube.com/watch?v=c1heorOM2LE

Akka vs Storm | Blog of Adam Warski | Planet JBoss Community
http://planet.jboss.org/post/akka_vs_storm

Akka in Production: Our Story
http://www.slideshare.net/EvanChan2/akka-inproductionpnw-scala2013

typesafe.com
http://typesafe.com/blog/typesafe-gets-sprayed

Typesafe Reactive Platform Acquires New High-Performance HTTP Foundation
http://www.marketwired.com/press-release/Typesafe-Reactive-Platform-Acquires-New-High-Performance-HTTP-Foundation-1841738.htm

Dev Time: Cope with Failure – Actor Supervision in Akka
http://blog.florian-hopf.de/2013/10/cope-with-failure-actor-supervision-in.html

Akka Work Pulling Pattern to prevent mailbox overflow, throttle and distribute work » Michael on development
http://www.michaelpollmeier.com/akka-work-pulling-pattern/

Going Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
http://www.slideshare.net/jboner/going-reactive-eventdriven-scalable-resilient-systems

Let it crash • Where Akka Came From
http://letitcrash.com/post/40599293211/where-akka-came-from

Typed Channels (EXPERIMENTAL) — Akka Documentation
http://doc.akka.io/docs/akka/2.2.1/scala/typed-channels.html

My Links
http://delicious.com/ajlopez/akka

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 65 other followers