IOS Programming Update

12 March, 2012 - 10:01 — armin

I am starting to feel better with iOS user interface programming. I know now what a view controller is actually doing, how to wire up a navigation controller that works, and how to create a table with its data source and custom cells.

I even don't feel so bad when I use XCode.

The user interface API of iOS is primarily callback-driven. That's why there is –  for each class –  an appropriate delegate class and for data controls a data source class. It's just another mechanism for delivering events to the application.

But iOS feels like a bitch API. If you forget to wire up something or just leave some values to the defaults, it often crashes or nothing appears at all. Moreover, user interface views or controllers often work only the one intended way and collaborate only with specific peers.

This “picky behavior” is very unexpected to me and requires a lot of experimentation. One way  to get along is to stay on the conservative side and do only as the documentation and example code says. This is limiting and boring!

But I do apps and not art.

  • armin's blog
  • Add new comment
  • Tweet

Why You Should Introduce Event Sourcing and CQRS in Your Company

5 March, 2012 - 21:34 — armin

Introducing Event Sourcing and CQRS has a number of interesting effects on your programming team. And on one of them I want to focus now: The integration of new features.

Developers like to create big database models before they program a single line of code. A carefully designed data model is –  so they say –  the most important part of the application.

But once you use Event Sourcing, the importance of the structure of the data model vanishes.

Have you ever had a developer saying that a feature XY is not possible, because it wasn't planned for ahead of time? Well, usually what the developer says is the following “To implement feature XY, we need to restructure our database, but because we already have

  1. a lot of data stored in the database and
  2. built a lot code that uses that structure,

it will be a hell of a nightmare to implement feature XY or ends up being a big duct tape that ripples through the fabric of space time.

In an Event Sourcing model, the modeling starts with the incoming user events and not with the data model. The data model is a logical consequence of the events and the query requirements of the application. It is not even a “model” anymore, effectively it is just a cached transformation of the events.

The resulting model and its database can –  at any time –  be recreated by replaying all the events.

So that just eliminated the problem 1 above: In an Event Sourcing model, older events don't need to change. So the old event log just needs to run against a new model that supports the events of the new feature, and tada, you've just got all your data in a new format.

But what about problem 2? What about the code that accesses the database?

Here, CQRS comes into play. When Event Sourcing covers the input to a system, CQRS covers the output of a system.

While you may need to maintain a normalized model of your data, for example to implement undo / redo support, most of your queries shouldn't be done against the model.

Note that the data in our models is not of value anymore, it can be recreated and transformed at will by replaying the events. Moreover, we can create and maintain additional models at any time.

For example, with a CQRS architecture, it is trivial to consistently maintain denormalized database tables that exactly contain all the data that the user is seeing in a particular user interface.

So your query code will automatically, and often for performance reasons, not be programmed against your normalized model, instead it queries nicely prepared denormalized tables.

This effectively simplifies and segregates your user interface queries, and in effect, minimizes the amount of code that needs to be changed.

Problems solved.

  • armin's blog
  • Add new comment
  • Tweet

C# Events

5 March, 2012 - 20:24 — armin

I really do like C# Events.

In several other popular object oriented programming languages, the only option to decouple callback functionality is to introduce another class or interface that needs to be implemented by the caller.

For example, in the Mac OS X and iOS user interface APIs, all callback functionality is implemented by Delegate classes (or protocols), of which there is one for each user interface class. These Delegate classes often need to implement a bunch of unrelated functionality that may clog up your classes.

On the other hand, the C# Event – a method call chain – allows for a fine grained and simpler binding.

C# Event handlers can be distributed to different classes. For example, for a user interface table control there could be one class handling all selection events and another one rendering the rows.

But nothing comes without a drawback. Binding to an event always introduces a bidirectional relationship with the class in question. Without clearly knowing the lifetime of the controls and their related event handlers, memory leaks are preprogrammed. To avoid them, event handling classes need to follow a strict symmetry. They should unbind themselves when their viewing component is no longer used. And C# the explicit Dispose() pattern fits nicely in that model.

  • armin's blog
  • Add new comment
  • Tweet

You Get What You Asked For

5 March, 2012 - 16:28 — armin

People don't care, they want solutions.

An SUV is a solution to a problem, imaginary or not. You don't care about the energy wasted to produce and run it and the harm it does to the environment.

iCloud is a solution to your synchronization problems among multiple devices. You don't care that Apple from now own can access and analyze all Your data.

Windows 8 Metro is a solution to Your digital lifestyle integration. You don't care that Microsoft will track all your interactions and contacts.

Facebook is a solution to spam friends and to keep up with them. You don't care that Facebook uses Your data to create a detailed personal profile and targets You with advertisements.

Most Email is sent unencrypted. You don't care if your Internet Provider and all routers that are in between can spy on Your Emails and Attachments.

GMail is a solution to free Email. You don't care if Google checks for trends, analyses your Email conversations and effectively may spy on everything that runs over their mail servers.

Dropbox is a solution to file sharing. You don't care that they store all data unencrypted on their cloud to save space. No, You even think that deduplication is a nice feature!

I am not accusing any of the companies above anymore. They just do their best to survive their competition.

Initially, a startup provides a service or a product. But to stay competitive, it needs to transform into a data-collecting and data-selling company. Effectively, they need to convert to a data recycling company. Your data is transformed into something they can sell.

And why you are happy to use their products? Because You want them for as cheap as possible.

For every problem above there is an alternative solution that protects your privacy. It offers You the service you naively asked for, often without a direct dependency to a company and without the consequences that happen when your data is accidentally released to the public.

Often hackers built these tools and services, not companies. These solutions are not as convenient and cheap as you might wish for, but they protect your privacy and your digital lifestyle.

Right now these solution are existing and are legal, you just have to look for them.

But You don't worry as long your data won't be used against you.

But are You sure that your data is not used against You at this very moment? Aren't You fearing right now that the government or some hacker may access all Your files stored in some cloud? Are You trusting high-profile competitive companies which are classified as psychopaths more then You trust your friends?

If you think I am wrong and paranoid, consider that Your Convenience may work the other way around, too.

Right now it gets convenient for governments to access Your data. Instead of directly spying on You, they just scan for your various Email, Social Networking and Cloud accounts and force the involved companies to release your data.

Once the government starts protecting itself and is enforcing law more and more by getting easy access to your data, it won't give up this feature.

And there we go, a self-fulfilling prophecy. You being convenient may –  in the end –  lead to laws that won't allow you to store and transmit encrypted data. The devices you can buy in the future may even disallow you to store data locally only. Automatic synchronization and cloud backups, which initially were a feature, may soon become mandatory.

Unintended consequences caused by convenience. By a careless majority. By users. By You.

  • armin's blog
  • Add new comment
  • Tweet

Windows 8 Consumer Preview a First Look

3 March, 2012 - 21:27 — armin

Today I installed the Windows 8 Consumer Preview. Here are my first impressions:

Most of the preinstalled Metro Apps can only be used with a Microsoft Account.

It seems that Microsoft wants to offer a complete Metro-based entertainment and communication user interface. You can rent or buy XBox games, Music, Movies and TV Shows. And manage your Email (but only with a Microsoft account) and sync your files with SkyDrive… , but also only with a Microsoft account.

For some services I see the importance for a Microsoft account, but I am a bit disappointed that the Metro Email Client does not work with any Email account. After you registered with your Microsoft account, you can only set up Hotmail, Gmail and Exchange accounts.

In this consumer preview, the Metro user interface just feels like a front end of Microsoft's answer to iTunes. Total lock-in. I am sad, such services shouldn't be allowed to be provided by the operating system. This kills independent competition. But hey, Microsoft wasn't the first one with the slogan “we do everything for you”.

The Explorer Starts up with the ribbon bar hidden.

… but probably only when you don't have a touch screen.

Metro is even more confusing to use.

Like on Android, moving around is completely irritating and there does not seem to be a common user interface metaphor. Inside of applications you can move back with the (< )button. To leave an application, you use the start menu “gesture” or Windows key. Back in the start menu, the ESC key switches from the start menu to the most recently started application. Somehow, this feels completely the wrong way around.

Moreover, the start button has been removed. From now on you need to move the mouse in the left bottom corner of the screen. This creates problems within virtual machines and presumably on multiple monitors, too. So it's safe to say that the Windows-Key is the only reliable way to get to the start menu and back to the most recently started application.

When you don't use a touch screen, you need to use the scrollbars on the bottom of the start menu. In my opinion, this is an epic failure. It makes the Metro interface unnatural to use with the mouse. Microsoft could have simply mapped a click + move gesture to scroll the content and all other move operations to a long or right click + move gesture.

Interestingly, the Bing Maps application works like expected: Click + move gesture to move the map, and mouse wheel to zoom it.

The on/off switches are not clearly reflecting their state. I can't believe that Microsoft's UI designers were not able to clearly discriminate the ON from the OFF state like Apple did.

Some context menus appear at the bottom of the screen.

When you click a Metro tile with the right mouse button, some options appear … at the bottom of the screen. May be there is some good cause behind that decision, specifically because Microsoft wanted to support multiple selection in the start screen. But it seems that most Metro apps do not support popup style context menus anymore.

You right-click an item and get some menus on the bottom of the screen. Don't we users deserve to see the options near the location we clicked at?

The App Store

There are a number of apps in the App Store already. For example, I found an Evernote client which I tested right away:

The use of the scroll bar at the bottom was again irritating and new notes are “saved” by clicking the back button.

The “new note” option appeared after I clicked the right mouse button. Looks like the right mouse button is used in Metro as the universal “show menu” button. For me personally, this “option-hiding policy” feels bit strange. And now that I know there “might be” a menu appearing when I click the right mouse button, I click the right mouse button in every screen and on every object. The Metro UI should display some kind of a menu-indicator when a menu would appear after a click on the right mouse button.

In Metro I found no way to end applications. They continue running in the background until… I don't know. I'm not sure if this is a good thing. On the iPad, background applications do rarely harm the performance of the foreground application, but I doubt that this is true on Windows.

Integration of Social Services

Microsoft tries to integrate services like GMail, Facebook, Twitter and LinkedIn, to its People, Mail and Messaging applications. But these services all ask for an Microsoft account and seem to be rerouted through Microsoft servers. This calls for a lot of trouble and privacy issues. I fear that this is an attempt from Microsoft to get hold on your social network graph and communication information.

Conclusion

My opinion hasn't changed.

For me, Metro does not offer the usability I've expected and – with this release – starts feeling like a big scam that is solely built to route and move all your data and digital interactions through Microsoft servers.

I guess – and for the reasons above, I also hope now - that like Vista, Windows 8 will fail badly this round.

A Very Bad Awakening

Since the time Microsoft announced the Metro UI as the successor for Windows 7, I was completely confused and wondered why they don't have just modified their Windows Phone operating system to work properly on tablet devices. No one actually wants Metro on desktop computers, so Microsoft's strategy made absolutely no sense to me.

Now, by discovering that all the new Metro applications are requiring a Microsoft account and connect willingly to other social and Email services, the strategy is clear to me:

What Google already did and Apple is trying at the very moment with iCloud: Microsoft just wants to index and store all your PERSONAL and PRIVATE digital data in realtime. And they even built a new user interface for it, that you can not turn off.

  • armin's blog
  • Add new comment
  • Tweet
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • next ›
  • last »
spacer
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.