Skip to content

Jimmy Bogard
Syndicate content
Strong opinions, weakly held
Updated: 2 hours 5 min ago

Platform generalists versus framework specialists

Tue, 08/11/2015 - 21:50

A trend I’ve noticed especially in Javascript/front-end jobs are emphasizing, requiring, even titling jobs after specific Javascript frameworks. “Ember.js engineer needed”. “Angular programmer”. This raises a few of thoughts for me:

  • Is the framework so complicated you need someone with extensive experience building non-trivial apps?
  • Is your timeline so short you don’t have time to teach anyone a framework?

Earlier in my career, when WPF was announced, I had a choice to invest time in my career to learning it. It was the obvious successor to WinForms, and *the* way to build thick-client apps in .NET, if not Windows going forward. I hesitated, and decided against it, after learning more about the technology and seeing how proprietary it was.

Instead, I doubled-down on the web, learning server-side frameworks to help build web apps more than ever. ASP.NET MVC embraced the web, unlike WebForms, which had its own invented abstractions. All the WebForms knowledge I had is more or less wasted for me, and I vowed to never again become so engrossed with a technology that I become specialist in a framework at the expense of understanding the platform it’s built upon.

I don’t want to be an “Ember” guy, an “Angular” dev, an “Aurelia” expert. I want to be a web expert, a messaging expert, a REST expert, a distributed systems expert. I saw this most clearly recently when helping out on a Spring MVC project. Because I understood web platforms, I could pick up the framework easily. The parts in Spring that were hard were hard because of the complexity of the framework, and those were parts I was a lot less inclined to be an expert upon.

One of the biggest reasons I’ve shied away from new, all-inclusive, heavyweight frameworks is it’s a tradeoff for me of potential productivity and administrivia knowledge. I’ve only got so much room in my head, and I’d much rather it be occupied with more important things, like vintage Seinfeld/Simpsons quotes.

Post Footer automatically generated by Add Post Footer Plugin for wordpress.

Categories: Blogs

AutoMapper 4.0 Released

Wed, 08/05/2015 - 18:46

Release notes here: https://github.com/AutoMapper/AutoMapper/releases/tag/v4.0.0

On NuGet of course.

This was a big release – I undertook the exciting challenge of supporting all the new platforms from VS 2015, and in the process, collapsed all of the projects/assemblies into exactly one assembly per target framework. It’s much easier to manage on my side with just the one project instead of many different ones:

I have to use compiler directives instead of feature discovery, but it’s a tradeoff I’m happy to make.

There’s a ton of small bug fixes in this release, quite a few enhancements and a few larger new features. Configuration performance went up quite a bit, and I’ve laid the groundwork to make in-memory mapping a lot faster in the future. LINQ projection has gotten to the point where you can do anything that the major query providers support.

Enjoy!

Post Footer automatically generated by Add Post Footer Plugin for wordpress.

Categories: Blogs

C# 6 Exception Filters Will Improve Your Home Life

Fri, 07/17/2015 - 23:00

If you’re like me and you enjoy nice, peaceful weekends, but keep getting hassled when something bad happens in production to shatter the blissful silence you’re enjoying, a great new feature of C# 6 will help you out:

try {
  // Do stuff
} catch (Exception e) when (
  (DateTime.Now.DayOfWeek == DayOfWeek.Saturday)
  || (DateTime.Now.DayOfWeek == DayOfWeek.Sunday)) {
  // Swallow
}

Swallow exceptions – but only on weekends! Now you won’t get bothered any more, the app will always be up and running! The error logs will be nice and clean as if nothing has gone wrong at all.

This can be extended if it’s just one person hassling you a lot:

try {
  // Do stuff
} catch (Exception e) when (Thread.CurrentPrincipal.Identity.Name == "JBOGARD") {
  // Swallow
}

The possibilities are endless.

Post Footer automatically generated by Add Post Footer Plugin for wordpress.

Categories: Blogs

Entity Framework extensions for AutoMapper

Wed, 07/08/2015 - 16:12

I pushed out a little library I’ve been using for the last couple years for helping to use AutoMapper and Entity Framework together. It’s a series of extension methods that cuts down the number of calls going from a DbSet to DTOs. Instead of this:

Mapper.CreateMap<Employee, EmployeeDto>()
  .ForMember(d => d.FullName, opt => opt.MapFrom(src => src.FirstName + " " + src.LastName));

var employees = await db.Employees.ProjectTo<EmployeeDto>().ToListAsync();

You do this:

public class Employee {
  [Computed]
  public string FullName { get { return FirstName + " " + LastName; } }
}
Mapper.CreateMap<Employee, EmployeeDto>();

var employees = await db.Employees.ProjectToListAsync<EmployeeDto>();

The extension methods themselves are not that exciting, it’s just code I’ve been copying from project to project:

public static async Task<List<TDestination>>
  ProjectToListAsync<TDestination>(this IQueryable queryable)
{
  return await queryable
    .ProjectTo<TDestination>()
    .DecompileAsync()
    .ToListAsync();
}

I have helper methods for:

  • ToList
  • ToArray
  • ToSingle
  • ToSingleOrDefault
  • ToFirst
  • ToFirstOrDefault

As well as all their async versions. You can find it on GitHub:

https://github.com/AutoMapper/AutoMapper.EF6

And on NuGet:

https://www.nuget.org/packages/automapper.ef6

Enjoy!

Post Footer automatically generated by Add Post Footer Plugin for wordpress.

Categories: Blogs

AutoMapper dev builds moved to MyGet

Tue, 07/07/2015 - 20:08

I’m moving the dev builds for AutoMapper to MyGet, here:

https://www.myget.org/F/automapperdev/api/v2

I’ll still have pre-release builds on NuGet, but it’ll be a little less noisy having the NuGet builds be only builds from master.

<eom>

 

Post Footer automatically generated by Add Post Footer Plugin for wordpress.

Categories: Blogs