Desktop Application deployment options

Most of the time the deployment is more of a business decision and not only technological. Here are some deployment options you can choose based on the that:

  • Windows Store 
    • It takes care of publishing and updates for you.
    • limitations: Windows 8.x +, sandbox environment
  • ClickOnce
    • Microsoft’s solution to deploying your WPF app (but not UWP).
    • takes care of packaging your App, Installing it and Updating it.
  • Squirrel
    • Another Installer and Update framework, like ClickOnce
  • Chocolatey
    • distribute your app and easily publish updates. It requires the user to install Chocolatey on his PC and then use the command line to install and update your app
  • The custom solution:
    • use an Installer and develop the update mechanism yourself. Its job is to package the application into an installation program.
      • InstallShield – It’s very feature rich and always up to date with the latest technologies. It is very used with Windows applications. It can create MSI, EXE, and UWP app packages installers. It has its own scripting language to write custom jobs.
      • Inno Setup is a popular free installer and works by by creating a text file (.iss) file which contains your installer’s settings and scripts. It has good documentation and a good-sized community. It produces only EXE files though, not MSI. On an update, InnoSetup will uninstall the previous version and install the new one.
      • Wix is another popular free installer. It has a steeper learning curve than InstallShield and Inno Setup, but it can produce MSI files which can be a big advantage.
    • publish your product version install files to a known network location, and the Desktop Application will endlessly query that location for new updates.

Desktop Application UI Frameworks

Some reasons for developing a desktop application:

  • The application doesn’t have to be connected to the internet
  • You can interact better with the user’s PC. Web applications run in a sandbox environment and block almost all interactions.
  • Desktop apps have better performance than web apps
  • Running serious algorithms on the client side is possible but much harder with a web application.
  • Utilizing Threads is much easier and more effective in a desktop application.
  • Sometimes you don’t care if the application will be Web or Desktop, but your team is more experienced with Desktop technologies

There are a lot of UI Frameworks for desktop application:

UWP – Universal Windows Platform – Microsoft’s newest Desktop Application technology. It’s XAML based, like WPF, and you can write in C#, VB.Net, and C++ but most applications are written in C#. It works only on Windows 10 and the deployment is through Microsoft Store. The application works in a Sandbox Environment so it is limited in the interaction with the PC. Difficult learning curve.

WPF – A popular mature (available from 2006) XAML based Microsoft technology. You can write in C# or VB.NET. It is very powerful in terms of Styling and Binding capabilities that are fitted for big applications. It can run on any Windows OS. Relatively steep learning curve.

WinForms – An older Microsoft technology, very popular before WPF. Unlike WPF and UWP, WinForms relies on Visual Studio Designer’s drag and drop interface making it very productive. It can run on any Windows OS. Easy to learn.

Electron – A framework that allows developing Desktop apps with Web technologies (HTML/CSS/JavaScript). The magic behind Electron is that it uses Node.Js and Chromium to create a Web View in a desktop window. Interacting with the PC is much less capable than in other technologies.

JavaFX and Swing – Java UI frameworks from Oracle. Both are cross-platform and written in JavaJavaFX is newer and encouraged by Oracle as a replacement for Swing.

Qt – A cross-platform, C++ based UI framework. You can write the UI objects in code or use QML, which is a declarative language somewhat similar to JSON.

.NET Collections

Do not use collections from System.Collections unless you are maintaining legacy code. They don’t provide type safety and they have poor performance when used with value types.

The collections can be easily grouped in a few categories based on the interfaces they implement. These determine which operations are supported by a collection and consequently in which scenarios can they be used.

The common interface for collections is the ICollection interface. It inherits from the IEnumerable interface which provides the means for iterating through a collection of items. The ICollection interface adds the Count property and methods for modifying the collection:

The authors of the Base Class Library (BCL) believed that these suffice for implementing a simple collection. Three different interfaces extend this base interface in different ways to provide additional functionalities.

  1. Lists
    • The IList interface describes collections with items which can be accessed by their index
  2.  Sets
    • ISet interface describes a set, i.e. a collection of unique items which doesn’t guarantee to preserve their order. it will only add the item to the collection if it’s not already present in it. The return value will indicate if the item was added. The most basic implementation of ISet is the HashSet class. If you want the items in the set to be sorted, you can use SortedSet instead.
  3. Dictionaries
    • IDictionary<tkey, tvalue= » »>  stores key-value pairs instead of standalone values. The indexer allows getting and setting the values based on a key instead of an index:</tkey,></tkey,>.

 

Queue and Stack

The Queue class implements a FIFO (First in, First out) collection. Only a single item in it is directly accessible, i.e. the one that’s in it for the longest time.

The Stack class is similar to Queue, but it implements a LIFO (Last in, First out) collection. The single item that’s directly accessible in this collection is the one that was added the most recently.

Thread safety

The regular generic classes in the Base Class Library have one very important deficiency they are not entirely thread-safe. While most of them support several concurrent readers, the reading operations are still not thread-safe as no concurrent write access is allowed. As soon as the collection has to be modified, any access to it from multiple threads must be synchronized.The simplest approach to implementing such synchronization involves using the lock statement with a common synchronization object but the Base Class Library comes with the ReaderWriterLockSlim class which can be used to implement this specific functionality simpler.

Concurrent collections

The concurrent collections in the System.Collections.Concurrent namespace provide thread-safe implementations of collection interfaces.

Immutable collections

Immutable collections aren’t included in the Base Class Library. To use them, the System.Collections.Immutable NuGet package must be installed in the project. They take a different approach to making collections thread-safe. Instead of using synchronization locks as concurrent collections do, immutable collections can’t be changed after they are created. This automatically makes them safe to use in multi-threaded scenarios since there’s no way for another thread to modify them and make the state inconsistent.

When choosing a collection to use in your code, always start by thinking through which operations you will need to perform on that collection. Based on that, you can select the most appropriate collection interface. Unless you have any other special requirements, go with an implementation from the System. Collections.Generic namespace. If you’re writing a multithreaded application and will need to modify the collection from multiple threads, choose the concurrent implementation of the same interface instead. Consider immutable collections if their behavior and performance match your requirements best.

Homo Deus – The data religion

« Dataism » – this religion doesn’t venerates neither gods nor man – it worships data.

Dataism declares that the universe consists of data flows and expects electronic algorithms to eventually decipher and outperform biochemical algorithms.

Dataism is most entrenched in its two mother disciplines: computer science and biology.

If humanism can be considered a single data-processing system, its output will be the creation of a new and even more efficient data-processing system, called the Internet of All Things.

Salary transparency

When negotiating, the less information your opponent has, the better. If you know how much everyone else in your role earns you will hold at that amount. If you have no idea, you might accept less. Making this information publicly could:

  • close the gender wage gap
  • help everyone to wheel, deal, demand and self-advocate

When a company hire another employee they have no idea how much value that person will add to the company. Salary transparency ensures that the employee knows what the company makes and the company knows what he makes which may help level salaries and eliminate discrimination.

 

Homo Sapiens – the useless class

Most important question of the twenty-first-century economics: what to do with the superfluous people after we will have highly intelligent non-conscious algorithms that can do almost everything better?

As long as machines competed humans merely in physical abilities, there were countless cognitive tasks that humans performed better. What will happen once algorithms outperform us in remembering, analysing and recognising patterns?

Over the last few thousands years we humans have been specialising. For AI to squeeze humans out of the job market it needs only to outperform us in the specific abilities a particular profession demands. The crucial problem is not to create new jobs but to create new jobs that humans perform better than algorithms.

Very soon the traditional model where life was divided into two main parts,a period of learning followed by a period of working, could become utterly obsolete and the only way for humans to stay in the game will be to keep learning throughout their lives and to reinvent themselves repeatedly.

 

 

Functions

A function (method) is a the first line of organisation in any program.

Rules for making the functions communicate their intent:

  • not small but very small
  • do one thing – can you extract another method from it with a name that is not a restatement?
  •  use descriptive names
  • number of arguments: niladic, monadic,  dyadic, triadic (to avoid)
  • no side effects, no hidden things, do only what you promised in the name
  • do something (change the state of an object )or answer to something (return some information about the object), not both
  • use exceptions instead of error codes
  • Don’t Repeat Yourself – duplication, the root of all evil.

Hacking

Hacking is about seeking vulnerabilities in software, searching for security holes. The reasons why a person would want to be a hacker are various including curiosity, personal challenge or stealing data.

The intentions choose the type of hacker a person want to be:

White-hat (ethical)

A white hacker acts in the legal zone and he has to follow the following steps:

  • get the permission of the owner of the system
  • hack the system
  • tell the owner about the vulnerabilities

White-hat hackers help keeping businesses, society and software that affects every life safe.

Black-hat (cracker)

A black hacker has malicious intentions and many people consider him as the classic  definition of hackers.

No matter what the intentions are hacking a system without getting the permission is illegal.  Hacking is just a tool. It is everyone’s responsibility to decide what to use it for.

 

Object Oriented Programming fundamentals – notes

Object != Class
A class provides the definition of the object type. It defines properties and actions.
An object is an instance of a class
The object variable is the variable that references the object result of the instantiation. It holds the state of the object. It retains the values of its properties.
Objects only exits at runtime.

A class – a cookie cutter
An object = a cookie made by the cookie cutter

Business object, entity

A business object is a class specifically defined for solving a business problem
An entity is anything from the real world that is significant enough to be represented as a class in the application

OOP
Object Oriented Programming is  an approach to build applications by focusing on objects that interact cleanly with one another in a way that is flexible, natural, well-crafted and testable.

In order to build to solve a real problem

Identify classes
Separate responsibilities
Establish relationships
Leverage reuse

The 4 pilons of OOP

Abstraction is a concept, a way to think: define appropriate classes by focusing on what is important for a purpose. Appropriate abstractions depends on the requirements of the application.

Cohesion
Collaboration – « uses a » – one class uses another class. Example, orderRepository uses the Order class to display the order or to serialise

Istoria, joc fara reguli

Lucian Boia,  Un joc fara reguli.

Imprevizibilitatea istoriei, principala caracteristica.

Istoria nu se repeta, se pot repeta sau pot fi asemanatoare anumite « episoade », dar ansamblul e mereu diferit.

Oamenii fac Istoria, dar nu o pot stapani.

Excercitii de interpretare: al doilea razboi fara Hitler, unirea Principatelor ca un proces petrecut la limita privita ca o oportunitate pentru putina vreme, crearea Romaniei (conditiile ideale pentru Romania la sfarsitul lui 1918), geneza Occidentului si ce s-ar fi intamplat daca europenii nu ar fi avut setea de cunoastere si de dominatie?