The Problem With Repositories

What follows is an edited down version of a chat conversation in the Operation Code slack. The context is that of someone studying up on .Net but, patterns being what they are, this applies elsewhere as well. The question was over explaining the repository pattern. I have strong opinions here and differentiate between how repository is defined, how it might be implemented in a manner true to it’s intent, and how it is often (mis)implemented with unfortunate consequences. The best opinions are changed opinions and this is one that I admit to having been wrong about. I used to be a defender of the repository pattern. It was likely the first pattern that I felt I understood. Back in 2009 it was also the subject of debate largely – as I remember it – between .Net giant Oren Eini and the folks over at Codebetter (blog unfortunately no longer particularly […]

Are You Multilingual? Why It’s Important to Master Multiple Programming Languages

Every programmer has a language they prefer to work in. Whether it’s because it’s the one they’re most used to or the one that best meets their coding needs, they’re not shy about telling you which is their favorite and why. But man cannot live on Perl alone. No matter how versatile or easy to use your favorite programming language, it’s important to be able to use others just as fluently. Here are a few reasons why. Job Opportunities Google programming is done using Python. Say your dream job is to work for Google, and you learned Python for that very reason. You’re an expert in it. So you apply to Google, but sadly don’t get the job. No worries. With your programming skills, there are plenty of other tech companies that would love to have you on your team. So next you try Microsoft. They use primarily C, C#, […]

Programming Language Popularity in 2018

Programming languages come and go over time, and it always seems there is some new, “hot” language that is all the rage. With things changing all of the time, if you were to start a new project, how would you decide what language your software should be written in? What’s Popular First, how do we even know what is popular at the moment? There are a few different methods one can use to determine what is being used in the real world; you can search job boards and see what companies are hiring for; you can follow news sources and get a feel for what is in the news; or you can get statistics from popular code-related sites such as a code repository host like Github. For example, in the fourth quarter of 2017, Github reports the following for the top 5 JavaScript Python Java Ruby PHP   Javascript holds the […]

Web Components Tutorial

The following tutorial was given by our own Chris Daudier, a senior software engineer at Surge. This is a quick introduction to Web Components, a new set of web standards that allow for reuse of CSS, JavaScript and HTML to design widgets or components in web applications. In this demo we go over these four new standards created by W3C which are HTML Imports, Custom Elements, Shadow DOM and HTML Templates. We’ll also utilize each one while creating a demo for a simple calculator.

Tutorial on GitHub’s Electron Platform

The following tutorial was presented by Nich Curtis, a senior software engineer at Surge. This video is an introduction to building Cross Platform HTML5 applications using GitHub’s Electron platform. Learn about the various Electron modules and how they enable cross platform development using web technologies such as Node.js, HTML5, Javascript, and CSS.

Useful Browser Extentions

Browser debugging tools have come a long way in a short amount of time. Here are some of our favorites. Firefox Firebug http://getfirebug.com Firebug is the quintessential developer plugin for Firefox. It comes with several powerful sections: Console The console allows you to view requests made to the server. Each can be expanded to view the response/request headers, the raw response, and the parameters sent. View the output from javascript console commands, such as console.log and console.error, which support printing an object that can be clicked on and viewed in the DOM tab. An input console which allows for the execution of scripts in the current context. Because it does not use a new context global variables can be accessed, including jQuery. This is useful to test jQuery selectors/ events, and useful in a thousand other ways. HTML This tool is fantastic for debugging bad HTML/CSS, as it allows for […]

Getting a Value Back from a jQuery Dialog

There’s many ways to do so. You can use the close event and pickup values passed through the .data() method on the dialog, you can use a variable in the window context, but these are all very lacking in structure, however –All jQuery UI elements allow you to pass any value you want in while constructing t Inside of our dialog, we can now access this success call back by doing yourSelector.dialog(“option”, “success”); Lets give a real world example. This dialog runs the success function passed as an argument when one of the buttons is clicked. This function displays our dialog: Now for some of the code inside of the dialog’s ready event. As is relatively clear in the code, only when the “Choose Highlighted Location” button is clicked is the function we passed into the dialog’s options object called. Keep in mind, this function could be called in response […]

Making jQuery UI Autocomplete “Super Search”

jQuery UI’s autocomplete widget provides no built in functionality to alter the search behavior, but has a static filter method that can be overridden instead, and as such, will be on an application wide basis. “Super search” is a generic term meaning orderless word search, as that “foo bar” and “bar foo” discover the same results. This code can go anytime after jQuery UI library is loaded. This code shamelessly uses some of my favorite libraries but could be easily crafted to work without them. linq.js underscore.js And also makes use of the following function:

Optimal Nen Queries, Part 1: Delayed Execution

Nen is  a LINQ provider and as such uses delayed execution. Delayed execution means that whenever a query is written it’s not actually performed until the result set is being accessed, which is often by enumeration. Consider the following: As you see in the comments, 3 queries were performed across what is inevitably the same result set. Rather suboptimal. The best idea is to store an enumerated data set. This way the results are stored in memory and the enumerable LINQ provider is used, instead of the Nen data provider which will re-access the database. This can be used to move operations to/from the database. Webservers are often more scalable than database servers, and ordering operations can be costly, so it’s often a good idea for the ordering operation to be performed by the webserver.  This can not be done if a limited subset needs to be returned from the database […]

jQuery Events by Example

As a supplement to this article, http://fuelyourcoding.com/jquery-events-stop-misusing-return-false/lets look at jQuery event handling by example. Event bubbling to parent Original event target on bubbling ‘this’ on event bubbling ‘currentTarget’ on event bubbling stopPropagation’s effect on event bubbling Event bubbling and multiple events on a single object stopImmediatePropagation’s effect on inner event propagation (multiple events on a single object) Using custom named events with ‘trigger’ The context of ‘this’ when an event is passed directly and when called