• Skip to main content
  • Skip to footer

InRhythm

Your partners in accelerated digital transformation

  • Who We Are
  • Our Work
  • Our Culture
  • Events
  • Testimonials
  • Blog
  • Contact Us

Software Engineering

Nov 19 2018

WebAssembly Will Change the Way You Code

WebAssembly (WASM) is a new type of code that runs in browsers. Previously, developers of browser-based web applications had only one choice of programming language and/or environment: JavaScript. This was good and much gold did the people earn; nevertheless, some weren’t happy that they had only one choice. WASM is here to change that. WASM, according to Mozilla, “is not primarily intended to be written by hand, rather it is designed to be an effective compilation target for low-level source languages like C, C++, Rust, etc.” This is the key point. You can now write “web scripts” using the language of your choice. That’s huge.

Is WASM trying to kill JavaScript? No, says the inventor of JavaScript, Brendan Eich. The goal of WASM is to enable a more linguistically-diverse development ecosystem delivering extremely fast (native or near-native speed) code through efficient compilation and parallelization (the ability for web software to take advantage of multiple processors). More huge.

This last point is maybe the most important. InRhythm engineer Will Bratches pointed out in a recent lightning talk that increases in speed are no longer achieved at the chip level—Moore’s Law is no more. What we do now is spread work across cores, leveraging parallelization and managing concurrency. Client-side JavaScript is not designed for that world. New languages like Go and Rust are. WASM unifies the two. 

Here comes the “hello world!” moment. Head over to WebAssembly Explorer—it’s sort of a CodePen for WASM. On the left panel, paste this code:

int plusOne(int num) {
return num + 1;
}

Next, click “compile”. You’ll see something like this:

WASM WebAssembly Screenshot

Yes, that’s assembly code on the right (I know!). A more human, readable version is in the center column, the WAT view, which you can read more about here.  Just scan through it—you’ll see our function name plusOne represented as $_27plusOnei. You’ll also see that we’re establishing 32-bit integer parameters, setting their scope to “local” and so forth.  You can, for example, see how the assembly code  (add)s one to the (ex)tended (a)ccumulator register for 32-bit numbers:

add eax, 1

…is represented in the WAT:

(i32.const 1)

You can now hit the “download” button, which will deliver a .wasm file.  That’s really it—you have the WASM binary to use. There’s a tiny bit of work you have to do to compile the WASM so it works in your browser. The easiest thing to do is clone this simple example and load the index.html in your browser. Check the console. Now read through the code.

There’s a lot more to this subject, so start exploring. You’ll be creating first-person shooters in your browser in no time!

Written by Sandro Pasquali · Categorized: Learning and Development, Product Development, Software Engineering

Oct 08 2018

GraphQL: The API Query Language


Overview

GraphQL is an API query language used to obtain data from a server. It serves a similar purpose to a RESTful API, but with some distinct advantages.

The first advantage is that the you will only receive the data that you request. Part of the payload of a GraphQL request is the list of fields to return. This can help reduce load time for a request by only including the data that the consumer needs.

Another advantage of GraphQL is that you can get all the data you need in a single request. By defining the data you want from related fields, you can get all that data you need from those in one API call.

You can also very simply update the API without versioning. Adding new data to your endpoint will not cause any issues as the client will still only receive the data requested.

You can also use GraphiQL to test and document your API.

Example

Creating and consuming a GraphQL API is very simple. Let’s briefly go through setting up the server and then creating a simple client. In this article, we will be using Apollo and Node.js for the server, but GraphQL libraries are available in many languages.

First we need to define our data. We do this in GraphQL by defining type`s. Let’s consider a simple contact model:

type Contact {
name: String!
email: String!
}

This tells GraphQL that we have a type that is Contact that will include two strings, name and email. The next thing we need to do is define our queries:

type Query {
contacts: [Contact]
contact(name:String!): Contact
}

In this case we have two different queries. The first will return a list of Contacts and the other will return one Contact identified by the required name parameter.

Third we can define any Mutations that will allow for any changing of the data:

type Mutation {
addContact(name:String!, email:String!): Contact
}

The last step here is letting GraphQL know how to resolve these queries and mutations. To do this we will define resolvers:

var contacts = [
{name: "Test User", email: "test@user.com"},
{name: "Other User", email: "other@user.com"}
];
const resolvers = {
Query: {
contacts: () => contacts,
contact: (_, { name }) => contacts.find((c) => c.name === name)
},
Mutation: {
addContact: (_, { name, email }) => {
newContact = {name: name, email: email};
contacts.push(newContact);
return newContact;
}
}
};

Now all that is left is to hook it up. This depends on your exact setup, so I won’t go into detail. here.

Client

Creating a client to consume your new GraphQL endpoint is very simple.

Let’s create some GraphQL queries:

{
contacts{
name
email
}
}
query Contact($name:String!){
contact(name: $name){
name
email
}
}

Mutations will look something like this:

mutation addContact($name:String!, $email:String!) {
addContact(name: $name, email: $email) {
name
email
}
}

You can find a simple version of this application here: https://github.com/thomascking/graphql

More information: https://graphql.org/ https://www.apollographql.com/ https://www.robinwieruch.de/graphql-apollo-server-tutorial/

 

Written by Thomas King · Categorized: InRhythm News, Software Engineering

Jun 01 2018

ES6 IIFEs with fat-arrow functions

Writing Immediately Invoked Function Expressions or IIFEs in ES6(Also known as ES2015) just got a lot easier with the introduction of fat arrow functions.

(global => {
  const MY_CONSTANT = 'api key or something'
  let counter = 0
  let some_array = [1,2,34,5,6,7]

  counter = some_array.reduce (total, item) => total + item
})(window)

This is great. Much shorter than the old ES5 way of writing IIFEs. Or if you don’t need to reference the window/global object and you just hate extra characters:

()=> {
  // code goes here...
}()

I would be hesitant to use this second approach in some cases because it’s not immediately clear that the function is going to be invoked immediately. The containing parens(while not super pretty) let you know from line one that this is a function that will be invoked right away. Also be careful using this in fat arrow functions in general. They have a slightly different context than normal functions which can bite you.

As a bit of extra credit there’s an even shorter way to write IIFEs in ES6 which is to use the block context syntax (not super recommended. there’s a reason you probably haven’t ever seen this before) all on its own like so:

// some code...
{
  // whatever happens here is private and invoked immediately
  console.log("I'm executing code immediately!")
}
// more code...

This approach is very fun because it requires the absolute minimum amount of code. It doesn’t allow us to take/pass arguments though so it’s a bit limited in terms of the features we usually use in IIFEs but that shouldn’t stop you if all you want to do is create a new closure to hide private variables from outside code.

This post originally appeared on Jack of Spades. Check out his more recent writing and follow him on twitter!

Written by Jack Tarantino · Categorized: Learning and Development, Software Engineering

May 28 2018

Where my girls at?

This post is another by InRhythm’s own Sari Morninghawk. For the full post and additional links, check out the original Where My Girls At?” on her website.
Women – Major Contributors to Computer Science

Many computer science pioneers were women. The first computer programmer and the people who programmed the first digital computers were all women. In the early days of computers, programming was considered “women’s work” while building and architecting the machines was mostly left to the men.

  • Ada Lovelace published the first algorithm to be run on a mechanical general-purpose computer. She is considered the first computer programmer.
  • Women were computer operators on the Colossus, the first programmable, electronic, digital computer at Bletcheley Park.
  • The ENIAC programmers, Kay McNulty, Betty Jennings, Frances Spence, Betty Snyder, Marlyn Wescoff, and Ruth Lichterman programmed without programming languages or tools — because none existed!
  • Jean E. Sammet developed the FORMAC programming language and was one of the developers of COBOL.
  • Grace Hopper, a pioneer of computer programming, invented the first compiler.
  • Adele Goldberg, one of the developers of SmallTalk, contributed to concepts in object-oriented programming.
  • Shafi Goldwasser has made fundamental contributions to cryptography, computational complexity, computational number theory and probabilistic algorithms.

Continue reading on Sari’s blog…

Written by Sari Morninghawk · Categorized: Culture, Learning and Development, Software Engineering, Talent

May 21 2018

Cupcakes, Application Design, and UX

This post is another by InRhythm’s own Sari Morninghawk. For the full post and additional links, check out the original “Cupcakes, Application Design, and UX” on her website.

My grandkids are often an inspiration for many of my best ideas. For example, when I came home from work yesterday, my oldest granddaughter had her homemade cupcakes on display in the kitchen. They were her original recipe, exceptionally beautiful, and also — delicious. Riding the train into work this morning, my mind wandering towards my next blog, I realized that these cupcakes are a perfect metaphor for excellent app design and a wonderful user experience (UX).

There are many ways to look at this. The simplest being that the beauty of the cupcake is good design, causing the consumer, in the case of the cupcake or the user, in the case of the application, to do what you want. Consumers eat the cupcake; users read, shop, sign up, or whatever action is the goal. If the cupcake is delicious, the consumer has an enjoyable experience. If the cupcake doesn’t taste good or has a disagreeable texture, the consumer has a poor experience regardless of the cupcake’s visual appeal. The objective of design is to compel the user into action resulting in a positive UX.

Written by Sari Morninghawk · Categorized: Agile & Lean, Design UX/UI, Software Engineering, Talent

  • « Go to Previous Page
  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Go to page 4
  • Interim pages omitted …
  • Go to page 13
  • Go to Next Page »

Footer

Interested in learning more?
Connect with Us
InRhythm

140 Broadway
Suite 2270
New York, NY 10005

1 800 683 7813
get@inrhythm.com

Copyright © 2021 · InRhythm on Genesis Framework · WordPress · Log in

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.

Necessary Always Enabled

Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.

Non-necessary

Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.