Month: March 2010

Windows Mobile 7, Silverlight and XNA


Hi.

Today at Mix2010 it was revealed the oficially the Windows Mobile 7 SDK. As expected it’s possible to create applications using two of the most popular frameworks.

XNA: It’s like a nice wrapper for DirectX. So, very intensive graphics, sounds and high performace applications can be built on this framework. It’s important to mention that XNA does not include (at least in previous versions) a GUI library, so it’s not like a RAD framework.

Silverlight: Silverlight is light framework for developing rich and interfactive applications. Particularly Windows Mobile Supports a special subset of Silverlight 3 (currently the Web Version of Silverlight is reaching number 4). BTW, I mean with a special subset that this Silverlight mobile does not support all the features of SL3, and also it includes features that are special for Windows Mobile.

What next??

In the mean time I’ll¬† have to continue learning about python and Google application’s engine. However my friend Antonio Baker (aka arbot) has publish a small sample where he show how easy is to create applicatinos with this new SDK (using blend and the phone simulator). Check it out at http://abakerp.blogspot.com/2010/03/my-first-windows-phone-7-app.html

I’ve collected some topic from the MSDN site that I consider might be important wherther or not you have had experience with silverlight.

Getting Started Guide for Developing for Windows Phone
http://msdn.microsoft.com/en-us/library/ff402529(VS.92).aspx

Code Samples for Windows Phone
http://msdn.microsoft.com/en-us/library/ff431744(VS.92).aspx

Porting SL Apps to SL Mov Apps
http://msdn.microsoft.com/en-us/library/ff431808(VS.92).aspx

Reactive Extensions for .NET Overview for Windows Phone:
http://msdn.microsoft.com/en-us/library/ff431792(VS.92).aspx

Media on Windows Phone
http://msdn.microsoft.com/en-us/library/ff426928(VS.96).aspx

Optimizing Windows Phone Emulator Performance
http://msdn.microsoft.com/en-us/library/ff402567(VS.92).aspx

How to: Handle Manipulation Events
http://msdn.microsoft.com/en-us/library/ff426933(VS.96).aspx

Saludos,
Herberth

Advertisements

XNA y Windows Mobile 7


Hi,

This year there is an amazing new, XNA platform will be supported included as a Framework to develop Windows Mobile Applications.

See http://www.ozymandias.com/break-with-the-past-bright-new-future-windows-phone-application-development-platform-built-on-xna-and-silverlight

And it’s even better because of it will support 3d ;-).,. Also for those who want to built enterprise applications they can use Silverlight ūüėČ

Regards,

Herberth

Google Apps Engine: Python’s Way


Hi

As part of my welcome pack for developing in Google Application Engine (aka GAE), I had to chose between two languages: Java or Python. Because of my most recent work involves C# most of the time, the most obvious option wasJava. However, the client has their systems in Pyhon… so? I’m mastering Python in 3 days ;-).

THE LANGUAGE

My first approach was reading the language specification (it wasn’t a very smart option). So, my second attempt was using Wikipedia (aka wiki) to know more Python. Luckily Wiki has a good idea of how to define Python‘s language.

http://en.wikipedia.org/wiki/Python_(programming_language)

It might emphasize some points:

  • Python is a high-level programming language ( It means, that you don’t have to think as if you were coding for assembler)
  • It supports many programming paradigms (imperative, functional and object oriented). IMHO it’s a really strong functional programming language.
  • The syntax is simple to read, however I think if you aren’t¬†familiar¬†with functional languages, it would be good to start reading the tutorial instead of getting directly into the code. If you need to check some functional programming concepts you can take a look to http://en.wikipedia.org/wiki/Functional_programming
  • The language has a set of implementations (or flavors). So the main concepts are shared among implementations, however there might be particular details in some specific flavors. BTW, some popular flavors are CPhyton, IronPython, Python, and JPhython.

THE PLATFORM

First of all, you’ll need to get Python at www.python.org/. Then, you can decide if you want to use an IDE or just a text editor. I strongly recommend to read the Pythons official tutorial at http://docs.python.org/tutorial/, ¬†(and sadly I cannot explain python in a post, and it will be impossible for being a novice on this language ).

ADDITIONAL SDKs

Then if you want to install Google’s App Engine, it might be a good moment for doing it. ¬†;-), it can be downloaded at http://code.google.com/appengine/. Certainly you might need to add additional packages to your python installation depending on what need to do.

THE DEVELOPMENT ENVIRONMENT

Another important aspect of learning a new language is selecting the right tool. Ok, here there are some purists that suggest to learn by using simple text editors instead of an advance IDE for developing. It’s up to you whether or not to use an IDE.

Now, let’s talk about the tool. The best free tool I’ve found it’s Eclipse (http://eclipse.org/downloads/)and you can use a plugin called Pydev (www.pydev.org/) in order to support pythons develelopment. ¬†At this time pydev offers a really nice set of tools, such as:

  • debugging
  • code coverage
  • code snippets
  • refactoring
  • code¬†auto-completion
  • And all the other¬†steroids that are already included in Eclipse (such as projects structure, the chance to integrate to a source control tool… etc)

I can suggest to see the following link in order to get quick getting started about how to set up eclipse and python.  The video might be outdated, however this guy goes direct to the point in how to set up your environment and take advantage of the pydev plugin see at http://blog.vlku.com/index.php/2009/06/10/djangoeclipse-with-code-complete-screencast/

If you wan to know more about pydev and it can do for you, you can check http://www.pydev.org/manual_adv_complctx.html

I’m running out of time, so this is it for today. Unfortunately, I haven’t became the Pythons expert that I wanted… however I’ve spent only 3 days reading about python ;-). ¬†It’s a good start for me (considering that python is not the only thing that I’m learning …. sigh ….)

Anyway, happy coding!

Herberht

Google App Engine


Hi,

Today, I’ve started a new assignment, it’s about learning the Google Application Engine (aka GAE), and BTW I’ll have to write Python Code.

At most of the newbies guys, I’ve started following the Getting Started Project at GAE’s home page (see http://code.google.com/appengine/)

The Getting Started is a good way for knowing the most basic capabilities of the Google’s Cloud. I would like to mention some of the features of the Google’s cloud:

  • Storing Data.
    My college David Mora from Schematic mentioned that Google has adopted an implemented of ¬†NoSql model (see http://en.wikipedia.org/wiki/NoSQL )¬†instead of the traditional Relational Model. The particular implementation is known as BigTable. Because of It’s a cloud environment there are concepts such as Load balancing are redundancy handled ¬†by the Database framework.
  • Support for Python and Java.
    Applications can be ¬†developed using Python and Java. Additionally, it’s possible to take advance of frameworks that are currently installed in the Google’s servers.
  • Eclipse and Google App Engine:
    There isn’t a official tool for development, except for the Google App Engine Launcher (aka GAEL). GAEL lets users¬†develop¬†locally in a sandbox, and prepare¬†everything¬†for a easy deployment to the Google’s cloud. Besides, It’s possible to use Eclipse and plug ins for a more robust (and free) developing environment. ¬†(see http://code.google.com/appengine/downloads.html)
  • Services: There are a lot of services available for developers. Users can take advantage of these service to create more colorful applications. For example, it’s possible to use Google Account service, Memcache, XMPP, among others.

Currently, all Google users can open a free account, and create their own content. The GAE’s home provides a lot of documentation , which makes difficult to select where to start :-S.

Well, that’s my first step in the Google’s Cloud, and the Google’s Application Engine. I hope to post more detailed information in future posts.

Herberth

Prism break #1: The Composite Application


The beginning

Change is the only constant in software development. However, not all the coding styles are easy to adopt changes, even though we consider that our “the code is very flexible“. For example, lets take a look to the following C#¬† sample:

var myConn = new SqlConnection(myConnectionString);
// perform some operations using the myConn instance.

At very first sight we might thing it’s flexible enough,… however it’s not as flexible as we might think. The only thing we can change is the connection string ( which only works for Sql Connections). We cannot specify a new data source e.g. MySql, SysBase, or a XML feed. So, is it really flexible?

Through the time developers have managed to hide this dependency by using composition and encapsulation. For example we can hide the fact that we are using an instance of SqlConnection by using composition:

public class Connection
{
   private SqlConnection myConnection;
   public Connection {
      myConnection = new SqlConnection("...");
   }
   // ... more public methods for users of this class
}

This approach seems to solve our dependency problem, however we still kinda of tight to the SqlConnection, we can argue that all the layers build over this Connection class, might depend of the SqlConnection class.

So, in fact if we would like to create tests, we will need to specify a SqlConnection to use our Connection class in middle layers. This might be painful if you consider that you’d like to create unit tests where each test will depend of the connection, instead of having more specific data sources to perform accurate tests.

So, what’s next? Simple, developers has used others ways to make the functionality less dependant of the implementation. A first approach is the pattern Dependency Inversion.Which tries to handle contracts (aka interfaces) instead of the concrete implementation of the contract. So, we can rewrite:

public class User
{
   IConnection _connection;

   public User (IConnection connection) {
      this_connection = connection; //
   }
   // ... public methods that depends on the Connection interface (contract)
}

In the previous example, it’s possible to take advance of the all the functionality provided by the connection without knowing if it’s a SqlConnection, MySqlConnection or even a XmlFile. The functionality is exposed by the contract, and we receive by parameter the implementation that has to be used by the class.¬† This makes the User class depend on the contract instead of the concrete implementation of the contract.

Certainly this model makes appear a new issue. In a supeior level of our structure the concrete implementation has to be instanciated, and this in fact is what makes our code less flexible.

public class UserView
{
   private IUser _currentUser
   public UserView (IUser currentUser){
      this._currentUser =  currentUser;
   }
   // ... so... where does the concrete implementation of User come from?

There are more patterns that solve the issue of the creation of objects, for example we can provide a class that
handles the instantiation of the objects. For example:

public class TopLevelClass
{
   private IUser _currentUser
   public TopLevelClass {
      this._currentUser = Creator.GetInstance<IUser>();
   }
   // ... more methods
}

In this example, the Creator class knows which concrete implementation of IConnection should used in the instantiation of User. This could be specified in a configuration file, or by code. This process of providing instances and injecting its dependencies is known dependency injection. Currently there are several frameworks that allows users to handle the instantiation of the objects in the application.

So, for changing an implementation for the entire application it might be as easy as change a setting in a configuration file, and provide a concrete implementation.

Prism and Dependency Injection

Composite application uses as Microsoft Unity to implement Dependency Injection. Even though the Unity library is already included with Prism, it’s optional to use it. Also, It’s possible to use other Dependency Injection framework, such as Microsoft Extensibility Framework (aka. MEF) which also is provided by Microsoft.

References:

Tame Your Software Dependencies for More Flexible Apps @ http://msdn.microsoft.com/en-us/magazine/cc337885.aspx

Regards,

Herberth