
Microsoft introduces Universal Windows apps - chris-at
http://wmpoweruser.com/microsoft-introduces-universal-windows-apps/
======
yulaow
This is imho the best news ever from microsoft. Now I can target serverside,
frontend, windows8 devices and windowsphone all with one language (javascript
for me). Not bad at all

update: I have to add other news just announced. With winJS now we can target
also xboxone, ios and android device And also the full framework is opensource
under apache license

update2: winJS on github
[https://github.com/winjs/winjs](https://github.com/winjs/winjs)

~~~
frozenport
Couldn't you do this with javscript before and also get MacOS, Linux, and
Android? Anything with a web-browser?

~~~
kevingadd
win8's js framework isn't just a browser with your code in it. They expose
pretty much all of their API surface to JS with JS-friendly APIs and things
like promises for async calls, so you're not stuck using dumbed-down apis or
calling out to native code shims for things HTML5 can't do yet.

------
gum_ina_package
The amazing thing is that you can potentially write all your code in C# and
have backend/frontend logic for the web (ASP.NET), Windows, Windows Phone, and
even iOS/Android (via Xamarin). Wow.

~~~
fleitz
The amazing thing is that you can potentially write all your code in C and
have backend/frontend logic for the web, Windows, Windows Phone, OSX, FreeBSD,
OpenBSD, Tru64, VAX, Arduino, Linux Kernel, Windows Kernel, Mach, Hurd, and
practically every processor or operating system ever built, and even
iOS/Android (via Xamarin). Wow.

You can even link to and reuse that code from languages such as: C++, C#,
Java, Ruby, Perl, Python, assembler, lua, scheme, lisp.

The future is gonna be so 1970.

~~~
gecko
C# is a much higher-level language than C, with a much richer set of libraries
that can be relied upon to be everywhere. That's why it matters.

~~~
berkut
You can rely on C# being on all platforms by default? Linux and OS X? Really?

Last time I used Windows (several years ago), there were always apps that
needed to download and install the latest version of the .NET runtime... - is
that still a thing?

~~~
dragontamer
int main(){ puts("Hello World"); }

This doesn't work in Windows. The standard entry point to Windows is "int
CALLBACK WinMain( _In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In_
LPSTR lpCmdLine, _In_ int nCmdShow );"

C never really "ran" on Windows. C is built on top of abstractions to even run
on Windows. A SegFault in standard C is supposed to be passed to a signal
handler (in Linux/ OSX).

A SegFault in Win32 is passed to the SEH exception handler, to the __except{}
statement in some function as the stack is unwound. (Oh yeah, __try{} and
__except{} don't exist in "normal C", do they?)

\--------------

The "OS Language" of Windows is C++ (through COM and COM+ interfaces). The "OS
Language" of Linux and OSX is C.

The sooner you realize this, the easier programming on Windows is going to be.
Windows never really supported C as a first class citizen. C code cannot
easily call core Win32 libraries like DirectX. (It can, but it is
significantly harder than just using the C++ COM interfaces)

C# works very closely with COM interfaces in Win32. And thus, C# is the second
language of choice of Windows. The only reason C# hasn't overtaken C++ in
everything seems to be politics.

Mind you, Microsoft fully supports C# Device Drivers. The lowest level
hardware interactions in Windows can be done with C#.

~~~
billforsternz
I always thought that the whole WinMain() thing was an ugly mistake. The right
way to do this would be to organise the libraries and startup code so that the
simplest Windows GUI program was not 50 or 100 lines of boilerplate, but was
instead something like;

    
    
      #include <windows.h>
      void main()
      {
        WinGuiInit();
        WinGuiMessageLoopRun();
      }
    

Or similar. Extra functions and parameters as required to setup custom icons,
window classes, message handlers, whatever.

~~~
Jare
At least they provide the mainCRTStartup thing [1] so you can use main() in
GUI executables. Regarding boilerplate, Win32 was designed as a very low level
API, with MFC and other high level libraries to make things easier.

[1] [http://stackoverflow.com/questions/11785157/replacing-
winmai...](http://stackoverflow.com/questions/11785157/replacing-winmain-with-
main-function-in-win32-programs)

~~~
billforsternz
I didn't know about the mainCRTStartup thing, thanks. But it should have been
the default - to me WinMain() is just a failure to understand what is best
exposed and what is best encapsulated. My boilerplate reduction proposal is to
provide a few helper functions to optionally avoid exposure to some of the
pipework - just to make life a bit easier when starting out. MFC on the other
hand is a massive new layer of compromises and other crud slapped over the top
of the Win32 API - somehow managing to make it even more cryptic (YMMV). Also
MFC postdated the Win32 API by a few years, so presumably wasn't considered as
the first choice solution at the start. The first Petzold book was a C thing,
MFC and C++ came later.

------
emeraldd
I'm still trying to figure out how/why this makes sense as a goal. Building an
application that runs across multiple platforms in congruent spaces makes
sense: iOS and Android and Windows Phone. When you move to running the same
application across Laptop vs. Phone style platforms, even on modern hardware,
you're looking at capabilities and resources that are radically different. I
can see wanting to share certain common code, but a library system ala npm,
bundler, cpan, etc., would handle that better than sharing a common code
base/project. What am I missing?

~~~
svas
The real key here is sharing business logic.

Microsoft apps are written using the MVVM (Model View, View-Model) framework.
The idea here is that you would share almost all of your model code, and
really only rewrite the view layer (XAML) per platform. You're also allowed to
share the exact same views across platforms, but it's unlikely that will be a
good experience for users, given the differences: screen sizes, input
modalities, etc.

~~~
tdicola
How is this really different from what exists today? You can write in C# for
pretty much every MS platform already. If you're smart you're already writing
your business logic with as little dependencies as possible on view specific
logic so it's more testable, portable, etc.

~~~
svas
Not sure if you have tried doing this. In practice, it's quite painful as you
need to have a separate visual studio project file for each platform (phone vs
tablet).

Further, the Phone implementation of WinRT is a subset of the tablet's, so
sticking to the WinRT API alone isn't enough. Complicating matters further,
the phone lets you actually use a Win32 subset which is not allowed on tablet.

This (appears to atleast) unify everything towards more of a write once, run
on all windows platforms world.

------
r00fus
Beware Apple, Google: Microsoft is starting to _get it_.

~~~
taiki
What about the internals? Is it still kind of a mess under the hood?

I heard they rebuilt the TCP/IP stack so it's not user land 32 bit driver
anymore.

Any ideas if/when they'll modernize NTFS? Right now it's a race to the bottom
to who has the worse FS, HFS+ or NTFS. WinFS or ZFS on OS X would be a
godsend.

What about the registry? Any idea if they'll make that easier to manage for
regular people? Am I still fucked if it corrupts?

What about sunsetting Win32? Or improving the driver model?

They're starting to get it on the UI side, but the reason why I use Mavericks
as my personal machine and work on a LAMP stack has less to do with how useful
or pretty the start menu is, and more to do with the godawful internals of
Windows. Or have we just resigned ourselves to a crappy OS internally that
we've all just gotten used to?

~~~
bananas
No it's rock solid underneath.

The TCP stack hasn't been a 32-bit driver since XP.

NTFS has been modernised already:
[http://en.wikipedia.org/wiki/ReFS](http://en.wikipedia.org/wiki/ReFS)

The registry is fine - it's people pissing around in it that break it.

Win32 - haven't touched it for years. Driver model: not my problem.

Mavericks is a crime compared to windows 8.1. I use both, regularly. It's
virtually impossible to use efficiently with a keyboard unless you have
twisted mutilated hands to hit meta keys galore and half the apps don't
actually survive more than 2 minutes without crashing.

~~~
tomwilson
All these points are fine but theres no reason to flat out lie about the
quality of Mavericks....

1) Keyboard shortcuts are fine, if u use a OSX all day every day you will
think Windows shortcuts are bad. That and you can edit pretty much every
single shortcut in OSX if you are really that offended by them.

2) If your apps are crashing every 2mins (or even more than once a week...)
your computer is f'd.

~~~
bananas
No they're horrible, inconsistent between apps and put emacs to shame.

It is fecked. Its a 2011 MBP with NVidia graphics. Total waste of money that
was. Totally unreliable machine.

------
keithwarren
I think the most significant part of this announcement is how they are
dogfooding, Office for 'metro' and for the windows phone are using this
Universal targeting.

~~~
sz4kerto
They've been dogfooding for decades, that's a very core part of the developer
culture at MS. (You can say many bad things about them, but they really do
dogfooding all the time.)

~~~
danabramov
Kind of... Still, they didn't use .NET, Windows Forms, WPF and countless data
access layers in their core products (Office and Windows), which probably
contributed to the fact most of these frameworks got obsoleted every few
years.

------
svas
Interesting move in the right direction. I wonder if they'll take it further
and let you write iOS and Android apps using Xamarin / Mono?

This would actually provide an easy path for developers to get into the
Windows ecosystem while ignoring the whole market share issue. Combine first
class integration with an awesome IDE (Visual Studio), and frankly way better
tooling than Eclipse this would be a pretty compelling reason for me to use
Xamarin, and by extension have a Windows run target for my app.

------
keithwarren
This just in...Universal apps run on Xbox one.

~~~
majc2
This is interesting - Xbox one is their most interesting platform right now.

------
majc2
Looking at twitter it seems like XAML is getting a ton of love from MS. Go
back 2 years and many were predicting that HTML was going to win the war on
Windows; what gives/what's changed?

Disclosure: written more XAML than I'd care too.

~~~
tanzam75
What happened was that most third-party developers refused to use WinJS, and
stuck with XAML:

[http://www.zdnet.com/windows-8-developers-are-shunning-
winjs...](http://www.zdnet.com/windows-8-developers-are-shunning-
winjs-7000025443/)

------
tdicola
One thing I don't see mentioned, do universal apps support C++11? I can
understand why it's not as easy to support native code across platforms (i.e.
need to do some kind of fat binary thing), but think it's a little sad to see
all the work done to support modern C++ app development kind of abandoned.
Really annoying if you have to choose between an app being universal or
written in modern C++.

~~~
dragontamer
Microsoft is one of the biggest supporters of C++11, and C++14 for that
matter.

[http://msdn.microsoft.com/en-
us/library/hh567368.aspx](http://msdn.microsoft.com/en-
us/library/hh567368.aspx)

~~~
mnem
Well, they're certainly catching up, but they have a bit to go to before they
match clang or gcc: [http://cpprocks.com/c1114-compiler-and-library-
shootout/](http://cpprocks.com/c1114-compiler-and-library-shootout/)

------
SixSigma
They need a funky catchphrase, how about :

"write once, run anywhere"

~~~
jsight
Think pure thoughts. :)

(for those who don't get the reference:
[https://www.youtube.com/watch?v=bGX7N-CoaPo](https://www.youtube.com/watch?v=bGX7N-CoaPo))

~~~
mitchty
I'm resisting saying Write once, debug everywhere. This sounds cool, but the
road to this hell has been littered with many failures.

Dammit, there goes my resistance. Which apparently is futile. I'll show myself
out.

If this does work its a cool things. Just microsoft needs to make c# and the
.net framework open source and actually cross platform. Mono is a non starter
for a lot of places.

------
be5invis
I am wondering whether they can make Windows Runtime's GUI avaliable for
existing desktop appliacations. There are many professional applications needs
a brand new API for user interface.

~~~
masterj
I believe they also had a segment about this for sideloaded apps.

------
amaks
Haven't looked at the APIs, but are the APIs going to scale between phone,
tablet and 30" 4K monitors? It's relatively easy to make the same app to be
adaptable between phone and tablet, or even laptop, but to make it look good
on 30" 4K monitor is a completely different UX, if full screen. Or in high
resolutions the apps run in windowed mode?

~~~
sz4kerto
You can adapt any part of the app. I.e. you can simply migrate the app to be
universal across devices, but if a specific part does not look good, then you
can change the XAML/code behind for that part.

~~~
amaks
But do these "universal" apps still run full screen on 30" monitor? If so,
then it's not a good UX. The benefit of a large high resolution monitor is to
display lots of information at the same time, this frequently implies more
than one app/window visible at the same time.

~~~
revisionzero
Yes, unless I am missing something. It's up to the developer (same as on Web
w/ CSS Breakpoints) to accommodate the various 'breakpoints' or devices
visually. To say it's poor UX is inaccurate, will there be plenty of
unoptimized UI/UX full-screen apps? Sure, but the functionality itself is not
poor UX.

------
lnlyplnt
This seems similar to Google's tablet/phone strategy taken to it's natural
extreme. This makes me wonder if google will soon do something similar with
the (currently separate) Chrome/Android ecosystem.

~~~
sz4kerto
I don't think it will -- it's really hard for MS to provide the tooling for
making universal apps more or less feasible, even if they all share most of
the WinRT APIs. Integrating Chrome/Android will be much harder.

------
snarfy
They really need to go both ways with their cross platform offerings.

I can use their technology to develop apps for other platforms, but I cannot
use their technology to run those apps. That requires having the other
platform.

It would be nice if I could not only develop cross platform apps for iOS,
Android, and Windows Phone, but I could also run them on their Windows Phone
platform. I would buy a windows phone if it could do that.

~~~
ManFromUranus
Why would they want to help you provide content for Android?

~~~
snarfy
Because I would do it using their tools, so it would also be content for
Windows Phone.

Given the current state, why would I bother making content for windows phone?
Why use C# if it's a second class citizen on the majority platforms? Why even
learn it if the only thing it's good for anymore is Web API?

Windows could be the universal platform but instead they are still functioning
like it's something they could monopolize. Those days are over.

------
bhauer
Exciting! This is getting progressively closer to an ideal I call PAO
(Personal Application Omnipresence [1]), wherein I use a single set of
applications on all my devices. I am very happy to see progress in this
direction, but there is still much more to be done in the future.

[1] [http://tiamat.tsotech.com/pao](http://tiamat.tsotech.com/pao)

~~~
gress
Sounds like iWork.

------
rurban
Better description: [http://techcrunch.com/2014/04/02/microsoft-updates-
visual-st...](http://techcrunch.com/2014/04/02/microsoft-updates-visual-
studio-with-support-for-universal-projects-typescript-1-0-and-net-native-code-
compilation/)

------
jarjoura
I see this as equivalent to writing one application that targets both iPhone
and iPad and even Android with one app targeting tablets and phones. The only
really new thing is support for a single application but the design and UI
work still needs to be addressed for each screen size.

------
tluyben2
Some people here have mentioned this already but I am quite surprised with all
the happiness and it's nice but... I have been writing apps on my Mac
targetting asp.net, ios, android, wp8 and win8 with a lot of reuse and perfect
frontends for two years. I love f#/c# and it works like a charm. Business wise
it is nice that you have to pay only once but outside that what in god's name
is so nice or special about this? I was hoping this would include a build
system on Azure and a unified system using Xamarin all from VS. This is
nothing at all. Wow I can target those 3 wp8 users from my win8 codebase app.
Pfff. So it's just fanboys or almost nothing changes or I am missing some
significant thing even though I am quite deep in this ecosystems for years
now?

~~~
nbevans
Agreed, it's been possible for years, especially with PCL libraries gaining
significant traction last year. But these announcements and improvements have
made things even easier than before. And to a certain extent have made what
was once somewhat a "black art" to the layman C# devs now a official
development track.

Not sure why you've been downvoted for stating facts. So I +1'd.

~~~
tluyben2
Probably because my tone and term 'fanboy'; I said it very carefully even as I
am not anti MS or whatever; I use F#/C#/.NET every single day and like it. But
apparently that was enough to trigger :) Thanks anyway; I was just surprised
why suddenly whole HN seemed to hail in the new messiah... Easier is nice,
but...

------
kenferry
So is this Silverlight but for WinRT apps instead of WPF apps?

------
mamcx
OK, and where is the code?

------
0x006A
They must live in quite a bubble if "universal" only includes Microsoft
platforms.

~~~
gagaga
I guess Google and Apple also live in a bubble? Not really sure what your
point is. Is your expectation that Microsoft Universal apps also run on
Android and Google? On Web browsers? Would you like them to use a different
term?

~~~
pekk
Throwing around words like "universal" suggests a real cross-platform API, not
"convergence of Windows with Windows Phone". Lots of people would like to see
real cross-platform, not more vendor lockin.

------
frozenport
I'm shocked this didn't happen sooner. If you ever wanted to point to a
problem with MS vision you can ask yourself why this didn't happen in 2005.

~~~
rkuykendall-com
I think your underestimating the INSANE amount of vision and foresight that
would be required to do this in 2005.

1\. The xbox 360 was released in 2005. This was essentially the first
Microsoft console to run 'apps,' and those had to be architected specifically
for the console.

2\. The iPhone was years away in 2005. Phones ran shitty little apps that had
to be architected specifically for the phone.

3\. The iPad was years away. Microsoft tablets just ran XP. The idea of the
iPad as a "bigger iPhone" was mocked to no end when it was announced. People
thought they wanted OS X on a touchscreen. Microsoft would have thought the
same thing.

4\. gMail has just been released. The idea of a true "web app" required
remarkable vision and foresight by itself. Additionally, web apps had to be
architected specifically for the browser (seeing a pattern?).

Even if Microsoft had seen 5 years into the future and predicted all these
changes, the platform they would have created in 2005 wouldn't have had
anything to run on.

~~~
streptomycin
The idea of a centralized "app store" was not new. People had been complaining
about Windows not having Linux-like package management since the 90s.

Similarly, the idea of web apps taking over everything was not new. Microsoft
was acutely aware of that, since that was Netscape's big idea (also Java was
in theory the same threat - write once, run anywhere, make Windows
unimportant). Again, all in the 90s. This is the most fundamental answer as to
why MS didn't do this stuff before. Not because of a lack of foresight, but
because their foresight was good enough to allow them to identify it as a
threat to their monopoly.

Touch screen phones/tablets I agree were less obvious predictions, but even if
MS did figure that out early on, it wouldn't have changed their motivation to
fight back against Netscape and Java and similar technologies.

But now the tables have turned...

~~~
72deluxe
Microsoft had an application store in Windows XP. Remember "Find
applications"? They had an online store of sorts that listed programs, but
nobody bought anything on it because there didn't appear to be any vendors on
it, and CD-ROMs were all the rage back then. App Stores have only really taken
off as Internet speeds have sky-rocketed. That was not the case when XP was
released; everyone was on dialup or barely slow ISDN if they were lucky.

