Angel \”Java\” Lopez on Blog

July 26, 2012

TDD and Business Rules (1)

Filed under: C Sharp, Programming, Test-Driven Development — ajlopez @ 2:31 pm

This month I was working in an agile team, developing a non-public system. One interesting feature was that the system allows the creation and existence of domain entities with “invalid” states. That is, they are “invalid” in context: the product owner wants to build a flexible system that reflects the business reality, instead a more strict one that avoids the “invalid” states. But he wants to see which are the current “invalid” states, so the system can generate and show a list of Findings (that is the term we use in the system).

I want to explore the “TDD way” to build such feature. To be more specific, I will describe a similar domain with simplified findings.

Let be an Order. The Order has one or more Order Items. Each Order Item has a Product, Quantity, Price. Each Order has a Customer. There are business rules that describes what are the “invalid” states. Some examples:

- An Order for a Customer category Y cannot have a total amount > X.
- An Order must have one or more Order Items.
- Order Items should have Quantity > 0.
- Order Items should have Price > 0.
- Product P should have Quantity > Minimal Quantiy in each Order Item.
- Product P has a Price, and its Order Items cannot have a Price < Product Price * 0.80.
- and so on…

So, Order can be created and stored having state that broke some rules. It’s OK. The Order is NOT refused by the system. Product Owner wants to have (at any moment) the list of broker rules, the Findings.

The business rules can change, and new ones can be defined. It’s not defined how to do this (maybe, adding code, or writing an expression, Product Owner doesn’t care yet). In the initial version, the business rules can be fixed. In a second version, some rules can be applied to some orders (i.e., some rules could be applied to Orders where their customers are in Canada). Product owner wants to have: findings per order, findings per product, findings per customer.

Then, in this post series, I will show a way to build the proposed applications, using TDD. To simplify the example, no UI or persistence will be used: only domain objects and their relations in a graph. I want to explore how, using TDD, the rules and their execution emerges from the simple use cases. I will use a GitHub project, and .NET with C#.

Keep tuned!

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

July 19, 2012

REST: Links, News And Resources (3)

Filed under: Links, Rest, Software Development — ajlopez @ 4:04 pm

Previous Post

More links I collected about REST in different scenarios and technologies.

REST : ‘inverted’ architecture
http://amundsen.com/blog/archives/1115

WCF WEB API – Building Restful APIs
http://www.lewisbenge.net/index.php/2011/05/wcf-web-api-building-restful-apis/

backbone.js tutorial
http://www.plexical.com/blog/2010/11/18/backbone-js-tutorial/

Northwind Web Services
http://servicestack.net/ServiceStack.Northwind/
The Northwind Web Services Example project explores different features of ServiceStack using data from Nortwind SQlite Database.

REST and the Http Cache; with WCF Web API
http://joseoncode.com/2011/04/27/rest-and-the-http-cache-with-wcf-web-api/

jQuery AJAX calls to a WCF REST Service
http://www.west-wind.com/weblog/posts/2008/Apr/21/jQuery-AJAX-calls-to-a-WCF-REST-Service

WCF REST Configuration for ASP.NET AJAX and plain REST Services
http://www.west-wind.com/weblog/posts/2008/Apr/10/WCF-REST-Configuration-for-ASPNET-AJAX-and-plain-REST-Services

Implementing caching in your WCF Web Apis
http://weblogs.asp.net/cibrax/archive/2011/04/25/implementing-caching-in-your-wcf-web-apis.aspx

Build RESTful APIs with WCF Web API
http://msdn.microsoft.com/en-us/hh440489

Apache Sling – Bringing Back the Fun
http://sling.apache.org/site/index.html
REST based web framework, Content-driven, using a JCR content repository

Does NoSQL have an impact on REST?
http://www.infoq.com/news/2011/10/nosql-rest

Best Practices for Speeding Up Your Web Site
http://developer.yahoo.com/performance/rules.html

REST Service Discoverability with Spring, part 5
http://www.theserverside.com/discussions/thread.tss?thread_id=63283

RESTful Web Service Discoverability, part 4
http://www.theserverside.com/discussions/thread.tss?thread_id=63254

Using WCF Web APIs / WCF Http with ASP.NET Forms Authentication
http://blog.alexonasp.net/post/2011/03/02/Using-WCF-Web-APIs-WCF-Http-with-ASPNET-Forms-Authentication.aspx

Why Choose OpenRasta
https://github.com/openrasta/openrasta-stable/wiki/Why-Choose-OpenRasta

XMLHttpRequest Call
http://ajaxpatterns.org/XMLHttpRequest_Call

Sammy: RESTful Evented JavaScript
http://dailyjs.com/2009/11/05/sammy/

WCF Web APIs Roundup–Volume 2
http://codebetter.com/glennblock/2011/03/07/wcf-web-apis-roundupvolume-2/

Connecting Windows Phone 7 with ASP.NET Web Pages
http://www.microsoft.com/web/post/connecting-windows-phone-7-with-aspnet-web-pages

Windows Phone 7 and Making HTTPS REST API Calls with Basic Authentication
http://mobile.dzone.com/news/windows-phone-7-and-making-0

Rest Web Services In Windows Phone 7
http://lukencode.com/2010/08/04/rest-web-services-in-windows-phone-7/

Windows Phone – Use REST WCF Service
http://rongchaua.net/blog/windows-phone-use-rest-wcf-service/

Thoughts around REST, DDD, and CQRS: Models, Queries, and Commands
http://groups.google.com/group/the-design-of-distributed-applications/browse_thread/thread/f2295ec60ef87c77

WCF Web API is Pure Simplicity with NuGet
http://geekswithblogs.net/michelotti/archive/2011/04/21/wcf-web-api-is-pure-simplicity-with-nuget.aspx

Using MVC as a REST Service that is Accessed by jQuery/JavaScript
http://blogs.msdn.com/b/mvpawardprogram/archive/2011/09/12/using-mvc-as-a-rest-service-that-is-accessed-by-jquery-javascript.aspx

jdegoes / blueeyes
https://github.com/jdegoes/blueeyes
A lightweight Web 3.0 framework for Scala, featuring a purely asynchronous architecture, extremely high-performance, massive scalability, high usability, and a functional, composable design.

pofallon / node-bluesky
https://github.com/pofallon/node-bluesky
A lightweight, high-performance node.js library for accessing Windows Azure

flashingpumpkin / spooky
https://github.com/flashingpumpkin/spooky
Minimum viable Erlang web framework

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

Keep tuned!

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

July 13, 2012

Javascript: Links, News And Resources (4)

Filed under: JavaScript, Links — ajlopez @ 4:35 pm

Previous Post

More links about this dynamic and ubiquitous programming language:

addyosmani / todomvc
https://github.com/addyosmani/todomvc
MV* Todo apps for Backbone.js, JavaScriptMVC, Ember.js, Dojo, Spine.js, YUILibrary, Knockout.js and more

ThreeNodes.js: A Visual WebGL Scene Editor
http://badassjs.com/post/12885773103/threenodes-js-a-visual-webgl-scene-editor

Lungo.js, framework para hacer WebApps
http://www.genbetadev.com/frameworks/lungojs-framework-para-hacer-webapps

Organizing Your Backbone.js Application With Modules
http://weblog.bocoup.com/organizing-your-backbone-js-application-with-modules/

In Metro what is the recommended method of converting a JSON string into a JavaScript object?
http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/780351b6-2c0f-4637-b3fb-9b7e4a915de7

JSON and eval
http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/1249d387-9c89-4d32-89ea-d063892d5cbd

SignalRChat – Using RxJS to add live notificaitons
http://sourcecodebean.com/archives/signalrchat-using-rxjs-to-add-live-notificaitons/1321

Handling doesNotUnderstand in Jtalk
http://www.nicolas-petton.fr/2011/05/03/doesnnotunderstand-in-jtalk.html

WinJS Promise sample
http://code.msdn.microsoft.com/Promise-e1571015

Javascript Object Definition
http://code.msdn.microsoft.com/Javascript-Object-3bd3c4bd

JavaScript Strict Mode
http://javascriptweblog.wordpress.com/2011/05/03/javascript-strict-mode/

Testling
http://testling.com/
cross-browser testing platform, automate away your QA

Create your first Metro style app using JavaScript
http://msdn.microsoft.com/en-us/library/windows/apps/br211385%28v=vs.85%29.aspx

CoderDeck
http://cykod.github.com/CoderDeck/
The best way to teach the web is with the web.
Create interactive live-coding presentations.

Scaling Isomorphic Javascript Code
http://blog.nodejitsu.com/scaling-isomorphic-javascript-code

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

July 11, 2012

Compilers: Links, News And Resources (4)

Filed under: Compilers, Links, Programming Languages — ajlopez @ 9:02 pm

Previous Post

Compiling Ruby: From Text to Bytecode
http://www.engineyard.com/blog/2009/the-anatomy-of-a-ruby-jit-compile/

The Ludicrous JIT Compiler
http://rubystuff.org/ludicrous/
Ludicrous is a just-in-time compiler for Ruby 1.8 and 1.9. Though still in the experimental stage, its performance is roughly on par with YARV

closure-compiler
http://code.google.com/p/closure-compiler/wiki/SourceMaps

cl-dcf
http://code.google.com/p/cl-dcf/
Common Lisp DSL Compiler Framework

What are the available tools to compile .NET projects to standalone native binaries?
http://stackoverflow.com/questions/1240334/what-are-the-available-tools-to-compile-net-projects-to-standalone-native-binar

takeoutweight / clojure-scheme
https://github.com/takeoutweight/clojure-scheme
Clojure to Scheme to C to the bare metal.

Introducing C# To Go: a C# Compiler for Android
http://www.gregshackles.com/2011/07/introducing-c-to-go-a-c-compiler-for-android/

The Julia Language
http://julialang.org/
Julia is a high-level, high-performance dynamic programming language for technical computing, with syntax that is familiar to users of other technical computing environments. It provides a sophisticated compiler, distributed parallel execution, numerical accuracy, and an extensive mathematical function library. …
Julia’s LLVM-based just-in-time (JIT) compiler combined with the language’s design allow it to approach and often match the performance of C/C++….

Vala – Compiler for the GObject type system
https://live.gnome.org/Vala

Quick fun with Mono’s CSharp compiler as a service
http://blog.davidebbo.com/2012/02/quick-fun-with-monos-csharp-compiler-as.html

dodo / node-dt-compiler
https://github.com/dodo/node-dt-compiler
Δt compiler – async & dynamic templating engine compiler

Universal Cobol Compiler
http://sourceforge.net/projects/universalcobol/

COB2J
http://www.mpsinc.com/cob2j.html

Lispm archaeology: Compiler Protocols
http://ahefner.livejournal.com/19280.html

Outlet gets a Personality
http://jlongster.com/2012/01/16/outlet-gets-a-personality.html
If you haven’t been following, Outlet is a project I’ve been working on that compiles a Scheme-inspired language to javascript and other languages.

A guide to the CHICKEN compilation process
http://wiki.call-cc.org/chicken-compilation-process
This document describes the compilation process used by the CHICKEN Scheme to C compiler by explaining the different compilation stages on a simple example program.

Free APL Interpreters and Compilers
http://www.thefreecountry.com/compilers/apl.shtml

facebook / hiphop-php
https://github.com/facebook/hiphop-php
Source code transformer from PHP to C++

Chicken
http://www.call-cc.org/
CHICKEN is a compiler for the Scheme programming language. CHICKEN produces portable, efficient C, supports almost all of the R5RS Scheme language standard, and includes many enhancements and extensions. CHICKEN runs on Linux, MacOS X, Windows, and many Unix flavours.

The Impact of Optional Type Information
on JIT Compilation of Dynamically Typed Languages
http://www.masonchang.com/storage/papers/dls05-chang.pdf

PyPy, Tutorial Part 2: Adding a JIT
http://morepypy.blogspot.com.ar/2011/04/tutorial-part-2-adding-jit.html

mherkender / lua.js
https://github.com/mherkender/lua.js
An ECMAscript framework to compile and run Lua code, allowing Lua to run in a browser or in Flash

Parsing expression grammar
http://en.wikipedia.org/wiki/Parsing_expression_grammar

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

Keep tuned!

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

July 6, 2012

New Month’s Resolutions: July 2012

Time to write the resolutions for this new month, July 2012. But first, review of past month ones:

- Write first version SimpleStore, simple key value store for NodeJs complete see repo
- Start SimpleParser, PEG in Javascript complete see repo
- Give a talk about developing an application using TDD in .NET complete see repo
- Prepare a talk about Smalltalk Pharo partial
- Improve and publish SimpleRemote v0.0.1 complete see repo
- Improve and publish AjGenesisNode v0.0.1 pending
- Prepare and give a talk about Ruby and Node.js complete
- Implement SimpleRemote client protocol in other language pending
- New examples for AjFabriqNode pending

I added these items:

- Start SimpleStorm with samples complete see repo
- Publish SimpleBroadcast with sample complete see repo
- Start AjTalkJava complete see repo
- Start PythonSharp based on previous AjPython complete see repo
- Start SimpleTree complete see repo

New resolutions:

- Continue AjTalkJava
- Continue AjLang (Ruby-like in C#)
- Prepare and give a talk about Ruby and Code Generation
- Improve and samples AjGenesisRuby
- Refactor and samples in AjFabriqNode
- Continue DartSharp
- Prepare a talk about metaprogramming in Ruby
- Refactor, improve samples AjTalkJs
- Write a post about TDD

As usual, interesting topics and fun for me!

Keep tuned!

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

July 3, 2012

Python: Links, News and resources (4)

Filed under: Links, Programming Languages, Python — ajlopez @ 4:37 pm

Previous Post
Next Post

I’m preparing a suggested talk for the upcoming PyCon Argentina 2012. I hope they accept my talk, about strategies for implementing Python. More links in my collection:

PEP 20 — The Zen of Python
http://www.python.org/dev/peps/pep-0020/

Writing a DSL with Python
http://fmeyer.org/en/writing-a-DSL-with-python.html

Alex Gaynor — Django and Python 3 (Take 2)
http://alexgaynor.net/2011/feb/17/django-and-python-3-take-2/

PyGObject – GNOME Live!
http://live.gnome.org/PyGObject
PyGObject is a Python dynamic module that enables developers to use the power of GObject, which is part of the GNOME platform.

What gui library used by sublime text editor?
http://stackoverflow.com/questions/7102378/what-gui-library-used-by-sublime-text-editor

pyvideo.org – PyCon US 2012
http://pyvideo.org/category/17/pycon-us-2012

ShiningPanda – Hosted Continuous Integration for Python
https://www.shiningpanda.com/

GestiónLibre v1.0.0 Alpha
http://spametki.blogspot.com/2012/03/gestionlibre-v100-alpha.html

Learn Python The Hard Way | A Beginner Programming Book
http://learnpythonthehardway.org/

halgari/clojure-py
https://github.com/halgari/clojure-py
Clojure in Python

Introduction to Tkinter
http://zetcode.com/tutorials/tkintertutorial/introduction/
Tkinter is a Python binding to the Tk GUI toolkit. Tk is the original GUI library for the Tcl language.

pass by reference – Passing values in Python – Stack Overflow
http://stackoverflow.com/questions/534375/passing-values-in-python

Pythonificandose desde Net
https://docs.google.com/present/view?id=ddfg8qh9_92c6996nhh&pli=1

Planeta Python Argentina
http://planeta.python.org.ar/

ExampleLab
http://www.examplelab.com.ar/

hugoruscitti / sbfury / overview — Bitbucket
https://bitbucket.org/hugoruscitti/sbfury
videojuego de peleas callejeras

Fierro – Sistema de gestión para librerías, editoriales y distribuidoras
http://www.fierro-soft.com.ar/

MIgrar foxpro 2.5 (dos) a Python Options
http://groups.google.com/group/pythonargentina/browse_thread/thread/372632a80d96a68

PEP 1 — PEP Purpose and Guidelines
http://www.python.org/dev/peps/pep-0001/

Tutorial de Python v2.7.0 documentation
http://docs.python.org.ar/tutorial/contenido.html

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

Keep tuned!

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

July 2, 2012

Node.js: Links, News and Resources (11)

Filed under: JavaScript, Links, NodeJs — ajlopez @ 6:02 pm

Previous Post
Next Post

You can see in my GitHub account that I’m very busy writing simple programs in Node.js. More links about this technology:

Chat webapp with node.js
http://cestfait.ch/content/chat-webapp-nodejs

Moescript
http://be5invis.github.com/moescript/

Genetic
https://github.com/dolphin278/genetic
Implementation of genetic algorithms for nodejs

Beginning Node.js
http://javascriptplayground.com/blog/2012/04/beginning-node-js-express-tutorial

Esos raros lenguajes nuevos NodeJs, Scala, Clojure, Erlang, Python, Ruby – Parte 1
http://altnethispano.org/wiki/van-2012-04-14-esos-raros-lenguajes-parte1.ashx

Node.js Addons
http://nodejs.org/api/addons.html
Addons are dynamically linked shared objects. They can provide glue to C and C++ libraries. The API (at the moment) is rather complex, involving knowledge of several libraries.

Node.js extensions with C++ and V8
http://kkaefer.github.com/node-cpp-modules/

kkaefer / node-cpp-modules
https://github.com/kkaefer/node-cpp-modules
Guide for writing C++ node.js extensions

Beagle Board
http://beagleboard.org/static/beaglebone/latest/README.htm
It has a Node.js server

Build the C link
http://www.slideshare.net/nsm.nikhil/writing-native-bindings-to-nodejs-in-c

nikhilm / jsfoo-pune-2012
https://github.com/nikhilm/jsfoo-pune-2012
Native Bindings to node.js – Slides and code for the talk at jsfoo

Creating Node Addons
http://marcorogers.com/nodeconf-2011/node_addons_presentation.html
C/C++ extensions for fun and profit

node-waf: command not found
http://apphacker.wordpress.com/2011/09/12/node-waf-command-not-found/
node-waf is a tool shipped with Node.js to help build C++ files into a node.js compatible library or tool. It is only available if you installed node.js from source.
(It was replaced by gyt)

How do I get node-waf to install?
http://stackoverflow.com/questions/7051276/how-do-i-get-node-waf-to-install

LearnBoost / up
https://github.com/LearnBoost/up
Zero-downtime reloads and requests load balancer based on distribute

Node.js: Templating with Plates
http://prajeeshblogs.blogspot.in/2012/04/nodejs-templating-with-plates.html

mikeal / tako
https://github.com/mikeal/tako
Functional web framework.

Seventeen
http://nodeup.com/seventeen
A Node.js podcast

socketstream / socketstream
https://github.com/socketstream/socketstream
A fast, modular Node.js web framework dedicated to building realtime single-page apps

Bidirectional binary streams with WebSocket
http://granular.cs.umu.se/browserphysics/?p=937

oleics / node-filewalker
https://github.com/oleics/node-filewalker
Fast and rock-solid asynchronous traversing of directories and files for node.js

NodeJS – Run to Completion Semantics Options
https://groups.google.com/group/ottawa-javascript/browse_thread/thread/07b47631bdc82041?pli=1

Tim Caswell on Learning Node.js
http://siliconangle.com/blog/2012/01/27/tim-caswell-on-learning-node-js/

Node.js: Awesome Runtime and New Age JavaScript Gospel
http://bjouhier.wordpress.com/2012/04/14/node-js-awesome-runtime-and-new-age-javascript-gospel/
I am a big fan of node.js but I have a big problem with the core team. No need to hide it and pretend everything is OK. The fibers vs. callback war erupted again this week on the mailing list, with new ballistic benchmark missiles fired from both sides and showers of sarcasms.

rbranson / node-ffi
https://github.com/rbranson/node-ffi/wiki/Node-FFI-Tutorial
node-ffi provides a powerful set of tools for interfacing with dynamic libraries using pure JavaScript in the Node.js environment. It can be used to build interface bindings for libraries without using any C++ code.

rbranson / node-ffi
https://github.com/rbranson/node-ffi
Node.js Foreign Function Interface

creationix / stack
https://github.com/creationix/stack
Stack is a minimal http module system for node.js

mafintosh / protein
https://github.com/mafintosh/protein
Protein is connect compatable middleware with support for prototype methods, getters and setters

The great Node.js versus Ruby on Rails speed test
http://nodeblode.wordpress.com/2012/04/10/the-great-node-js-versus-ruby-on-rails-speed-test/

GeddyJS
http://geddyjs.org/
A simple, structured Web framework for Node.

arturadib / node-qt
https://github.com/arturadib/node-qt
Qt bindings for Node.js

Chilly
http://chillyframework.com/
Rapid Game Development
Chilly Framework is a platform for HTML5 game development. We provide the developers with a ready-made multiplayer server and game engine that make game development easier and faster. Seamlessly integrated to provide all the features one needs for adding multiplayer capabilities to a browser game. Ideal for developing new games or porting existing single player games to multiplayer

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

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