NDC London, first day
First day of the NDC London 2014 finished! Really long day, lots of information to take, but really glad to have the chance to be here.
I will write detailed posts of the most interesting talks but I wanted to share the main points of the talks I assisted today.
It started quite early, heading to EXcel London, impressive location for this conference.
I like the coffee, stands of different brands, lots of clever people to do some networking,… Denise Jacobs was the ice breaker today.
Creativity imperative, Denise Jacobs
I went to a talk that Denise did in Oslo. It was about vanishing your inner critic. This time she talked about creativiy.
She used to be a developer, she wrote a book on CSS and when she wrote her book, she noticed creativity needs to be sharpen. This was the very first time she gives this talk.
Creativity is the new buzzword, recent studies stablished that creativity is one of the most important skills in leadership. Everybody wants to enforce it but they don´t support it properly, and when somebody feels he is not creative, he disengaged.
We are all with this in-built creativity, but sometimes we feel we feel blocked. We need to:
Sometimes lack of time is reason why you are not creative. Time bound is the biggest killer of creativity.
F.E.A.R.: False, evidence, appearing, real. Fear of making mistakes. Start to do it on your own, and then take it to the team. Crazy ideas may be the best ones. Find when great ideas come.
- Become an adept listener. Develop your listening skills: be present, pay attention.
- Relax your own agenda. You don´t have to talk about everything.
- It´s really important to share your ideas. Don´t keep good ideas to yourself. When you share, you give back somebody else´s ideas.
- It is important to be able to sell your ideas.
- The more people you have, the more ideas you have.
- Need everyone: groups are diverse, the more diversity of people, the more diversity of though, the more creativiy. Build diverse teams.
- The group amplify the ideas of others. Don´t go right away for a new idea the tipical: “Yes, but…” Replace it with “Yes, and…”
- Collaboration builds trust.
- Cultivate culture of mentorship. It´s no other way you can get junior people in an area.
- Enough time. People need enough time and resources. People have a lot of meetings, but meetings are not efficient: if people go ready to the meeting with enough answers and points of view, it will be more efficient.
- Allow 20% time (work for other creativity things in that time). Ask for it.
- Tools: Having trainings to use some tools to estimulate ideas, go to conferences.
- Resources: Something that helps to push creativity is allocate enough people. Because one of the hardest parts is to do the idea.
All of this leads to “Produce”. The company will benefit from all of this.
Recommendation: Umair Haque: “Betterness”, “How to create your reason”.
Lessons Learned with AngularJS, Scott Allen.
You know how it feels when you have been doing a course on PluralSight by Scott Allen before going to the conference and a couple of hours later you are in a talk by him. I´m a big fan of Scott Allen because I´m learning too many things with his courses in Plural Sight. Really lucky to be there.
Scott learned some things when developing with AngularJS and he wanted to share with us some…
Robuts error handling
Use a catch statemtent at the very botton of the promise. Catch at the top of the chain.
Consistent error handling
I could create a service that delivers a model. I can pass around this service and let components use it as they want.
They give you the ability to decorate any service, even Angular´s ones. Normally you ask in a config file for a service and then you decorate it. Then the decorated service is injected.
He has a blog post about sanitazing html services. ng-bind —> ng-bind-html, this goes through a sanatizing service. Performance is worse. So he decorates the sanitize.
Angular is very forgiving about data binding models that are not relevant anymore. He wants to see a list of all of the binding expresion. He can see output and double check properties. He uses the $interpolate service of angular that checks this bindings. He decorates it with a wrapper to print it to console. Don´t leave it in production code though.
Need custom directives
For example ng-model binds a field to a model, so when something changes in the screen it moves data to the model. But it only works with text field.
He creates a custom directive to make it work for every type.
It has require, what you need to reimplement. link lets you add some more functionality to the element in the require.
Need unit tests.
He was coming from C# testing and he felt frustrated with UT in angular JS. because testing controllers is difficult. Difficult to ask for a controller inside a test, it is used deep down in Angular.
He injects it in a beforeEach of the jasmine test config and store it in a variable. Then uses it to get a specific controller in a beforeEach of a specific jasmine test class. Mock with Angular Mock, what it isn´t in the escenario to test.
-Explicit in the view: ng-controller=”MainController as main”
Abuse of root Scope
Abuse of puting everything in the scope: $rootScope for example for loging errors. Instead write a service that do that job.
Abuse of promise
If you know you can reject or do something, return it, instead of the promise.
Think about your router
Look at UI-Router
Think about a better $http
About AMD, and requireJS, a JS Module Loader
When a controller loads wait with a resolve to get the data before the view is shown. Resolve even doesn´t allow to go on if there was an error resolving the data. If Resolve is so big because you need several things, then move the whole thing to a service.
Cookies or Tokens
Cookies are sent with every request, susceptible to CrossSite Attacks (CSRF). Difficult to use across domains.
Tokens: offer more control, but require more code, but work across domains. WIth tokes you can do the tipical redirect. Tokens can be used in html5 local storage
Think about directory structure.
He likes feature based.
Finally he talked about NGPlaybook, a project Scott hosts in GItHub for an example of these things in Angular. Tokens(addToken.js), directives.
Asynchronous programming on the .Net Platform, Venkat Subramaniam
I wanted to see how the great Venkat see Asynchronous programming.
According to him, things are very different today: with multiple cores we have real parallel programming instead of multitasking.
Multithreading is not multitasking.
Problems of multithreading: - One you have multi, you have not a single problem but multiple problems. - Unpredictability arises its ugly face.
During the talk he took a simple example, a simple WPF application that display the price of a product when searching for it. To get the price we call a web service. While waiting for the result, the application is blocked, unresponsive.
So he uses multithreading to solve it. He starts with the old way: Define a new thread and encapsulate the request in this thread. But we have issues, since we don´t own the thread in the UI thread.
He iterates through more modern solutions for asynchronous programming. What was a simple problem becomes more and more complex because of multithreading.
But thanks to await and async keywords of CSharp, the code becomes simpler again, we let the compiler to solve the problem for us. We still need to know what we are doing but we use better tools.
I plan to do the same exercise so you can see how the multithreading evolves using modern features of the language. Because as Venkat says:
The more design patterns you need, the more the language sucks.
Load Testing SignalR, Damian Edwards and David Fowler
Damian and David are Microsoft Developers, they belong to the team working now in the new ASP vNext. They also work on creating the new SignalR 3.0.
They talked about performance testing with SignalR.
How to do that…?
Build traffic patterns: Defining how SignalR can be used.
Server broadcast: Server sends message to all clients at a fixed rate. Not a big deal, still one message.
Server push unique message to clients: Still server is under control.
Peer to peer: User send messages to each other user at their discretion. It gets complicated, it is like broadcasting but dictated by client.
High Frequency Real Time: Client-server messaging at high fixed rate.
Define Resource use
CPU ussage: in serialization, scheduling, sending messages.
Memory: buffers, message stores, bandwith.
With all this we can start the testing. But we have a problem: SignalR doesn´t use standard Http, instead it uses WebSockets. Therefore we need something different that the standard load testing tools. These guys are developing DCrank for that, it is available on GitHub.
Signs of overload: Clients timeout, consistently high CPU
NB: Look at ShootR, game that uses SignalR, available at github.
Core software design principles, by Venkat Subramanian
Yes, I know… I went to the same talk in Oslo. But it was so good and it doesn´t make any harm to listen about Design Principles again.
Somethings I took:
If a single change affects the whole system, then we have dupplication.
Don´t confuse your inability with impossibility.
YAGNI: Last responsible moment, it isn´t about procrastination.
Take the decission in the future so we have a better knowledge of the system.
Single Responsibility: If we ask what does this class do? and we answer this and …, we know its time to stop by the and and take it out into a different class.
In terms of functions: function, what´s your level of abstraction? If it is doing one higher level thing and some lower level, then it isn´t following the principle.
OCP: A piece of code needs to be open for extensions, but without having to modify existing code.
Adopting continuous delivery: Adjusting your architecture, Rachel Laycock
This talk was about a lot of things. CD is a big subject. It involves so many things, not only the operations part. This talk was about the architecture part.
Rachel put a lot of focus in trying to decouple a coupled systems so that different parts of the system can be delivered independently and they can evolve independently and also we can create replacable services.
One way is to use the untaggler pattern, by using an abstraction layer to break the system into different parts.
If possible, a nice tool is feature toggles. We are already using it in DC Thomson family history.
Client MVC != Sever MVC, EmberJS, Jeremy Green
In this talk Jeremy talked about EmberJS a SPA JS framework. He tried to map concepts that are already familiar in Sever side MVC frameworks to EmberJS concepts. There are similarities but also some differences that he highlighted.
He has some code in GitHub, watch.canary.io. We can take a look at an actual EmberJS application.
Great framework, we may give it a go.
After the talk we went to have a couple of beers with the mates in the conference and some of the speakers. It is awesome to be in the pub and suddenly be talking to Jon Skeet about the new CSharp 6 features.
Time to go to sleep, much more comming tomorrow!