This is somehow related to the previous C# articles but also speaks about Windows 8 (8.1.) environment.
As you probably know already Windows 8 has it’s own store and and as it is quite new it can be a good way to make your entry in mobile devices world.
I will briefly present what languages are at your disposal when developing Windows 8 apps and get more into C# and .NET.
Windows 8 start screen supports a tiled layout, where each tile represents an application installed on the machine. Unlike a typical Windows desktop application, Windows 8 applications are built for touch-screen interactions. They are also run in full-screen renderings and lack the usual “chrome” (e.g., menu systems, status bars, and toolbar buttons) we see in many desktop applications.
Building a Windows 8 application requires developers to adhere to an entirely new set of UI design guidelines, data storage methodologies, and user input options. To be sure, a Win8 app is much more than a tile installed on the Windows 8 start screen.
Creating and running a Windows 8 application is only possible on Windows 8 and is not supported under Windows 7. In fact, if you install Visual Studio on Windows 7 (or earlier), you will not even see Windows 8 project templates appear in the New Project dialog box.
So as I previously mentioned we can develop applications in .NET (mostly any .NET aware language) and XAML which is not quite new as we do have XAML in Silverlight and WPF.
Coding a Little C++
Why C++ ?
It is much closer to the operating system than .NET and gives very fine-grained control over the UI and device interactions.
It is possible — even recommended — to build Windows 8 application logic in C++. Games, especially, benefit from the large amount of existing code in the community and strong library support. C++ applications are likely faster than HTML5 or .NET, providing an outlet for very processor-heavy tasks. And, as with .NET, C++ libraries can be consumed by HTML5 Windows 8 applications, too.
So back to the .NET and C#
Programming a Windows 8 application requires developers toR tap into an entirely new runtime layer termed (appropriately enough) Windows Runtime (WinRT). Be very aware that WinRT is not the .NET CLR, however it does offer some similar services such as garbage collection.
In addition, these applications are created using a completely new set of namespaces, all of which begin with the root name Windows.
The Windows.* namespaces offer functionality that mirrors many APIs of the .NET base class libraries. In fact, from a programming point of view, building an application for WinRT feels very similar to building a .NET application for the CLR.
As well, many of the Windows.* namespaces offer similar (though not identical) functionality as is found in the .NET base class libraries.
In addition to the Windows.* namespaces, Windows 8 applications can also make use of a large subset of the .NET platform. Collectively, the .NET APIs for Windows 8 applications, provide support for generic collections, LINQ, XML document processing, I/O services, security services etc.
Just keep in mind that .NET proper is not used to build Windows 8 applications. Rather, you will make use of new libraries (Windows.*), a new runtime (WinRT), and a subset of .NET proper (the .NET APIs) to create such a program.
The keyword here is “subset” as from my own personal experience I learned that you have limited access to what you were used to from WPF and WF applications. One simple example I can think of is that in WinRT you are not able to access an SQL Server which I find rather disturbing as not everyone has an Azure subscription and the SQLite is no match for SQL Server.
Sadly I am unable to provide you free books on this matter as there are not any good free books. However you can find plenty of resources on ACM learning platform if you have a subscription.
For that reason I will try to write more articles on this field, including Hands-ON articles to get you started as well as recommendation of other resources on this area.
I’ve got some positive feedback on the article with C# so I decided to do a bit more digging into the subject.
So, you’re interested in coding in C# but you are not really sure what is best for you. Supposedly you are not interested in Console Applications and you want something with a nice interface you have to choices: Windows Forms and WPF. In the following lines I’ll speak about the two.
Windows Forms it’s definitely easy: easy to learn, easy to use and has huge documentation, support and APIs, being here for quite a while now. There are also a lot more devs on Windows Forms than on WPF. It’s easy to learn and use because of “Drag and Drop” feature by which you can build a functional application very fast. If you are in need of an app that does something and you are not really interested on how does it look you can go for Windows Forms.
Usually, you’re using Windows Forms to do something (internal) and you don’t have much time at disposal.
Windows Presentation Foundation(WPF) on the other hand is newer, fewer devs working with it and it’s a bit harder to learn to new comers. In WPF you have much more freedom of design and if you would wanted a professional app (i.e. for clients) you should go for WPF. The look and feel is just great, it looks modern and behave accordingly. In WPF you can add lots of animations, transitions, making it suitable for end-users UI. However there is a bit of a trouble to new comers, why is that exactly?
Well, because there is an XML (XAML) component which is in charge of design and not many people are used to it first hand, but once you get used it, it’s really great: it is more maintainable, cleaner and you can control your elements very precisely.
There is also the advantage of data binding, as WPF is great with it having behind it the MVVM pattern (Model – View View – Model) .
Also, if you’re learning WPF now it’s going to be much easier for you to design and code Windows 8 (8.1) Apps or Windows Phone apps as those apps have similar behavior.
EDIT: What I forgot to mention is that Windows Forms is portable to other platforms through the Mono Project but WPF is not.
[gist id=8639173 file=WindowsForms]
[gist id=8639173 file=WPF]
To summarize, you use Windows Forms when you want something fast and you don’t care that much about the interface and WPF when you want something more elaborate and UI is a decisive factor. Keep in mind that Windows Forms it’s easier to learn and use and WPF represents somehow the future.
Today I am going to talk you about C#, what’s nice about it, why one would learn it and why should you?
C# is one of the high level languages due to its high abstractization level. This means that each instruction is translated into much machine code but it offers to programmer the possibility to express complicated things with few code lines.
C# it’s also a pure OO (Objected Oriented) Language, except for the primitive types (int, double, string…) meaning that everything is an object (there are also wrapper classes for the primitive types: Double, String …)
It has a big advantage having the syntax similar to C or C++ if you’re familiar with OOP concepts. Being an evolved language it has a garbage collector meaning you don’t have to worry about memory management.
Despite many people are saying C# it’s not portable this is not actually true. Thanks to MonoDevelop, an open source IDE (I am also contributing to it – you can too!) you can now code in C# on Linux and you can code applications for Android up to .NET 4.5 and C# 4.0.
So why is it so great?
Well, because you can do complicated stuff very easy and straightforward and it’s easy to learn if you are already familiar with C/C++.
C# has been designed to be simple and it works great. It has a the best IDE namely Visual Studio 20xx(2013 is the last version, but 2008,2010,2012 versions also exist). Some of people would say this it’s very expensive(there is also an Express version which is FREE) but for students it’s free anyway(through Microsoft’s partnership with various universities).
There is also another advantage that C# has now. You can develop applications for Windows 8 and Windows Phone 8, two fast growing OS for PC and mobile respectively.
Through the .NET initiative you can design Windows Forms, WPF (Windows Presentation Foundation), WCF (Windows Communication Foundation) applications with C#.
So, if you want to get started programming some real world applications, C# can be an excellent choice, being a modern and ever developing language.
But as I always recommend when learning something new: Work on a fun project! Learning should be fun 🙂
Some code snippet:
using System; //System is a namespace
static void Main() //Entry Point in our program
Console.WriteLine("Hello world!"); //Note that Console it's a class and WriteLine it's a method(function)
If you have further questions do not hesitate to contact me.
Now I have 2 books to start with, both free. Personally I think the first it’s better. Enjoy!