Archives
Categories
Join 88 other subscribers
The knowings and experiences of a group of developers.
(Click on the images to download)
Two more apps by the IO team.
The first is a mobfox client, mobfox is an ads provider that we have been using on our apps, and since I visit the site some times every day, I though that when eventually I get a WP7 this will be useful, at least for me xDD. The app shows all your overall and app reports, just like on the website.
The other app name is What’s Close, it uses the google services to fetch places around your current location and shows details of those locations, the rating other people gave them and lets you get directions to that location, this one was made by @Paletas.
Enjoy
In the last post I gave an overall view into the MVVM pattern, in this I will put my hands to work and give some examples on what I meant.
In the last post I refereed that the MVVM pattern have three main layers, the view, view model and model. When you are coding to Windows Phone 7 (or WPF in general) the view layer is divided in two parts:
The xaml is just xml, used to define the UI, here is an example:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <Button Content="GetBytes" Name="GetBytesButton" /> <TextBlock Name="textBlock1" Text="TextBlock" /> </Grid>
I decided to share with the world my theme on MPLAB X, since my plays on the AVR32 I’ve started working on a embedded company that uses PICs as is main architecture (yup I’m sick too). This problem aside the IDE that we use to program such devices is the MPLAB X (aka NetBeans), and since I’ve WekeRoad on eclipse and visual studio, I tried to make a clone to this IDE.
Here is the preview:
And the download link
To install just unrar to the folder : C:\Users\{your user}\AppData\Roaming\.mplab_ide\dev\v1.00\config
As I said before, me and guys are developing stuff to windows phone and what is the architectural pattern for wp7 applications? Model View ViewModel.
So MVVM came after MVC other very popular architectural pattern and I should try to explain one on the concepts of the other. The MVC uses three distinct layers to separate logic:
Probably the worst error that I’ve made when studying MVVM is to try to connect or treat MVVM as a sub-pattern or a specification of MVC. So try to avoid compare the both until you totally understand MVVM.
MVVM also uses three layers:
So what are the differences? The interaction between view and view model is similar to MVC the views notifies the view model that something happened, like a button click, some text inserted etc,etc. The difference is how the view model talks to the view, the view model never (should) call anything related to the view. As an example in MVC is common to you call the view, controller code like view.showData(data) is normal and acceptable since is the way MVC works. In MVVM the view model updates the view changing its own public properties.
With the above image, you probably figure out what is happening. The view binds its the graphic elements to properties of the view model, by doing so, it will receive notifications when those properties changed, updating the view. Consider the follow example:
class ViewModel { public string SomeText{get;set;} public ICommand SomeOperationThatChangesSomeText {get;set;} } class View { Label label; public View(ViewModel viewModel) { label.Text = Bind(viewModel.SomeText); viewModel.SomeOperationThaChangesSomeText.Execute(); } }
The value of the property Text in the View is binded to the value of the property SomeText in the view model, now imagine that the command SomeOperationThatChangesSomeText changes the value of SomeText, when that happens the labels property Text will “automatically” change to the new value setted by the command.
As you saw there is no direct interaction between view model and the view, that is nice because it completely separates the user interface logic from the business logic.
Note that this post talks only about the practical terms of mvvm there is much more to it, for more details check out the roots of mvvm in the Presentation Model pattern by Martin Fowler
In the next post I’ll show this concepts using the windows phone platform.
So has I said the second Imagination Overflow App is online!!!
This app was born on my interest to know how the thomson routers default password were generated, so I implemented the algorithm described in here, tried to optimized it so it runs as fast as possible in a windows phone and make an app around that XD. Enjoy
http://www.windowsphone.com/en-US/apps/5073c9da-9b3a-4d36-9ce7-5140c0f7a28f
On the next post I will try to explain MVVM, the architectural pattern that is embedded in the windows phone programming interface.
EDIT: I open-source the implementation of the default passwords algorithm check it out:
https://gist.github.com/1922997
So since the last post many things happened, we drop the kinect to a corner waiting for that big idea to come up and became windows phone 7 developers !!!
We all attended the Portugal code camp where we found out what the big fuzz was all about.
Today we have just submitted the second app to the marketplace, more on that later, but first check out our first app, http://www.windowsphone.com/en-US/apps/c7778f6a-de31-4e46-a996-cd5323269ce2
So this long time without posts probably is over since there is much knowledge to shar.
The last Thursday, Friday and Saturday probably were the best 3 days I had as a developer.
Me, Sorcha and PaletaS were at codebits making a cool project using kinect, Imaginect, and the experience was just awesome!!!!
Codebits can be easily described as a geeky developer convention where 800 nerds join together on the same spot to code 48h non-stop. But the chosen-ones that have been there know that the previous description is vague.
As a recent developer (+/- 4years) I always knew that in this world there were many fabulous people that have awesome ideas and skills to implement them, but I never thought that being so close to those people would effect me so much. I’m not saying that those 800 people in that place were the best of the best, but being close to so many projects and ideas really stroke me hard.
Whatever I looked I saw great things being constructed, I saw people working with Kinect creating innovative ways to interact with the PC, I saw people using Augmented Reality to create new ways to see the world, I saw people reinventing products giving them news ways to be used, and a lot more.
That kind of environment is really contagious, I always thought that it would be a little overwhelming, and that showed on the project that we did. Nothing fancy or good, but considering the lack of knowledge on the Kinect SDK and the XNA framework we did something in 48h, namely understand concepts and utilization of those frameworks. That may not seem hard, but when I say understand we really mean understand, not doing something with it XDD.
Imaginect3D were born, the idea? A simple modulation application for developers that don’t really want to understand complicated applications like blender to make simple 3D objects for they game or app. The final application didn’t do much, just a non-physical mouse (kinect style), a simple menu with 4 3D primitives, a way to select them and place them on the world, using voice. But in the process we defined and implemented a way to make rotation and scale just with gestures, that may not seem much but try to define a way, touch-free to rotate a 3D object on all possible axis (x,y,z). The lack of time and experience on making this kind of speed projects were noticed when we didn’t incorporate all the different parts that we develop thorough the project in the final application.
But we have fun, and learn stuff, a lot of stuff and we did win a Kinect XDD, so probably our second try on imagine cup will use Kinect. Imaginect3D is on our github repository check it out.
Today me and some colleges were discussing random stuff as usual, somewhere in the middle someone said something about XML, I yawn (as always) and a discussion started about my XML hate relationship.
When I learnt XML (2 or 3 years ago) I loved it, it was easy to understand, very declarative and readable. But back in those days I knew nothing about the computer world, I only knew java and C, I didn’t knew what the hell was design patterns, code conventions, pretty code, etc.
When I learnt JSON I didn’t really understand its purpose so it was one more way to send data from one place to another.
Today I’ve a different view on how code and information should look like: namely, simple, concise, easy to read and the most important should be easy to write (low on chars). This last characteristic is probably the most important since its less memory used to save the data or less bandwidth used to exchange data, etc.
At first JSON seems perfect, it’s much more readable than XML and more compact. Then there is the underground MGraph by Microsoft with a really appealing syntax and is more compact than JSON, the problem is its inventor, Microsoft. The hardcore open-source community would never accept using something made by Microsoft so an overall usage would be automatically denied. Finally there is the YAML, my shame in all of this, since until today I never tried to found out what it was.
Let’s see it first, YAML version:
Course: Name: Web Programming Teacher: ATeacher Year: 2011 Grades: - Student: Student A Value: 17 - Student: Student B Value: 18
The XML version;
<Course Name="Web Programming" Year="2011"> <Teacher> ATeacher </Teacher> <Grades> <Grade Value = "17"> Student A</Grade> <Grade Value = "18"> Student B</Grade> </Grades> </Course>
Is it really necessary more comments? No, I fell in love with this new way to show data. Maybe I’m going to make a blog series on this, seems a really nice thing.
YAML have all the characteristics that I enumerated before, people will say that XML will always be here, because things like HTML, config files and schema support. The question is, isn’t XML a bit outdated? Its syntax didn’t get better or evolve with the technology, it’s pretty much the same thing that SGML (invented in the 60s), are we too accommodated with XML? Since when did the computer world stop searching for the best next thing? Think on it.
Resources: