Category Archives: developer

Using Visual Studio Code to develop cross platform mobile applications using Apache Cordova

Well, the Microsoft OpenSourceSoftware love-in continues with the latest release from the tools team of TACO for Visual Studio Code. What this means is that you can now create Mobile Apps for Android and Windows (and IOS) using Visual Studio Code.

There are certain pre-requisites of course, having NodeJS installed, then installing Cordova as global.

If you haven’t installed Visual Studio, you may need to install the Windows Phone SDK.

If you want to support IOS, you’ll need an OSX machine, whether it is a Macbook, Macbook Air, or just a Mac Mini, it doesn’t really matter.

If you want to build to Android, ensure you have the Android SDK saved on the same computer you will be developing on. If you want to build for Windows Phone, well done, you’re doing the world a solid #breaktheapplefanboymonopolybydevelopingonawindowsphoneforfunandprofit.

Having said all that, go ahead and create a new folder for your project. Let’s just call it something relevant like “applesux”

Open up Visual Studio Code, and open up your folder.

Next, install the command palette by going via the menu, View>Command Palette or by pressing Ctrl-Shift-P then typing “install” and selecting Extensions. Then when the extension list appears, type “Cordova” and you should see the Cordova Tools by Visual Studio Mobile Tools.

Install the Cordova Extension

Select Cordova Extensions

Restart Visual Studio code, when prompted, then develop a mobile app.

Well, have fun and take care!

Oh, how funny am I!

Anyway, as long as Cordova and NodeJS were installed earlier, you’re ready to add your platforms.

Let’s start with the main platform, Windows Phone.
https://cordova.apache.org/docs/en/latest/guide/platforms/wp8/index.html

Open up a terminal console in the same “applesux” folder, and add a sample app for cordova by entering

cordova create . com.applesux.hello HelloWorld

You should see the Cordova files in the folder, so now it’s time to pick the intelligent platform of choice Windows 10 8 :\

Cordova platform add wp8

You should now be able to build to the windows phone!

To do that, you need to first set up the environment, by clicking on the debug icon on the left, then clicking the cog to get to the settings. Select the Cordova environment and make a cup of tea.

Having drinked the tea, maybe have a biscuit and another cup of tea. You’ll need the bathroom now, so don’t forget to wash those hands.

Being rehydrated, and calm, we can get on to building for windows phone. You’ll notice that in the Cordova config there currently (2016-01) is no support to debug on Windows phone (bet you’re glad you had that nice cup of tea), for that you’ll need Visual Studio (community will do).

No support for windows 10 debug, yet
No support for windows 10 debug, yet

Keep an eye out on the mobile tools blog for Windows Phone appearing. I’m guessing they’re readying up a windows phone 10 package for Cordova and release everything alongside that.

Instead, lets just “totes ship it (citation : needed)” as they say around the Silicon Roundabout.

Go back to the command prompt which you opened in your project folder, and type

Platforms/wp8/cordova run --device --release

You will now have a .xap package (zap) which you can deploy on your development phone in the /platforms/wp8/bin/release folder.

Search Windows for the “Windows Phone Application Deployment” tool by typing it into the windows 10 search box.

Windows Phone deployment

Browse to the release folder and select your xap. Make sure your dev phone is connected and click “deploy”.

Enjoy the fruits of your labour.

The experience for building Android and IOS apps is a bit better as building and debugging can be done through Visual Studio Code, but Windows 10 support won’t be that long coming, and I’ll update this post accordingly.

Until then, take care.

 

 

 

Entity Framework – When to use what

In Entity Framework there are three ways of utilising the ORM, one enables you to get straight into coding (code-first), one enables you to rip a database into a new model (database-first) and the final one enables you to create a model independent of the database or your final code (model-first).

But, when should I use each of these methods?

Each method has its pro’s and con’s, and personally, I don’t really use code-first that often as it lends itself to a build where everything has been fully architected beforehand, and all you’re doing is building to spec. Something I rarely encounter, as the initial green field development is often a very agile process, especially if you’re utilising a TDD/BDD development cycle.

So what scenario would you legitimately use Code-First?

Say you have a very small micro-service to build, such as an auditing service, and you already know the database fields, and possibly the service will only know its connection at runtime. Code-First is an ideal solution, as it enables you to quickly knock out the code, leaving the spinning up and implementation of the database to the EF settings in config. The main drawback I find of Code-First is that if you’re database schema is not set in stone, a rebuild of your EF model will necessitate a destruction of the database. You can create a custom upgrade path, but this is rarely done. So, if you have a unchanging model, for a small data footprint, code-first is great.

Code-First is also great for proof-of-concept builds that may be knocked out in a day to show a particular prospect of development.

Database-First is obviously good for where your development is bound to a database schema which already exists and is quite complex. You can just use the EF designer in Visual studio to generate the model and get up and running very quickly. A database schema change will mean that the EF model will need to be recreated, but its generally no big deal as the database will be keeping its data integrity due to it being developed in its own development domain by DBAs or other colleagues.

Model-First would generally be used to map out a logical structure of the data which bridges both the system model and the database model. Say you wish to use a different paradigm of data design in the database to your model (flat-file DB with a relational ORM). It could also be the case that you are tasked with a data-design task where you need to develop a schema that satisfies the requirements of the database team and the architect, utilising a colourful database like Oracle or MySQL to fit.

I hope this helps your decide the approach to use when implementing Entity Framework in your work.

Take care

Coming soon to your company?

 

Available from : September 2016

I’m going to update this post with my availability, so if you want to chat, give me a call. My resume and contact details are on the main page at www.neilhighley.com. Mention you saw this post and I’ll call right back!

My current role involves mainly desktop development and Industrial Hardware controllers. It’s a little different from what I normally do, but it seemed a good fit for my current interests in IOT and they’re actively using TDD and BDD for their production pipeline.

Online and Offline Software Developer available for C#, HTML, CSS, JavaScript roles from the start of November. I have almost 20 years commercial web experience and consider myself multistack, having worked across the multiple industries in a lot of positions throughout software development and operations.

Blog address: http://blog.neilhighley.com

Github repo: http://github.com/neilhighley

Main Site: http://www.neilhighley.com

Devpost: http://devpost.com/neilhighley

Daily Rate available on request.

ASP.NET 4 / 4.5 / C# / LINQ / jQuery / Javascript / REST /  XML / Visual Studio 2013 / Resharper / Git / MSSQL  / IIS8 / Windows Server / MSSQL /  CSS3 / HTML / TDD / KnockoutJS / Angular 1.0 / Azure

PHP / WordPress / MySQL