Is Blazor the next big thing for Front End Development?

Life Before Javascript

Over the past couple of years there has been a shift in web development. This comes about as a result of a change of direction which began with the release of Internet Explorer 11 in 2013. Up until then writing code which runs in a web browser instead of on a web serverwas considered optional. Browser extensions like Flash and Silverlight were the preferred options for advanced user interfaces on the internet. In the decades leading up to the release of IE11 client side code (javascript) was considered a security risk and a hassle, especially in Business Systems where reliability and functionality often take precedence and User Experience is rarely a priority. Technologies like ASP .NET MVC provided a good compromise between flexibility and rapid development however the user interface was sometimes inherently dependent on the ‘shape’ of the data. Developers usually had to manage the data through the entire stack, i.e. full stack developers. In contrast, modern Front End developers rarely write code which runs on a server and the ‘shape’ of the data is secondary. This has introduced a separation between the front end, which presents information and responds to user inputs, and the back end, which organises common business logic and accesses data at a low level.

Continue reading

HTML5

HTML5 is a specification which is used for developing web browsers like Internet Explorer.  It helps to define what the browser should do.

What is the point of HTML5?

Compatibility Issues

The problem with web development is that there are significant differences between various web browsers.  This includes differences between newer versions of a specific browsers such as Internet Explorer and differences between rival browsers.  Also there are a number of plug-in tools (e.g. Flash) which may need to be installed. Continue reading

Beginning IronPython

Okay, so you’ve read the chapter on IronPython syntax. Brilliant, learning a new programming language is easy! You feel like such a polyglot. What’s all the fuss about?  All that remains now is a few formalities. Install the framework and knock out a quick app to demonstrate how easy it is. The only problem is that nothing works and the error messages make no sense.

Back to the world of the programming beginner

You need to learn a few practical lessons before you can say that you are a competent Python programmer. It is important to be able to interpret the common error messages and structure your project.  Normally you will find that the official documents will gloss over this stuff because they like to leave it to your discretion. As a result you will find yourself searching the internet for a blog to help!

  • You can execute from the command line with ipy.exe, use the IronPython Console or the VS Tools.

Exercise calling C# code from IronPython

Use IronPython to create some tests/specifications; one static .NET CLR class and one normal .NET CLR class. The classes will be contained in an assembly project called Polyglot, as we want to use multiple programming languages in this example.

  • Greet static class. This will have one method and one property. The method accepts a parameter, a name, and the returns a greeting for that name, e.g. “Hello Jon”. The property simply returns a string “Hello World!”.
  • Math class. This class deals with simple arithmetic, does not handle negative numbers maintains a list of answers. It has Add and Subtract methods and the Subtract method throws an exception if it cannot return a positive number. It also has an array containing all the results with the most recent result at the beginning of the list.

See IronPython Code in new tab
These unit tests will demonstration how to use a unit testing framework, import and run CLR code and the difference between an instance and a type variable in Python.

Points to Note

  1. line 2: import unittest
    Use the default unit test frameworks which is similar to NUnit in .NET.
  2. line 4: sys.path.Add('C:\\sut')
    We have added a directory to the system paths. This is where I have stored to Polyglot.dll will be tested.
  3. line 5: clr.AddReferenceToFile('Polyglot.dll')
    Add a reference to Polyglot assemble so it can be called via the CLR.
  4. line 7: from Polyglot import Greet
    Specify that the Greet class in the Polygot namespace will be used. There is no equivalent command in C# because C# intrinically uses all the types in a namespace, i.e. using namespace.
  5. line 9: class GreetTest(unittest.TestCase):
    Brackets are used to inherit from a class
  6. line 10: softwareUnderTest = Greet
    A reference to the C# Greet class type has been created. This is a static class so we can call methods on the class by call the methods directly from the type reference.
  7. line 19: softwareUnderTest = Math()
    An instance of the C# Math class has been created. The new keyword is not required like in C# however we must remember to use brackets.
  8. Method definitions & self. All class level variables, methods and types are referenced with self.
  9. Indentation and white-space are important. Python uses these instead of the {} in C based languages.
  10. line 46: unittest.main() Used to execute the unit tests.

Continue reading