📜 ⬆️ ⬇️

Elephants love mangoes, part 1/2: backstage look at Evernote for Windows Phone 7

By: Damien Meyers, Evernote Client Creator for WP7

image

Introduction


A year ago, I worked in the IT department of a large retail company, managing a team of 11 people. In general, since adolescence, I have been developing software, but I always wanted to try myself in a managerial position. I sold my first two startups before they became growing companies, so the lack of management experience remained my weak point, which had to be worked on.
Then came the opposite situation. I liked the leadership work, it turned out to be quite within my power, but I also felt the need for programming in order not to lose my skills.
')
As a result, in my free time I wrote an Evernote client for Windows Mobile 6.5. It introduced a number of features that were not available in the official app, such as offline notes. And as soon as I finished working on it, Microsoft announced the reboot of its strategy in the mobile market and the release of Windows Phone 7 (WP7).

At that time, I was already beginning to understand that management was not for me and began to think about a new startup when Phil Libin, CEO of Evernote, called me and asked if I would like to join Evernote and create a client for WP7. It was very timely - of course, I agreed. And recently, we presented the first version of the client for this platform.

This is a story about what was implemented and what was not, what makes WP7 a great platform for development, and what difficulties are there. I will also try to consider the possibilities that will open with the release of the next version of WP7, codenamed Mango.


Decent development platform



Old roots

By choosing .NET and Silverlight as the basis for WP7, Microsoft immediately made the platform attractive to a large community of already existing .NET developers.

Despite the fact that I had little experience with Silverlight, I had been working on C # for many years, and now I have the opportunity to apply the skills I learned again. If you already had development experience using technologies such as Language Integrated Query ( LINQ ), lambdas, and the garbage collection, it will be difficult for you to discard them afterwards.

Silverlight has been around for several years, and although the technology has not become popular on the Internet, it is quite popular in intranet development for corporate environments.
Silverlight and the Model View ViewModel ( MVVM ) design pattern are used together. You declare that your user interface will be processed as an XML language called XAML that is declaratively bound to your ViewModel code. This means that you can test your ViewModel code separately, without having to use the user interface. Silverlight also received a fantastically convenient animation and visual presentation control system.

Excellent toolkit


WP7 developers are spoiled. Not only because we have a powerful mature and functional IDE in Visual Studio with such great plugins as Resharper, but also because we have a fast emulator, as well as a full-fledged separate designer utility in Expression Blend.

The emulator really works as a full-fledged virtual machine, using the capabilities of hardware virtualization on your computer. The advantage is that it provides high performance, but at the same time you will not be able to develop within the virtual machine, since the emulator simply will not run in it.

Blend allows you to design, develop animation and customize the user interface of the application. Although it was originally developed as a paid hi-end tool for designers, it caused a lot of emotions from developers, so Microsoft made it free for WP7 developers. It's easy and convenient to work with it, because Blend allows you to focus on the appearance and interactions of your interface and do storyboards and animation without worrying about the code.

Community


Community
The presence of a strong community around the development under WP7 cannot be called something unique, however, perhaps because of the youth of the platform, high activity is felt in the community.

In addition to the usual places, such as Stack Overflow and Microsoft’s own forum , there are sites such as Windows Phone Geek , which provide a constant influx of quality tips and tricks, as well as articles on this topic.

Components
Since the platform is still new, people are laying out new frameworks in various places, but you can see that people are starting to gather around WP7Contrib .

In the Evernote client for WP7, I used:
  1. Microsoft WP7 Toolkit
  2. MVVM Light Toolkit by Laurent Bunion
  3. PhonyTools Sean Wildermut's FadingMessage Component
  4. Fluid List Animation by Colin Eberhardt with minor changes .


Some difficulties


No database

Everyone has probably already heard about the interviews at Google, when they ask you to tell in detail about the implementation of various hashing and sorting algorithms that you will never use in practice.

Welcome to a world where this knowledge can come in handy. In the first release of WP7, there is no database technology available to developers. All that is is isolated storage and the ability to search files.

The function of storing notebooks offline along with the possibility of finding thousands of notes in a client makes the absence of a database a sensitive difficulty. A note is in the same notebook and can have zero or more labels associated with it. You can view notes by notebooks or tags, and the list of notes can be sorted by a variety of parameters, including headers, date, and location. In general, the database would be very helpful.

Several people attended to this gap and offered database technologies of different levels of complexity and completeness. I spent several weeks at the end of 2010 — beginning of 2011 trying them, and did not find one that would satisfy all my requirements. In the end, I decided that it was easier for me to make my bike, and created my own simple mechanism.

Platform errors

It is usually quite presumptuous to assume that you have found a mistake in the platform - it is much more likely that the problem is in your own code. However, in the first release of a new platform, such as Windows Phone 7, sometimes the fault lies really on its side.

For example, you cannot set focus on any control on your page after the focus has received a browser component. Or how do you fly when you try to restore the selection of the third item in the list in pivot? Or unexpected error messages in your logs? All these things I encountered turned out to be WP7 problems, quite understandable by the platform’s youth. Just be more or less ready for the fact that not only your code can be the cause of the problem.

There are also some features that you expected to find there, but they are simply not there — for example, although you can download a data stream from a site, you do not have the inverse possibility to send a stream to the site. This means that if you want to send data to the site, all information in the sending process must be in memory. This is a problem when you upload very large files.

Finally, the platform itself requires launching various functions in a UI stream in unexpected situations, such as accessing IsolatedStorage or a network connection (even if it is initiated without a UI thread and, of course, does not use the WebClient class), which can affect the performance .

Smooth scrolling

Given the platform’s emphasis on providing a fast, responsive interface, it was unpleasantly surprised at how difficult it is to implement a truly smooth scrolling when you have a lot of items on the list, including with images and possible dynamic loading. Oh yes, I mentioned that there may be thousands of such items on the list?

I used the built-in listbox. It provides user interface virtualization through VirtualizingStackPanel , which means that interface objects will be initialized only for visible elements. It also allows you to virtualize data: if the list to which ListBox is associated implements IList, then it simply requests a list of items that are currently needed, that is, you can dynamically load items from the data source as needed.

Despite these advantages, I also brought LongListSelector from the WP7 Toolkit to work. It has some interesting features, such as grouping and anchors, that tell you when the data list is in use and when it is not. It provides user interface virtualization, but it lacks data virtualization - the first thing it does is pass each item in the list to which it is attached ...

There are many articles and techniques for creating a smooth scroll. This includes loading data from background threads, and pausing loading while scrolling. But still it’s quite difficult to do everything correctly when you have a lot of elements, and not all of them are in memory.

In the next version of the client for WP7, I decided to return to using ListBox because of the advantages of a particular approach to working with IList elements, where list items are requested only when it is really difficult to do without them.

Continuation

Source: https://habr.com/ru/post/123630/


All Articles