tag:blogger.com,1999:blog-82690383679010259882024-03-05T01:53:18.409-08:00No Bullshit & ProgrammingSomethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.comBlogger29125tag:blogger.com,1999:blog-8269038367901025988.post-46500965547790931272015-06-21T22:38:00.002-07:002015-06-21T22:38:37.096-07:00Final Impressions of NDCNDC was really an awesome conference and I got to meet some really interesting people there. I was satisfied with most talks I attended and got some new influences.<br /><br />As usual this conference struggles with inequality between the amounts of male to female speakers. Some will argue that this is just how things are since the conference call for papers are open to everybody. I don't really think this is an excuse since we our self are responsible for building the society we want to live in and that might mean initially putting some effort into creating equality. There was a code of conduct for the conference which is a step in the right direction. <br /><br />The venue at NDC was really nice, the food was great and, some really excellent coffee was available. All in all I’m really happy I got a chance to attend. All the talks will be available on <a href="https://vimeo.com/channels/932977" target="_blank">Vimeo</a>. Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-42907439567447454532015-06-19T05:35:00.000-07:002015-06-30T12:31:21.480-07:00Mob Programming – A Whole Team Approach by Woody ZuillAnother concept that I’m completely new to, NDC is fantastic source to for getting interested in new things.<br />
<br />
Mr Zuill starts the talk describing what Mob programming is: All the brilliant minds working on the same thing, at the same time, in the same space on the same computer.<br />
<br />
During a day there is one driver who sits at the computer and the rest of the team is navigator. The driver inputs what the navigators explains. Anyone can take a break when they want to. If the driver wants to express an idea then that person needs to switch. The driver gets rotate on fixed cycle.<br />
<br />
Benefits are instant review of both code and design, good learning opportunities, and, team resiliency. To work this way focus should be paid to individual and interactions. The team should exercise kindness, consideration, and, respect and make each other aware when they fail in these areas.<br />
<br />
Productivity remains high due to low latency in communication and almost no technical debt.<br />
<br />
Mob programming certainly seems like an interesting technique, excellent talk. There is a <a href="http://mobprogramming.org/" target="_blank">website</a> for mob programming.<br />
<br />
<br />
<br />Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-15775511690435113492015-06-19T03:33:00.001-07:002015-06-19T03:33:03.582-07:00How Do You Scale a Logging Infrastructure to Accept a Billion Messages a Day by Paul StackThis seminar is a description on how Paul Stack changed a legacy solution using SQLfor storing logs to a more scalable solution.<br /><br />To replace the SQL solution they went to the ELK Stack which is made up of ElasticSearch, LogStash, and, Kibana. In the beginning a developer took a single JAR file and ran it, this worked well but had some stability issues.<br /><br />Next iteration Redis was used as transport medium for the logs before it was pushed to ElasticSearch. Due to problems with Redis overflowing they moved to <a href="http://kafka.apache.org/" target="_blank">Apache Kafka</a>. Kafka is a high-throughput distributed messaging system and is backed by <a href="https://zookeeper.apache.org/" target="_blank">ZooKeeper</a> which is basically a key-value store.<br /><br />The following iteration they tried to improve the server structure however this mostly increased the complexity of the system without improving the system. The system could new handle the peak load of 12 billion messages per day. <br /><br />Mr. Stack recommend reading <a href="https://aphyr.com/tags/jepsen" target="_blank">Jepsens</a> database series for choosing technologies. A lesson learned from the project is to not re-invent the wheel, the simple solution would have been to buy <a href="http://www.splunk.com/" target="_blank">Splunk</a> however during the development they learned a lot about their system.<br /><br />I’m not a such deep into DevOpts but I found this talk very informative.Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-64861417716789733992015-06-18T11:13:00.002-07:002015-06-21T22:17:46.344-07:00Impressions day 2 of NDCJames Mickens closed out day two with his awesome standup routine Not Even Close: The State of Computer Security. The rest of the evening is a party with some live bands.<br />
<br />
Today has been really good and even though not all the seminars I attended will be applicable I feel that I got a lot of inspiration. <br />
<br />
The food is pretty good considering that it is catered and there are several selections to choose from. The only complaint I have is that there is no dedicated slot for dinner so you either choke down your food in less than 20 minutes or miss a seminar slot. <br />
<br />
All in all I think I can say that NDC is definitely worth a visit. Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-31524864129270477182015-06-18T09:35:00.001-07:002015-06-18T09:35:38.150-07:00Ten Simple Rules for Creating Your Own Compiler on the CLR by Philip LaureanoDon’t we all secretly dream of constructing our own language?<br /><br /> The good news is that everything does not need to be written from scratch. The extremely quick run trough of a compiler is that the code is parsed into a parse tree which is converted into an abstract syntax tree which is compiled to an assembly.<br /><br />Don’t write your own parser, use a prewritten one for instance <a href="http://www.antlr.org/" target="_blank">ANTLR</a>. When constructing the grammar rules it is important to avoid circular loops since that can cause an infinite parsing recursion. The parser that is generated is quite unreadable. <br /><br />Going from the parse tree to the abstract syntax tree requires high usage of the <a href="https://en.wikipedia.org/?title=Visitor_pattern" target="_blank">visitor pattern</a>. The abstract syntax tree then forms the heart of the compiler. Mr. Laureano has used LINQ expression trees to handle the abstract syntax tree.<br /><br />Mr Laureano’s toy language, Not Quite Lisp™, is available on <a href="https://github.com/philiplaureano/NotQuiteLisp" target="_blank">GitHub</a>.<br /><br />I wish I could say that this talk taught me all I needed to construct my own language but alas it turns out I’m either to dumb or the problem is more complex than an hour’s seminar can explain. It was fun to listen too though.Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-70841525067882852312015-06-18T07:58:00.002-07:002015-06-18T07:58:58.683-07:00Making .NET Applications Faster by Sasha GoldshteinAny person who does not care about performance of their components is a horrible person. Shun that person like the plague. The seminar focused on three areas for improving performance:<br /><div>
<ul>
<li>Working with collections</li>
<li>Improving startup times</li>
<li>Reducing GC pressure</li>
</ul>
For collections running times and space complexity needs to be considered, however internal structure as well as specialized functions must also be taken into account. The basic .NET collections are Array, List and, LinkedList. Arrays are static in size but fast, Lists are dynamic in size but adding elements anywhere else than at the end is costly, a LinkedList in cheap in insertions but requires a lot more memory space which affects performance when going through all elements.<br /><br />Another collection group is trees; examples are SortedDicitionary and SortedSet which have efficient lookup but they have an even bigger space requirement per item than linke lists. There are also associative collections such as Dicitionary and HashSet which is somewhere in between LinkedList and Arrays in space requirements.<br /><br />There are use cases when the existing collections does not fit well, for instance finding words that begin with a specific prefix. Structures that handles this kind of scenario are called Tries. <br /><br />The key point is that for certain scenarios using a custom collection can boost performance.<br /><br />Startup can be separated in cold startup and warm startup. Cold startups are when the application has not executed since last reboot, this startup time is dominated by disk I/O operations e.g. loading assemblies and similar. For warm starups JIT compiling and similar is the biggest problem<br /><br />To improve startup time NGen can be used to compile the .NET code to native code which will speed up load times. Another trick is to enabled Multi-Core background JIT by using <span style="font-family: Courier New, Courier, monospace;">ProfileOptimization.SetProfileRoot</span> and <span style="font-family: Courier New, Courier, monospace;">ProfileOptimizations.StartProfile</span>. Another solution is to use the faster RyuJIT compiler, however it is not released yet so it might not be 100% stable. It will be part of Visual Studio 2015 and .NET Framework 4.6 release.<br /><br />To improve cold startup all the assemblies can be merged together and this can be done with ILMerge. Another approach is to use .NET Native that compiles everything down to a single native executable. This removes the need to having the .NET Framework installed on the target machine. However .NET Native is only available for Windows Store Apps.<br /><br />For optimizing GC handling there are many performance metrics: <br /><ul>
<li>Performance Counters</li>
<li>Event Tracing for Windows</li>
<li>Memory Dumps</li>
</ul>
A simple technique to get better performance is to use Value Types where applicable. Value Types are smaller than reference types and are embedded in their containers.<br /><br />Finally: don’t use finalization.<br /><br /> This has been the absolute best for me so far at the conference</div>
Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-51880561133876906252015-06-18T05:56:00.002-07:002015-06-18T05:56:53.749-07:00Short Between Seminars PostSomething that keeps beeing mentioned on the conference but I have not brought up in my other posts is <a href="https://en.wikipedia.org/wiki/Conway's_law" target="_blank">Conway's law</a>. There is also several references to the book <a href="http://www.amazon.com/The-Inmates-Are-Running-Asylum/dp/0672326140" target="_blank">The Inmates are Running the Asylum</a>.Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-4388241178885518382015-06-18T05:31:00.001-07:002015-06-18T05:31:28.453-07:00Loosely Coupled Applications with MassTransit and RabbitMq by Roland GuijtOne thing that is becoming abundantly clear during this conference is that SOA, CQRS, and, micro services is the new black. At the center of this you always find the service bus; <a href="http://masstransit-project.com/" target="_blank">MassTansit</a> presents itself as a light weight component to fill this functionality. This is a open source project and it is available on <a href="https://github.com/MassTransit/MassTransit" target="_blank">GitHub</a>.<br /><br />This is a more practical session with examples that does not translate well into the blog posts I’m creating for this conference. I will try to express the key points of the presentation. The code that was demoed is available at <a href="https://github.com/RolandGuijt/masstransitdemos" target="_blank">GitHub</a>.<br /><br />As stated in some of the previous post there is a threshold of complexity of the application for the benefits of micros services to be useful. The usual draw backs with monoliths are presented, such as that it hard to allow teams to work in parallel. <br /><br /> The big difference between NServiceBus and MassTransit is that NServiceBus has more features and comes with support but costs money. MassTransit does not cost anything but has no support and lacks some features. MassTransit supports several transports such as RabbitMq and MSMQ.<div>
<br /></div>
<div>
Sagas in MassTransit are used for correlating services to work concurrently<span style="font-family: Calibri, sans-serif; font-size: 13.5pt; line-height: 115%;"> </span>on incoming messages. Useful for long running processes.</div>
<div>
<br /></div>
<div>
This seminar was somewhat like having a blog post read out loud to you. I certainly learned some new things however I was yawning a lot while doing so.</div>
Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-85778842487302155522015-06-18T03:36:00.002-07:002015-06-18T03:36:53.135-07:00SOLID Architecture in Slices not Layers by Jimmy BogardI have been a long time reader of Jimmy Bogards blog posts at <a href="https://lostechies.com/jimmybogard/" target="_blank">Los Techies</a> so it feels kind of awesome to see him live.<br /><br />The seminar begins with a case study of a real world scenario that had become horribly complex. This leads into a discussion about the recommended n-tier structure of a system where everything is organized in layers.<br /><br />By developing independent layers you run the risk of over-engineer the layers interface to ensure that the next layer has all the access points it needs. By slicing vertically through the layers and finishing each feature through all layers the interfaces area of each layer becomes exactly as big as it needs to be.<br /><br />To create good separations Mr. Bogard suggest using the <a href="http://martinfowler.com/bliki/CQRS.html" target="_blank">CQRS</a> pattern and equates how this is similar to POST and GET for the web. To demonstrate this he digs into Microsofts <a href="https://code.msdn.microsoft.com/ASPNET-MVC-Application-b01a9fe8" target="_blank">ContosoUniversity</a> example which he has re-done and is available on <a href="https://github.com/jbogard/ContosoUniversity" target="_blank">GitHub</a>.<br /><br />For modeling request a structure where input goes into a request handler which in turn produces output. To model these request Mr. Bogard have written a tool called <a href="https://github.com/jbogard/MediatR" target="_blank">MediatR</a> which is also available on GitHub. This tool is also useful for constructing commands.<br /><br />A new structure for structuring the project files is suggested where features a grouped together. Here it is suggested to create a class for the specific feature and internal classes for all needed components for that features, like commands, validators, and similar. I’m a strong believer of putting classes in their own files so I’m not so keen on this advice.<br /><br /> Jimmy Bogard does not take the normal approach of explaining SOLID principles where each principle is discussed separate whit a small example. Instead he dives into talking about architectural design decision with little to no reference to the SOLID principles. The actuall references comes at the end where all the architectual decisions are tied to the principles. This was a very nice way of handling SOLID.Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-79638582970124928042015-06-18T02:37:00.000-07:002015-06-18T02:37:00.517-07:00What’s new in Visual Studio 2015, ALM + ASP.NET 5: Next Level Development by Adam CoganThis probably the longest title for any of the seminars I’m attending. I have only tried an early beta of Visual Studio 2015 a while back so I have been looking forward to getting some more information on the “almost” stable release. <br /><br />The interview starts with some history of the tools that has been introduced with previous Visual Studio versions. This leads into five things that Mr. Cogan recommends in Visual Studio Online, they are:<br /><ol>
<li>Monaco Editor</li>
<li>New Build System</li>
<li>Scrum and Kanban</li>
<li>Git Pull Requests</li>
<li>Application Insights</li>
</ol>
<br />The semeinar contiunues with going through some updates for Visual 2015 <br /><br />Roslyn which is the new compiler written in entierly in C#. The Roslyn compiler allows for some new interesting tools like <a href="https://www.ssw.com.au/ssw/CodeAuditor/" target="_blank">CodeAuditor</a>. Roslyn also comes with some new language operators (C# 6.0) such as the null propagation operator .? which allows for checking for null before executing a function on the object.<br /><br />Evaluation of LINQ expressions in runtime so that the result of a LINQ can be viewed.<br /><br />Some additional tools that can be used to assist the development process are <a href="http://nr6pack.net/" target="_blank">NR6Pack</a> and <a href="https://github.com/code-cracker/code-cracker" target="_blank">CodeCracker</a>. <br /><br />Code Lens will be available in the Professional version. <br /><br />Smart Unit Test which is the new name for PEX. <br /><br />IntelliTrace will be faster and give more information.<br /><br />In the end the presentation became quite rushed and Windows 10 was brought up as a good update for Visual Studio 2015 which was a bit weird, however, Adam Cogan is a good speaker and kept the talk interesting and interactive. Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-18626413780178306502015-06-18T00:59:00.001-07:002015-06-18T00:59:39.280-07:00Continuous Delivery for Architects by Neal FordI was late to this seminar due to talking a little too long about NServiceBus with Sean Farmar at Particular Software booth. When I came into the seminar a <a href="http://www.amazon.com/Continuous-Delivery-Deployment-Automation-Addison-Wesley/dp/0321601912/ref=sr_1_sc_1?ie=UTF8&qid=1434611220&sr=8-1-spell&keywords=continous+devlivery" target="_blank">Continous Delivery</a> book was on the screen and the speaker was way beyond the introduction. Two other books are shown during the talk, the classic <a href="http://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215/ref=sr_1_2?s=books&ie=UTF8&qid=1434613910&sr=1-2&keywords=domain+driven+design" target="_blank">Domain Driven Design</a> by Eric Evans and <a href="http://www.amazon.com/Implementing-Domain-Driven-Design-Vaughn-Vernon/dp/0321834577/ref=sr_1_1?s=books&ie=UTF8&qid=1434613029&sr=1-1&keywords=implementing+domain-driven+design" target="_blank">Implementing Domain Driven Design</a> by Vernon Vaughn.<br /><br />Mr. Ford talks about how a continous delivery pipeline must be constructed with steps such as commit, functional test, user acceptance test staging and so on. This increases confidence and gives feedback at the different stages. There are no rules for constructing the pipeline but it is up to the architect.<br /><br />Mr. Ford states that today’s best practices will be tomorrows anti-patterns and goes on to show that the increasing complexity of problems drivers architectural change. The most certain thing is that the code will change and the design should make that simple. The talk continues with tackling some of the problems for constructing the component pipeline.<br /><br />During the lecture only two tools are mentioned <a href="https://structure101.com/" target="_blank">Structure 101</a> and <a href="http://www.ndepend.com/" target="_blank">NDepend</a> and they are used to analyze the dependencies in the code base. The reason these are brought up is to avoid creating dependency cycles. Structure 101 is for java and NDepend does somewhat similar job for .NET. <a href="http://www.well-typed.com/blog/9/" target="_blank">Diamond Dependencies</a> are also a anti-pattern that complicates constructing the pipeline.<br /><br />Mr. Ford continues the seminar talking about domain driven design and some of the problems with building a micro service design. He brings up the<a href="https://en.wikipedia.org/wiki/Fallacies_of_distributed_computing" target="_blank"> Fallacies of distributed computing</a> as an example of the problems that must be considered when moving form a monolith to a micro service design.<br /><br />A pretty intense talk considering it was the first one of the day. Mr. Ford speaks well and moves quickly between the topics, definitely worth the visit.Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-48639198984513265182015-06-17T11:32:00.002-07:002015-06-17T11:32:29.009-07:00First day of NDC Oslo impressionsThe first day has been quite intense, lugging around an extra hoodie (conference present) and thick brick of a book has not made things easier. The decision to blog instead of taking notes has also proven to be a bit of an extra burden. My laptop battery gives me two hours of work at best so I’m always hunting for a power outlet, some conference rooms has them some do not, let the games begin. <br /><br /><div>
Most of the seminars have been pretty good, however, since they are only an hour long it does not leave any time for examples or more in-depth discussions. Even though the presentations are on the short side I think it has been really interesting so far and I’m looking forward to tomorrow.</div>
Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-9354924367818917672015-06-17T10:10:00.001-07:002015-06-17T10:10:26.145-07:00Applying S.O.L.I.D Principles in .NET/C# by Chris Klug<br />The presentation was changed slightly from the topic and will deal with when to and when not to use the <a href="https://en.wikipedia.org/wiki/SOLID_(object-oriented_design)" target="_blank">SOLID principles</a>. The presentation goes through the SOLID principles which has already been written about in a million blogs so I will not go into to it here. Each principle comes with an explanation where Mr. Klug would use the principle.<br /><br />This seminar becomes an in-depth description of the speaker’s usage of the different SOLID principle with his motivations. The motivations are not well founded however it does not feel like it adds something more to the already existing body of work on SOLID.Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-74212881836992488862015-06-17T08:48:00.001-07:002015-06-17T08:48:59.450-07:00To NoSQL or Not to NoSQL, That is the Question by David OstrovskyWe are moving to a polyglot persistence world; however relational databases, in my opinion, should not be overlooked as a solution. David Ostrovsky talk is aims to orient you in the world of NoSQL databases and assist in making a good choice for your needs.<br /><br />The seminar begins with a run through of a user story for a company that wanted to update to a NoSQL database where the solution end up not being optimal for the company needs. Mr. Ostrovsky, with all right, criticize the term NoSQL since this is a very rough separation. Below is the groupings that were presented in the seminar with short descriptions.<br /><div>
<ul>
<li>Key-Value</li>
<ul>
<li>Simple collection of keys and values, very fast and scalable. </li>
</ul>
<li>Document </li>
<ul>
<li>Similar to key-value but the keys are known to the database so they can be searched and operated on.</li>
</ul>
<li>Row</li>
<ul>
<li>Similar to a RDBM database but with row partitioning with a id for each row.</li>
</ul>
<li>Column</li>
<ul>
<li>Turns the storage so the column information is stored sequentially on the physical disc. </li>
</ul>
<li>Graph</li>
<ul>
<li>Uses graph structure to store data which allows for graph theory to search the data.</li>
</ul>
</ul>
<br />Using SQL has many advantages and many SQL flavors today support sharding and clustering. It has also been around for 40 years and it easy to find developers for SQL applications. However if the data structure is very complex or the dataset starts becoming so large that you have to give up functionality such as indexes and joins Mr. Ostrovsky suggests that it is time to look at NoSQL solution.<br /><br />A use case of storing tweets on a row database is discussed, the row database is a good choice since it has very low latency for writes. This leads in to a run through of the <a href="https://en.wikipedia.org/wiki/CAP_theorem" target="_blank">CAP theorem</a>. Since network partitioning cannot be controlled it basic comes down to selection if the database should have high consistency or high availability.<br /><br />The futility in benchmarks is pointed out. The best comparison is to model the actual use case for the different databases and also populate the databases with this model and measure that. <br /><br />The seminar ends with an example of using Cassandra to store tweets as mentioned earlier. For those not versed in the world I would think this seminar would be a excellent primer, however an even better solution would be to read <a href="http://www.amazon.com/NoSQL-Distilled-Emerging-Polyglot-Persistence/dp/0321826620/ref=sr_1_1?ie=UTF8&qid=1434553185&sr=8-1&keywords=NoSQL+martin+fowler" target="_blank">NoSQL Distilled</a> by Martin Fowler. </div>
Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-37634552789484873272015-06-17T07:04:00.003-07:002015-06-17T07:04:48.714-07:00.NETCore Blimey! By Matt Ellis<br /><div class="MsoNormal">
Matt Ellis steals the lead in the unofficial best t-shirt
competition, currently running in my head, with his <a href="http://www.ptxstore.com/jetbrains/product_info.php?products_id=440" target="_blank">‘I see dead code’</a> t-shirt. Mr. Ellis begins with presenting what .NET Core is</div>
<div class="MsoNormal">
</div>
<ul>
<li><span style="text-indent: -18pt;">Open Source</span></li>
<li><span style="text-indent: -18pt;">Cross platform</span></li>
<li><span style="text-indent: -18pt;">Standalone</span></li>
<li><span style="font-family: Symbol; text-indent: -18pt;"><span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;"> </span></span><span style="text-indent: -18pt;">Factored for modularity</span></li>
<li><span style="text-indent: -18pt;">Everything ships as NuGet packages</span></li>
<li><span style="text-indent: -18pt;">Not finished….</span></li>
</ul>
<br />
<div class="MsoListParagraphCxSpLast" style="margin-left: 38.5pt; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoNormal">
It allows for installing the parts you need for the
application and not using the entire framework. .NET Core is a fork of the .NET Framework and there are missing
pieces like AppDomain and Remoting as well as all UI parts. <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Mr. Ellis demoes the usage of DNX for handling multiple
installs of .NET Core followed by how to get the <a href="https://github.com/dotnet/coreclr" target="_blank">.NET Core from Github</a> and
compiling it locally and running a simple hello world program. This demo leads
into <a href="https://github.com/dotnet/corefx" target="_blank">CoreFx</a> which are the foundational libraries of .NET. To get the hello
world example running it required to use an AppModel which bootstraps the CLR
loads the .NET exe and runs it. There are several .NET Core AppModels
consolerun or corerun (which you get when compiling .NET Core yourself), DNX, and also one for Windows 10.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
By using NuGet you can get away from a static framework
version. You specify the packages you want and what versions. There are some
new monikers to specify dependencies and the most useful one is <i>dotnet</i>.
However this is not completed yet and may be subjected to change.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
What will be the implications for Mono? Mr. Ellis suggest
that there is probably room for them both since Mono is already cross platform
and focuses is Non-Windows mobile platforms.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
In comparison with the Don’t Make Me Feel Stupid talk this seminar is highly information dense and I would probably need to hear it twice to get all the details. It was very interesting but since this very early may things my changeSomethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-83724867447732864372015-06-17T05:51:00.001-07:002015-06-17T05:51:19.777-07:00‘Don’t Make Me Feel Stupid’ – A User by Liam Westley<div class="MsoNormal">
The first keynote where the speaker is blasting some music
(New Model Army – Stupid Questions) while waiting for the seminar to begin. I
have design some UI in my life however I have not giving much thought to UX
which I why I chose to attend this seminar.</div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The presentation is somewhat abstract with real world
examples describing the points that Mr. Westley wants to make, which is really
nice but quite hard to properly relay in a hurried blog post. I will try to
capture the main points in a bullet list below:<o:p></o:p></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
</div>
<ul>
<li><span style="text-indent: -18pt;">Allow users to use multiple paths</span></li>
<ul>
<li><span style="text-indent: -18pt;">If there is no way for the user to achieve a
goal they want, the user will find a way.</span></li>
</ul>
<li><span style="text-indent: -18pt;">Don’t ask users unnecessary questions</span></li>
<ul>
<li><span style="text-indent: -18pt;">If you cannot fulfill a user answers then don’t
give the user the possibility to answer the questions in that way.</span></li>
</ul>
<li><span style="text-indent: -18pt;">Don’t supply to much information</span></li>
<ul>
<li><span style="text-indent: -18pt;">Too many confirmation dialogs trigger auto
acceptance</span></li>
<li><span style="text-indent: -18pt;">Be careful with ‘geeky’ terminology with the
information presented to the user.</span></li>
</ul>
<li><span style="text-indent: -18pt;">Too little information</span></li>
<ul>
<li><span style="text-indent: -18pt;">Too little information causes people to navigate
further through an application, or forces people to think.</span></li>
</ul>
<li><span style="text-indent: -18pt;">Consistency</span></li>
<ul>
<li><span style="text-indent: -18pt;">Don’t make UX changes on each release.</span></li>
<li><span style="text-indent: -18pt;">Ctrl+F in Outlook forwards the e-mail instead of
search (lol).</span></li>
<li><span style="text-indent: -18pt;">Being consistent to the application or the
platform is not cut in stone, this must judge carefully.</span></li>
</ul>
<li><span style="text-indent: -18pt;">Surprise your user</span></li>
<ul>
<li><span style="text-indent: -18pt;">Help the user to make the right decision or
correct the input for the user.</span></li>
</ul>
<li><span style="text-indent: -18pt;">Get friendly with your designer</span></li>
<ul>
<li><span style="text-indent: -18pt;">Simplifies communication.</span></li>
<li><span style="text-indent: -18pt;">Developers should question design decisions.</span></li>
</ul>
</ul>
<br />
<div class="MsoNormal">
This was a very nice seminar, but not particularly information
dense.<o:p></o:p></div>
<div>
</div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
</div>
<div>
<br /></div>
<div>
<br /></div>
<!--[if !supportLists]--><o:p></o:p><br />
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 72.0pt; mso-add-space: auto; mso-list: l0 level2 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 72.0pt; mso-add-space: auto; mso-list: l0 level2 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 72.0pt; mso-add-space: auto; mso-list: l0 level2 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 72.0pt; mso-add-space: auto; mso-list: l0 level2 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 72.0pt; mso-add-space: auto; mso-list: l0 level2 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 72.0pt; mso-add-space: auto; mso-list: l0 level2 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 72.0pt; mso-add-space: auto; mso-list: l0 level2 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 72.0pt; mso-add-space: auto; mso-list: l0 level2 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 72.0pt; mso-add-space: auto; mso-list: l0 level2 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 72.0pt; mso-add-space: auto; mso-list: l0 level2 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<br />
<div class="MsoListParagraphCxSpLast" style="margin-left: 72.0pt; mso-add-space: auto; mso-list: l0 level2 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-23246577824174016952015-06-17T04:29:00.001-07:002015-06-17T04:29:34.748-07:00Microservices,Cutting Through the Gordian Knot by Ian Cooper<div class="MsoNormal">
First off, if you have a beard like Ian Cooper you have my
respect. Secondly, as stated in a previous post, I am not an expert on micro
services so I might not do these presentations the justice they deserve. The points
that were discussed in the talk are:</div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l1 level1 lfo1; text-indent: -18.0pt;">
</div>
<ul>
<li><span style="font-family: Symbol; text-indent: -18pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><span style="text-indent: -18pt;">Managing Complexity</span></li>
<li><span style="font-family: Symbol; text-indent: -18pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><span style="text-indent: -18pt;">Implementing Micro services</span></li>
<li><span style="font-family: Symbol; text-indent: -18pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><span style="text-indent: -18pt;">Breaking up a Monolith</span></li>
<li><span style="font-family: Symbol; text-indent: -18pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><span style="text-indent: -18pt;">Operating </span><span style="text-indent: -18pt;"> </span><span style="text-indent: -18pt;">Micro services</span></li>
</ul>
<!--[if !supportLists]--><o:p></o:p><br />
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l1 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l1 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l1 level1 lfo1; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoNormal">
The presentation started with a historical run through of the
problems of scaling the team size as the complexity of the software increases. To
handle the problem of complexity Mr. Cooper went through decomposing the code
and create loose coupling. The decomposition was first described through
sub-routines and then discussed through a layering architecture. The benefits
of a layered architecture are of course the decomposition and the loose coupling
as well as high cohesion. <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
At low to medium complexity the monolithic component design
is suggested to be used. However when the complexity of the software becomes so
great that it is desirable to use multiple teams that can be work in isolation Mr.
Cooper suggests that it is time to break up the project in smaller components. Historicaly this has been done through RPC calls but Mr. Cooper goes through all the problems with using RPC style communicating
for interacting between the components. <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The initial discussion of design evolving over the decades culminates
in the introduction of service providers.
In the seminar the service is defined by:<o:p></o:p></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo2; text-indent: -18.0pt;">
</div>
<ul>
<li><span style="font-family: Symbol; text-indent: -18pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><span style="text-indent: -18pt;">Autonomous</span></li>
<li><span style="font-family: Symbol; text-indent: -18pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><span style="text-indent: -18pt;">Explicit Boundary</span></li>
<li><span style="font-family: Symbol; text-indent: -18pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><span style="text-indent: -18pt;">Is a Bounded Context</span></li>
<li><span style="font-family: Symbol; text-indent: -18pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><span style="text-indent: -18pt;">Is a Business Capability</span></li>
<li><span style="font-family: Symbol; text-indent: -18pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><span style="text-indent: -18pt;">Eventually Consistent</span></li>
<li><span style="font-family: Symbol; text-indent: -18pt;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;">
</span></span><span style="text-indent: -18pt;">Decentralized Governance</span></li>
</ul>
<!--[if !supportLists]--><o:p></o:p><br />
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo2; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo2; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo2; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo2; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo2; text-indent: -18.0pt;">
<o:p></o:p></div>
<div class="MsoNormal">
Following the definition of the service the size of the
service is discussed. To highlight this the drawbacks of an monolithic
component are compared with the problems of a swarm of “nano” services.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<br />
<div class="MsoNormal">
Due to the time constraint of the talk the presentation of
breaking up a monolith and operating micro service became quite rushed. Even though the end of the talk became quite
hard to take in since it was a lot of information in rapid succession I found the seminar to be quite good. <o:p></o:p></div>
Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-57237004845257346402015-06-17T02:35:00.002-07:002015-06-17T03:19:36.143-07:00Duplicating Data or Replicating data in Micro Services by Dennis van der Stelt<div class="MsoNormal">
I’m a bit late to the micro service party and am not read up
on many of the concepts of micro services so some of the points of the seminar
might well have gone over my head. With that said I don’t feel that the title
of the presentation was thoroughly reflected in the talk. The point seemed to be that
data should not be duplicated over service boundaries but replicating data
within service boundaries is ok to solve problems such as performance
optimizations, optimization of queries, resolving latency issues, and resolving
network issues. The data that should be duplicated over service boundaries are
state changes, identifiers for what the request relates to, and date time info.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The rest of the talk was a mash up of what monolithic and
micro services are, publish-subscribe for messaging, and a brief show case on
how NServiceBus can be used to resolve monitoring issues. <span style="font-family: Calibri, sans-serif; font-size: 11pt; line-height: 115%;">Both
the positive and negative parts of monolithic applications and micro services
was discussed which I thing is great. </span>There was a short
example of micro services that used Uber as an example. During the presentation the <a href="http://www.amazon.com/SOA-Patterns-Arnon-Rotem-Gal-Oz/dp/1933988266/ref=sr_1_1?ie=UTF8&qid=1434533327&sr=8-1&keywords=soa+patterns" target="_blank">SOA Patterns</a> book was recommended as a good read.</div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
During the presentation there was a small problem with the
audio going out however this was quickly and professionally resolved. Overall I
think it was a decent seminar however I think it could have been more focused. <o:p></o:p></div>
Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-13192448467938742802015-06-17T01:12:00.000-07:002015-06-17T01:12:04.069-07:00Keynote: Data and Goliath - The Hidden Battles to Collect Your Data and Control Your World<div class="MsoNormal">
Bruce Schneier is an excellent speaker and the topic of how
we produce data as an exhaust in today’s society is extremely relevant. He
talked in detail about how governments and company’s today analyze our every
move and we are happily giving up this information by carrying around personal surveillance
devices (cellphones). He also pointed
out that we share one world and one net and there is only one solution, either
everybody gets privacy and security and it is built into the backbone or no one
gets it. <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">In the end Mr. Schneier makes states the dualism
of sharing data. We want information about traffic jams by sharing location
data while driving. It would be incredible useful if we pooled all medical
records and let researchers loose on it. However, this is incredible personal
data and what we decide should be shared and how we managed data is a subject
that we will be judged on by coming generations.</span>Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-52633048791681724612015-06-17T00:58:00.001-07:002015-06-17T00:58:25.279-07:00Initial Impressions:<div class="MsoNormal">
I’m standing in front of the main stage waiting for the key
note by Bruce Schneier. I’m already regretting being a huge nerd and bringing
my copy of Applied Cryptography since it feels like a lead brick. However it was completely worth since I actually
got it signed.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<br />
<div class="MsoNormal">
The conference floor has some software firms present but not
so many that it feels crowded. There are approximately five hundred places to
get a coffee. The venue feels room
however it is still early so I might need to revise that statement by Friday<o:p></o:p>I’m standing in front of the main stage waiting for the key
note by Bruce Schneier. I’m already regretting being a huge nerd and bringing
my copy of Applied Cryptography since it feels like a lead brick. However it was completely worth since I actually
got it signed.</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
The conference floor has some software firms present but not
so many that it feels crowded. There are approximately five hundred places to
get a coffee. The venue feels room
however it is still early so I might need to revise that statement by Friday.<o:p></o:p></div>
Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-39775452012431983222015-06-16T14:59:00.000-07:002015-06-16T23:29:44.933-07:00Attending NDC Oslo<div class="MsoNormal">
So nothing has happened on this blog for a long while and perhaps
it is time to do something about that. I’m attending <a href="http://ndcoslo.com/" target="_blank">NDC</a> in Oslo for the first
time this year and I thought that this might be the right time to start up the blog
again. <o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
I will try to give my impressions of NDC for the next couple
of days and write some comments on those seminars I attend. My focus will be
mostly on .NET however there are several seminars that I will attend that
focuses on design, UI, and similar more general topics.<o:p></o:p></div>
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span>
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Of course this blog will reflect my opinions of
the conference so your mileage may vary.</span><br />
<span style="font-family: "Calibri","sans-serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br /></span>Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-80211030304423841322012-11-21T12:48:00.002-08:002012-11-21T12:48:36.982-08:00The slow and steady tsunami of Open Source Recently I have started reading some materials I should have read over a decade ago. It is the essay collection <a href="http://shop.oreilly.com/product/9780596001087.do">The Cathedral & the Bazaar</a> that is written by Eric S. Raymond and, the many authored, <a href="http://shop.oreilly.com/product/9781565925823.do">Open Sources</a>. Perhaps it is lucky that I didn't read the books back then because it might have lead me to have an even bushier beard and running down the street screaming at people that the source code should always be available (it always should).<br />
<br />
When I was a teenager I was dimly aware of the Open Source revolution that was happening. I have a friend that was more in tune what was happening then I was and he introduced me to Linux. It didn't take long for me to get hooked and I have been a proponent of open sourced software ever since.<br />
<br />
However supporting an idea and keeping track of the progress is two quite separate things and I have not followed the development of the open software movement. Watching webcasts from the Build event in Redmond it brought to my realization that the open source movement might actually be winning (yes with tiger blood dripping from its teeth). Some of the talks that gave me this feeling is <a href="http://channel9.msdn.com/Events/Build/2012/2-005" target="_blank">The Future of C++</a> and <a href="http://channel9.msdn.com/Events/Build/2012/3-013" target="_blank">It’s all about performance: Using Visual C++ 2012 to make the best use of your hardware</a>. The first presentation talks about the renascence of C++ and mentions Microsofts commitment to the C++11 standard. It also mentions the site <a href="http://www.isocpp.org/" target="_blank">isocpp.org</a> which is heavily funded by Mircrosoft. If MS is ready to support a portable language with an open standard without trying to invent their own conflicting standard something must be going right in the world. The second clip handles the new C++ AMP API which is only available on Visual Studio 2012 right now, but it is an open documented API the anyone can port.<br />
<br />
Microsoft has even made it possible to use their new release of Team Foundation Server under Linux, <a href="http://blogs.microsoft.co.il/blogs/morgen/archive/2010/06/07/using-tfs-in-linux-ubuntu.aspx" target="_blank">here</a> is a blog that shows how to set it up on an virtual machine running Ubuntu.<br />
<br />
I think we are seeing more and more of the code that used to be hidden away. API's are pushed closer to the core functionality and more code is shared. Just a while back Facebook shared their internal bag of C++ hacks called <a href="http://www.facebook.com/notes/facebook-engineering/folly-the-facebook-open-source-library/10150864656793920" target="_blank">folly</a>. Google has always been big on the open source scene with their <a href="http://code.google.com/hosting/" target="_blank">project hosting</a> and the <a href="http://code.google.com/soc/" target="_blank">Summer of Code</a> event and more companies are doing similar things.<br />
<br />
If new developers manages not to be torn apart from all the choices that are available I think there is a bright future for those who choose the open source path. Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com2tag:blogger.com,1999:blog-8269038367901025988.post-57554456299469061812012-09-22T10:56:00.000-07:002012-09-22T10:56:12.175-07:00Compilers should be more evilRecently I ran in to one of those occasions where you do something incorrectly that should not work, and it still does. In my case it had to do with inheritance of forward declared classes. A simplification of what was done can be seen below<br />
<br />
<b>Penguin.h</b><br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv5F_gcBpJvwwz3Ev-NfNHivFBFK8VCXpw0zsD24BPX-caSeDtyzys6vSMFLlZ65y3hsMgAnoZDY95qYVDVXuYBzbHn28bR3C3gnrwWU-Ebh2Hx8fZbi4J-goP6PKaYcqrJGfHgHtEEqI5/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">1: class Bird;
2:
3: class Penguin : Bird {
4: public:
5: Penguin();
6: virtual ~Penguin();
7: void BirdCall();
8: };
</code></pre>
<br />
<b>Penguin.cpp</b><br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv5F_gcBpJvwwz3Ev-NfNHivFBFK8VCXpw0zsD24BPX-caSeDtyzys6vSMFLlZ65y3hsMgAnoZDY95qYVDVXuYBzbHn28bR3C3gnrwWU-Ebh2Hx8fZbi4J-goP6PKaYcqrJGfHgHtEEqI5/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">1: #include "Bird.h"
2: #include "Penguin.h"
3:
4: Penguin::Penguin() : Bird(false) {
5: }
6:
7: Penguin::~Penguin() {
8: }
9:
10: void Penguin::BirdCall() {
11: cout << "Awk awk awk!" << endl;
12: }
</code></pre>
<br />
<b>Bird.h</b><br />
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv5F_gcBpJvwwz3Ev-NfNHivFBFK8VCXpw0zsD24BPX-caSeDtyzys6vSMFLlZ65y3hsMgAnoZDY95qYVDVXuYBzbHn28bR3C3gnrwWU-Ebh2Hx8fZbi4J-goP6PKaYcqrJGfHgHtEEqI5/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">1: class Bird {
2: Bird() {}
3: bool canFly;
4: public:
5: Bird (bool canFly) { this->canFly = canFly; }
6: virtual ~Bird() {}
7: virtual void BirdCall() = 0;
8: };
</code></pre>
<br />
My real code was slightly more complicated than this and had a lot less to do with birds. The interesting thing was that the compiler managed to compile this into working code. Forward declared classes such as <span style="font-family: 'Courier New', Courier, monospace;">Bird</span> on the first of <b>Penguin.h</b> cannot be used as base classes. If it could then it would be possible to create circular inheritance and that might very well be the end of the universe.<br />
<br />
What probably happened was that the compiler had already parsed the <span style="font-family: 'Courier New', Courier, monospace;">Bird</span> class once and was already aware of it when it came to parsing the <span style="font-family: 'Courier New', Courier, monospace;">Penguin</span> class. However when the compiler "fixes" things like this for us it creates a confusing mess of how things work. The next class that tries to use a forward declared class as a base class might not work and the programmer has no clue why.<br />
<br />
This kind of problem leaves a certain amount of room for "luck" when writing software. The is nothing wrong with being lucky, some people build entire careers on it (stock brokers, palm readers and so on). However most people distrust luck and prefers if things behave in a consistent manner and that they can acquire a knowledge on how to receive the same result in each case. <br />
<br />
There can be many things said about the error messages of C++ compilers but I would pick a cryptic error message any day over an inconsistent behavior. I think compilers should be more evil and tell us loud and clear when we do something erroneous.Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com2tag:blogger.com,1999:blog-8269038367901025988.post-82676119866844269262012-08-13T14:05:00.003-07:002012-08-13T14:05:47.969-07:00C++/CLI compile optionsWhen compiling C++/CLI code there is several different
compiler modes which sets the level of interaction between managed and
unmanaged code. Depending the on what is should be achieved with the code the
correct compiler option can be the difference between a finished component and
the compiler throwing a tantrum.<br />
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
This post will deal with the options <span style="font-family: "Courier New";">/clr</span>, <span style="font-family: "Courier New";">/clr:pure</span>,
and <span style="font-family: "Courier New";">/clr:safe</span>. There is also the
option <span style="font-family: "Courier New";">/clr:oldSynta</span>x which is
used for compiling code that uses the <a href="http://en.wikipedia.org/wiki/Managed_Extensions_for_C%2B%2B">managed C++ extension </a>.
The managed C++ extension is a predecessor to C++/CLI and uses a completely
different syntax.</div>
<h3>
clr:safe</h3>
<div class="MsoNormal">
This option requires that only verifiably type <a href="http://msdn.microsoft.com/en-us/library/01k04eaf.aspx">safe code</a> is included in the component. This means that the code cannot access unsafe
arrays, that does not carry out boundary checks, or any unsafe pointers. Any calls to native
code must therefore be marshaled and the code cannot contain any instances of
native types. </div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv5F_gcBpJvwwz3Ev-NfNHivFBFK8VCXpw0zsD24BPX-caSeDtyzys6vSMFLlZ65y3hsMgAnoZDY95qYVDVXuYBzbHn28bR3C3gnrwWU-Ebh2Hx8fZbi4J-goP6PKaYcqrJGfHgHtEEqI5/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">1: #pragma once
2: using namespace System;
3: namespace ClrSafe {
4: public ref class ClrSafeClass
5: {
6: private:
7: double offset;
8: public:
9: ClrSafeClass(double offsetParam) : offset(offsetParam) {}
10: ~ClrSafeClass() {}
11: double Translate(double position) { return position + offset; }
12: };
13: }
</code></pre>
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The code above does not contain any references to native
code and can hence be compiled with the <span style="font-family: "Courier New";">/clr:safe</span>
option. In comparison to C# this would be similar to compile with the Any CPU flag, this is because the code does not reference any specific architecture. </div>
<h3>
clr:pure</h3>
<div class="MsoNormal">
The option like the <span style="font-family: "Courier New";">/clr:safe</span>
option generate only IL (Intermediate Language) output. The difference is that
native types and classes are allowed to exist within the component. The compiler makes it so that the calls to native calls are transformed to IL. There are some
limitations to this, such as that the native components cannot be declared to
export their methods from the DLL. Neither <span style="font-family: "Courier New";">__delcspec(dllexport)</span>
nor <span style="font-family: Courier New, Courier, monospace;">.def</span> files will export native calls, this is due to that all exported methods are internally declared with <span style="font-family: "Courier New";">__clrcall</span>.</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv5F_gcBpJvwwz3Ev-NfNHivFBFK8VCXpw0zsD24BPX-caSeDtyzys6vSMFLlZ65y3hsMgAnoZDY95qYVDVXuYBzbHn28bR3C3gnrwWU-Ebh2Hx8fZbi4J-goP6PKaYcqrJGfHgHtEEqI5/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">1: #pragma once
2: #include <cmath>
3: #include <iostream>
4: #include <msclr\marshal_cppstd.h>
5: using namespace System;
6: using namespace msclr::interop;
7: namespace ClrPure {
8: public ref class PureClass
9: {
10: private:
11: double exponent;
12: public:
13: PureClass(double exponentParam) : exponent(exponentParam) {
14: std::string mess = "Using exponential";
15: Console::WriteLine(marshal_as<String^>(mess));
16: }
17: ~PureClass() {}
18: double Power(double base) { return pow(base, exponent); }
19: };
20: }
</code></pre>
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The above code can be compiled with <span style="font-family: "Courier New";">/clr:pure</span><span style="font-family: inherit;"> </span>and the<span style="font-family: inherit;">
<span style="font-family: inherit;">Power</span> </span>method, on row 18, that uses a native function in the <span style="font-family: "Courier New";">cmath</span> library generates the following IL code:</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv5F_gcBpJvwwz3Ev-NfNHivFBFK8VCXpw0zsD24BPX-caSeDtyzys6vSMFLlZ65y3hsMgAnoZDY95qYVDVXuYBzbHn28bR3C3gnrwWU-Ebh2Hx8fZbi4J-goP6PKaYcqrJGfHgHtEEqI5/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">1: .method public hidebysig instance float64
2: Power(float64 base) cil managed
3: {
4: // Code size 15 (0xf)
5: .maxstack 2
6: .locals ([0] float64 V_0)
7: IL_0000: ldarg.1
8: IL_0001: ldarg.0
9: IL_0002: ldfld float64 ClrPure.PureClass::exponent
10: IL_0007: call float64 modopt([mscorlib]System.Runtime.CompilerServices.CallConvCdecl) pow(float64,
11: float64)
12: IL_000c: stloc.0
13: IL_000d: ldloc.0
14: IL_000e: ret
15: } // end of method PureClass::Power
</code></pre>
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
On row 10 there is a call to the native method expressed in IL: Code compiled with <span style="font-family: "Courier New";">/clr:pure</span>
or <span style="font-family: "Courier New";">/clr:safe</span> have native entry
points and are slightly more effective since they both produce a none mixed
assembly.</div>
<h3>
clr</h3>
<div class="MsoNormal">
The <span style="font-family: "Courier New";">/clr</span>
option allows for complete mixing of unmanaged and managed types. This type of
assembly has a mixture of IL and native code. The entry point of the DLL is
native code that then loads the CLR when it is needed. </div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv5F_gcBpJvwwz3Ev-NfNHivFBFK8VCXpw0zsD24BPX-caSeDtyzys6vSMFLlZ65y3hsMgAnoZDY95qYVDVXuYBzbHn28bR3C3gnrwWU-Ebh2Hx8fZbi4J-goP6PKaYcqrJGfHgHtEEqI5/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">1: #pragma once
2: using namespace System;
3: namespace Clr {
4: class __declspec(dllexport) NativeClass
5: {
6: private:
7: double scaleFactor;
8: public:
9: NativeClass(double scaleFactor) : scaleFactor(scaleFactor) {}
10: virtual ~NativeClass() {}
11: double scale(double factor) { return factor*scaleFactor; }
12: };
13: public ref class ClrClass {
14: private:
15: NativeClass* nativeClass;
16: public:
17: ClrClass(double scaleFactor) { nativeClass = new NativeClass(scaleFactor); }
18: ~ClrClass() { delete nativeClass; }
19: double Scale(double factor) { return nativeClass->scale(factor); }
20: };
21: }
</code></pre>
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
The above code has both the possibility to be called by a managed
or unmanaged component, where the managed class is merely a wrapper for the
native class. </div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
This concludes the C++/CLI compiler options that can be used
to create mixed modes and managed DLL’s. A MSDN article on the compiler options can be found <a href="http://msdn.microsoft.com/en-us/library/85344whh.aspx">here</a>. </div>
Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com0tag:blogger.com,1999:blog-8269038367901025988.post-19461697461865405522012-08-10T05:02:00.001-07:002012-08-10T05:02:21.892-07:00Should private data and methods be unit tested?<br />
<div class="MsoNormal">
A central part in OOP (Object Oriented Programming) model is
<a href="http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming)">encapsulation </a>which hinders the external usage of some of the object’s components, such
as its methods and data. Some OOP languages do not have real encapsulation,
Python is an example of this but there is a loose agreement that internal data
that begins with two underscores should not be accessed directly.</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
When it comes to unit testing such objects it can be quite
tempting to check that the accessible methods modify the private data in a
manner that is according to how the class should work. There are usually ways
to achieve this in the programming language without breaking the encapsulation
principle totally. </div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
In C# it is possible to mark components as <span style="font-family: "Courier New";">public</span>, <span style="font-family: "Courier New";">protected</span>,
<span style="font-family: "Courier New";">private</span>, and <span style="font-family: "Courier New";">internal</span>. <span style="font-family: Courier New, Courier, monospace;">protected </span>components of an
object are only available for inheritance while <span style="font-family: Courier New, Courier, monospace;">private </span><span style="font-family: inherit;">components are</span> only available to
the object which they have been declared in. Components of an object that are
declared as internal are only available within the software module, however it
is possible to allow other modules access to them by adding an attribute to the
<span style="font-family: "Courier New";">AssemblyInfo.cs </span>file. </div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
For example if we have a class named <span style="font-family: "Courier New";">AClass</span> that has internal members and we want to have
access to them in the unit test project called <span style="font-family: "Courier New";">AClassUnitTest</span>
the following line should be added to the <span style="font-family: "Courier New";">AssemblyInfo.cs</span>
file which houses the <span style="font-family: "Courier New";">AClass</span>
file:</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">[<span style="color: blue;">assembly</span>: <span style="color: #2b91af;">InternalsVisibleTo</span>(<span style="color: #a31515;">"AClassUnitTest"</span>)]<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Declaring an internal constructor which allows for injecting
mocks into the class that should be tested is good usage of this functionality.
The private and protected components can also be accessed through what is
called Accessors. There is an article on MSDN on using <a href="http://msdn.microsoft.com/en-us/library/bb385974.aspx">Accessors on MSDN</a><a href="http://msdn.microsoft.com/en-us/library/bb385974.aspx"> </a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
In C++ there is the <span style="font-family: "Courier New";">friend</span>
keyword that can be used to access private components of another object.</div>
<div class="MsoNormal">
<br /></div>
<pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv5F_gcBpJvwwz3Ev-NfNHivFBFK8VCXpw0zsD24BPX-caSeDtyzys6vSMFLlZ65y3hsMgAnoZDY95qYVDVXuYBzbHn28bR3C3gnrwWU-Ebh2Hx8fZbi4J-goP6PKaYcqrJGfHgHtEEqI5/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;">1: #include <iostream>
2: using namespace std;
3: // Predeclaration for AClass so the BClass is aware of it existance.
4: class AClass;
5: class BClass {
6: private:
7: int data;
8: void printData() { cout << data << endl; }
9: public:
10: BClass (int insertData) : data(insertData) {}
11: friend AClass;
12: };
13: class AClass {
14: private:
15: BClass* dataClass;
16: public:
17: AClass (BClass *insertDataClass) : dataClass(insertDataClass) {}
18: virtual ~AClass() { delete dataClass; }
19: void fireDataClass() {
20: if (dataClass)
21: dataClass->printData(); // Calling the private method on BClass
22: }
23: };
24: int main(int argc, char* argv[]) {
25: AClass friendClass(new BClass(10));
26: friendClass.fireDataClass();
27: return 0;
28: }
</code></pre>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
In the example above the <span style="font-family: "Courier New";">AClass</span>
can access both the <span style="font-family: "Courier New";">private</span>
function and data of the <span style="font-family: "Courier New";">BClass</span> which is due to that the <span style="font-family: "Courier New";">BClass</span> friends <span style="font-family: "Courier New";">AClass</span> on row 11. Simply by pre-declaring a unit test
class it is possible to prepare a class so that the internal members are
available for unit testing. A more in depth description of the <span style="font-family: "Courier New";">friend</span> keyword and its usage can be
found <a href="http://www.cplusplus.com/doc/tutorial/inheritance/">here </a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
However testing private data with unit test makes the black
box, that objects usually are, transparent. Changing the internal functionality
of the objet will then carry a high probability of breaking the unit test even
though the functional contract of the object has not been violated. There are
good grounds to treat objects as black boxes even during the testing of the
objects.</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Unit test should only verify the externally visible components
of an object so it is possible to safely refactor the code of the object
without destroying its usability. Rewriting of a test should only occur when
the object has had a breaking change to its interface and this should indeed be
a time for reflection on what has been done. </div>Somethinghttp://www.blogger.com/profile/15328249570962030585noreply@blogger.com4