WHAT'S NEW?
Loading...

JavaScript history and resources compilation

Index

  • Intro
  • History
  • Books
  • Videos
  • Frameworks
  • Others
  • References

Intro


More and more this language is being popular to the point we can even use it all along the whole stack of our apps. A new JS framework has been released while you read these lines. This is something that makes me want to learn JavaScript. Here I enclose a bunch of resources that I'll be updating during time. I think you can find useful to start learning JS, or at least, confirm what you know about it.

History

JavaScript was originally developed in 10 days in May 1995 by Brendan Eich, while he was working for Netscape Communications Corporation.

Although it was developed under the name Mocha, the language was officially called LiveScript when it first shipped in beta releases of Netscape Navigator 2.0 in September 1995, but it was renamed JavaScript when it was deployed in the Netscape browser version 2.0B3.

In November 1996, Netscape announced that it had submitted JavaScript to Ecma International for consideration as an industry standard, and subsequent work resulted in the standardized version named ECMAScript.

ECMA (European Computer Manufacturers Association) is a non-profit international institution who takes care of building standards in computer systems. It eases the building and communication between languages by creating standards used in: C#, C++, XML, JSON, JavaScript, JScript (Microsoft), ActionScript (Adobe Flash)...

The standard used by JavaScript is called ECMAScript and these are the different versions released by ECMA:

  1. In June 1997, Ecma International published the first edition of the ECMA-262 specification. 
  2. In June 1998, some modifications were made to adapt it to the ISO/IEC-16262 standard, and the second edition was released. 
  3. The third edition of ECMA-262 was published on December 1999.
  4. Development of the fourth edition of the ECMAScript standard was never completed.
  5. The fifth edition was released in December 2009
  6. The current edition of the ECMAScript standard is 6, released in June 2015.

Books

JavaScript, the good parts: This book is considered a MUST to have in your library. It was written by the PayPal engineer Douglas Crockford in 2008 and although it's small book, it will give you the very fundamentals you will need in order to continue learning more advanced stuff.



Videos

This Douglas Crockford's YouTube list contains around 80 videos where you will find out how the language evolved, who is Douglas or how the future of the language will be.

Frameworks


  1. NodeJS: created by some Google's engineers on top of the V8 engine, it's a powerful tool as its main features are: 
    1. Use non-blocking
    2. Event-driven I/O to remain lightweight 
    3. Efficient in the face of data-intensive real time apps.
  2. AngularJS: some people say this platform brought order to the development in JS. It worth to know how it works and understand its benefits: single page application, controller approach...
  3. ReactJS: created by Facebook in order to bring statefull and richful controllers to the Web.
  4. MEAN: Full JavaScript stack built with MongoDb, ExpressJS, AngularJS and NodeJS. Best way to learn is doing: try this tutorial to build a Google Maps.
  5. jQuery: it's a fast, small and feature-rich JS library.


Others

References


30.000 views and counting...

Hi,

It's been a while since I started this blog and it looks like we are close to the 30k page views which makes me feel proud and gives me that push up to keep doing this.


Some of you guys are really encouraging when I see friendship requests on G+, Twitter or GitHub for example, or when you comment any of my posts so, I just wanted to say: Thank you all! and hope to see you soon.

Merry Christmas!

Repository pattern

Introduction to Repository pattern


I found this tutorial from Mosh Hamedani pretty good explained. It will give you a very good understanding on how to create a repository pattern in your C# applications.

Learn when to use it (not in small apps, POC,..) and how to implement it properly. Understand DbSet and UnitOfWork, and which functionalities you have to define on them.



Events in C#

Introduction


Today I wanted to create a basic example about how events work in C#. This is a great tool to create loosely coupled applications, removing dependencies and allowing you to change and fix your programs making the least amount of changes.

Events

First of all we need to define three steps that we need to follow when we work with events:

  1. We need to define a delegate with this convention:
    1. add the suffix "EventHandler" in the name of the envent
    2. Parameters: an object which is the source of the event and an EventArgs if we need to pass additional data
  2. Define an event based on that delegate. Note that the signature is defined by the delegate and every subscriber will have to follow that signature. Typically this has its name in past tense as it's something that already happened.
  3. Raise the event.
In the following example I've tried to use the analogy of a regular house with some pets and what they usually do when you get home. I've defined three classes: BreadWinner (you), Cat and Dog. There is an extra class to run the application and subscribe Dog and Cat to the event publisher, in this case, the BreadWinner.


Let's change a little bit my example to pass an argument when my event is raised. This time I've simplified the previous example. See how with my new PapaEventArgs class I can use it to pass content to my subscribers. See changes highlighted.


The final step is to show you how to the same thing but using less code. .Net provides a way to prevent create a delegate every time we want to create an event by using the class EventHandler. In our example we'll use the generic class EventHandler<> as we want to pass PapaEventArgs to our subscribers. Additionally, I've added some exception handling to prevent breaking the flow when a subscriber triggers an exception. See changes highlighted.



The GREAT thing of all of this happens when there is a problem in the subscribers. Imagine this used in a very complex application and an error is raised for a subscriber. We won't need to touch the publisher and we won't need to recompile as is completely de-coupled from the rest of the subscribers.

Day 19 Programming in C# 70-483

Index


  • Introduction
  • Arrays
  • Generics
  • Lists
  • Dictionary
  • Using sets
  • Queues and stacks
  • Choose your collection
  • References

Introduction

This post is part of a series of post to help you prepare the MCSD certification, particularly the certification exam 70-483, based on the book:


You will find all the code available in the following GitHub repository. Lets talk a little bit about threads and how they work using a .Net development environment.

Arrays

This is the most basic data structure:
  • its size is specified during the creation process. (restrictive)
  • zero-based
  • it implements IEnumerable so you can use a foreach loop on it
  • Dimensions:
    • single dimension
    • multidimensional
    • jagged arrays

Generics

Most of the collection structures have both generic (C# 2.0 - System.Collections.Generic namespace) and non-generic (System.Collections namespace) versions. The generic collection is used when you work with objects of one specific type. This improves type safety and performance.

By using a value type as the parameter for a generic collection, you need to make sure that there is no any scenario where boxing could occur. If the value type does not implement IEquatable<T>, you object needs boxing to call Object.Equals(Object) to check equality.

Lists

This structure is similar to arrays but with some enhancements:
  • You can add additional items.
  • It implements IList and ICollection which allows you to call the following methods:
    • IndexOf()
    • Insert(int index, T item)
    • RemoveAt(int index)
    • Count()
    • Add(T item)
    • Clear()
    • Contains(T item)
    • CopyTo(T[] array, int arrayIndex)
    • Remove(T item)
  • Duplicates
  • Fast

Dictionary

It stores items and retrieve them by key:
  • Dictionary<TKey,TValue>
  • Don't duplicate keys
  • Two types, one for key and one for value
  • Fast O(1)
  • The hash value of a key shouldn't change and can't be null.
  • The value can be null (reference type)

Using sets

In Java exists a type called "set". In C# that's a reserved word but you can use the class HashSet<T>. This is a particular collection with no duplicates and no particular order. You can add new object to the structure and iterate over them.


Queues and stacks

Queue features:
  • FIFO (first in, first out)
  • By getting an item you remove it from the Queue
  • Typically used for messaging systems
  • Methods:
    • Enqueue(): adds and element
    • Dequeue(): removes the oldest element
    • Peek(): returns the oldes element but doesn't immediately remove it from the queue.
Stack features:
  • LIFO (last in, first out)
  • By getting an item you remove it from the stack
  • Methods:
    • Push(): adds a new item to the stack
    • Pop(): gets the newest item form the stack
    • Peek(): gets the newest item without removing it

Choose your collection

List and Dictionary offer random access. Dictionary offers faster read features, but it can't store duplicates.

Queue and Stack are used when you want to retrive items ina specific order. 

Set-based collections don't offer random access to individual items.

List is used more commonly but it worth to work out which collection fits better with our requirements.

Day 18 Programming in C# 70-483

Index


  • Introduction
  • XML serializer
  • Binary serializer
  • DataContract serializer
  • JSON serializer
  • References

Introduction

This post is part of a series of post to help you prepare the MCSD certification, particularly the certification exam 70-483, based on the book:


You will find all the code available in the following GitHub repository. Lets talk a little bit about threads and how they work using a .Net development environment.

XML serializer

Serialization is about transformation in order to send information. When you want to send data to a web service first you transform that data to a flat or binary form, send it and then you transform back that data. When you want to define what data you want to serialize, typically a DTO (Data transfer object) is created where you define all the properties you want to send.

Features:
  • XmlSerializer class
  • Simple Object Access Protocol (SOAP)
  • Not the best performance
  • Can't do private fields
  • Decoration:
    • class: [Serializable]
    • properties: by default members are serialized as XmlElement, ie, as nodes.
      • [XmlIgnore]: not serialize
      • [XmlAttribute]
      • [XmlElement]
      • [XmlArray]: for collections
      • [XmlArrayItem]: for collections

Binary serializer

This type of serializer is used more commonly with images and non-readable data. 

Features:
  • BinarySerializer class
  • namespaces: System.Runtime.Serialization and System.Runtime.Serialization.Formatters.Binary
  • Private fields are serialized by default
  • Decoration:
    • class: [Serializable]
    • properties:
      • [NonSerialized]
    • methods:
      • [OnDeserializedAttribute]
      • [OnDeserializingAttribute]
      • [OnSerializedAttribute]
      • [OnSerializingAttribute]
  • ISerializable: by implementing this you can define what is serialized, and if you have sensitive data you can encrypt prior to serialization. Implement:
    • GetObjectData(): called when your object is serialized. You can decorate it with a SecurityPermission attribute, so it is allowed to serialize and deserialize
    • protected constructor: called when you object is deserialized. You use it to retrive the values and build your object by defining 

DataContract serializer

Features:
  • DataContractSerializer class
  • It's used by WCF to serialize to XML or JSON
  • Decoration:
    • class: [DataContract]
    • operations: [DataMember]
    • methods:
      • [OnDeserializedAttribute]
      • [OnDeserializingAttribute]
      • [OnSerializedAttribute]
      • [OnSerializingAttribute]

JSON serializer

Features:
  • DataContractJsonSerializer class
  • small amounts of data
  • It uses Asynchronous JavaScript and XML (AJAX)

Today I'm in...

Hello everyone,

Today I'll be attending the Amazon Appstore Developer summit event at SkillsMatters London event. It's going to be a busy day with a lot of interesting people talking about the advantages of using the cloud from a developer perspective. Here I enclose the agenda for today and I hope hear from you about these topics



Day 1