Friday, February 12, 2016

Using Google Translate & Microsoft Translator services in Scala in a non-blocking way

I am happy to announce the creation of an idiomatic Scala library named fluent-translator for working with Microsoft, Google etc. language translation services. This Scala library aims to provide an universal fancy DSL for working with all popular language translators around. And do it in a reactive non-blocking way. Currently Microsoft Translator and Google Translate services are supported.

I'll put few sexy usage examples below:
 Microsoft give me a translation of "Comment vas-tu?" to "en" as future //Future[String]  
 Microsoft give me many translations of "Doing well by doing good" from "en" to "ru" as future //Future[GetTranslationsResponse]  
 Microsoft speak "I'm doing well enough now" in "en" withAudioContentType `audio/mp3` as future //Future[SpeakResponse]  
 Google give me a translation of "Comment vas-tu?" to "en" as future //Future[String]  
 Google give me a translation of "What a lovely weather today!" from "en" to "fr" withContentType `text/html` as future //Future[String]  

You are welcome to use/contribute it on GitHub. And I'll be glad to hear your suggestions as well.

Friday, April 24, 2015

Comparing covariance/contravariance rules in C#, Java and Scala

Different programming languages support variance (covariance/contravariance) in different ways. My goal is to compare all supported types of variance in C#, Java and Scala, and to reason about why some architectural decisions have been made by language designers.

 
C#
Java
Scala
Arrays covariance+
(unsafe at runtime)
+
(unsafe at runtime)
_

(arrays are invariant by design)
 
Though, there is support for Java's "covariant" arrays, of course.
Arrays contravariance___
Generics variance
(covariance/contravariance)
+

Defined by a generic type creator (definition-site).
 
(Restricted to generic interfaces and generic delegates)
+

Defined by clients of generic type using wildcards (use-site).
+

Defined by a generic type creator (definition-site).
 
Also, there are existential types that cover Java's wildcards functionality.
Overriding: return type covariance_++
Overriding: parameter type contravariance___

Sunday, November 9, 2014

Subprojects in PlayFramework 2.3 (Scala): overcoming difficulties

After struggling a bit to configure a Play 2.3 application (Scala) to work with subprojects (including another Play application) I've decided to create a simple example on GitHub.

Things to pay attention to:
  • Build.sbt in the Root project to configure modules
  • Root's conf/routes to attach Play subproject's routes to the routing system
  • Play subproject's routes in modules/{subproject-name}/conf/{subproject-name}.routes
  • Play subproject's build.sbt without unnecessary information
  • Play subproject's controllers and views reside in additional subpackages {subproject-name}
  • Explicitly added Assets controller in Play subproject
  • How assests are referenced in Play subproject's main.scala.html

Sunday, August 17, 2014

Introducing Antler Framework to the CodeProject community(Part II)

Welcome to read another article about Antler framework on the CodeProject in which I dived into details of implementing configurable Unit-of-work and ORM adapters.

Saturday, May 31, 2014

Introducing Antler Framework to the CodeProject community

I've just posted an article introducing our open-source framework Antler to the CodeProject community.

The concepts explained in the article:

  • Antler framework is an abstraction over ORMs
  • Antler framework is an abstraction over IoC containers
  • Antler framework improves testability of applications that use it
  • Antler framework has pluggable structure

If you are interested you are welcomed to dive into the details on the CodeProject.

Monday, March 31, 2014

Antler Framework: TeamCity build server for our open source project


We are pleased to announce the launch of TeamCity build server for the Antler Framework for public viewing.

It is available here.

Antler Framework is a pluggable framework for .NET to work with popular ORMs(NHibernate, EntityFramework Code First) using the same syntax. GitHub: https://github.com/SmartElk/Antler.

Thursday, February 27, 2014

Antler Framework: Releasing 2.0 Version

Antler is a pluggable framework for damn-easy good-style working with different ORMs using the same syntax.

"Pluggable" means that you can easily switch, say, between NHibernate and EntityFramework Code First using one line of code. Also you can easily switch your IoC container: currently we have Castle Windsor and StructureMap adapters.

Configuration example (using EntityFramework ORM + Castle Windsor container):
 var configurator = new AntlerConfigurator();  
 configurator.UseWindsorContainer().UseStorage(EntityFrameworkStorage.Use.WithConnectionString(connectionString).WithMappings(assemblyWithMappings));  

Antler Framework has strong architectural background out of the box: you can easily build your layered design using build-in support for UnitOfWork, Repository etc patterns.

If you are interested you are welcomed on GitHub:
https://github.com/SmartElk/Antler