IndyWatch Education Feed Archiver

Go Back:30 Days | 7 Days | 2 Days | 1 Day

IndyWatch Education Feed Today.

Go Forward:1 Day | 2 Days | 7 Days | 30 Days

IndyWatch Education Feed was generated at Community Resources IndyWatch.

Wednesday, 16 May

20:53

Are you being micro-managed? Manage your relationship with your manager instead. "IndyWatch Feed Education"

Being micromanaged sucks. Its a major complaint people have with their managers. You feel demotivated and undervalued, and it inhibits your own learning.

As a manager of managers, Ive written before about how micromanaging is one of the most common early mistakes I see new managers make. But thats from the perspective of the manager.

You could just blame your manager, or you could take an Extreme Ownership approach and actually fix the situation. Lets talk through how to do that.

Diagnose the Situation

Usually, micromanaging stems from a mix of the following reasons:

Your manager is unaware that theyre doing it

This is especially true for new managers. Ironically smart, driven managers who were successful individual contributors (ICs) tend to have this issue more frequently. Very few managers want to make your life miserable.

For instance, maybe in a meeting, rather than letting you answer a question fielded from someone else, they just speak up because they know the answer themselves.

Your manager is afraid of failure

A lot of new managers suffer from imposter syndrome. They dont know how to measure their managerial outcome, as it involves new types of tasks with less concrete tasks and outcomes (did I make the right decision? Is my team happy?) than their IC work (did I implement that feature I said I would implement in the time I had committed to?).

So they fall back to doing IC work because its measurable and easier for them to do. The problem is, its your IC work (they implement that feature you said you would implement in the time you committed to.

Your manager is prioritizing the teams short-term execution rather than your long-term growth and development

Maybe your manager can fix that bug faster than you can. Fixing bugs quickly is good, right? But even though it may have taken you longer, you would have actually learned something given the chance.

Your manager may or may not have a good reason to prioritize short-term execution. Occasionally (though infrequently), its the right thing to do.

A mismatch in expectation between what you think you can accomplish and what your manager thinks you can accomplish

This one is more serious, but its still usually addressable. Often, its not that your manager lacks confidence...

18:29

How to build your own React boilerplate "IndyWatch Feed Education"

So youve learned some React and built a few things. Youve probably used create-react-app or react-slingshot to get off the ground quickly with minimal configuration. However, now youre ready to venture out on your own with your very own React boilerplate.

WHERE. TO. START?

I recently faced this same dilemma. It was a struggle, but at the end of it, I had a solid repo that I could use as a basis for future React projects.

I realized I wanted to use Webpack because its the new hotness (well not so new), but I wouldnt have a lot of resources to pull from to figure it out.

I have zero working knowledge of Grunt or Gulp, although after looking at them briefly, I know they do some cools things in their own right.

Also, the people I know who know more than I do use Webpack. I also had a reference React boilerplate Webpack config I was going to use as a base (but I quickly realized I was going to have to rewrite most of this config).

Back to the beginning

Lets take it back, though. What really is a boilerplate? Dictionary.com failed in getting me a definition that would work. Oxford Dictionaries, on the other hand, landed the W with:

3.1 Standardized pieces of text for use as clauses in contracts or as part of a computer program.

This works. So its something thats standard across computer programs. As in some code thats always the same at least in theory. So instead of having to run things like npm i react react-dom webpack and so on every time we start a project, we can copy our boilerplate and be off to the races knowing all the essential pieces we want are ready to go.

And since well be building our own boilerplate, well know that everything is being maintained the way we want it to, because its ours. We will also learn a lot during the process, and possibly even decide to make decisions that differ from what others have instructed us to do.

Get Git

First lets create a local folder and make this a Git repository.

First things first

N...

17:45

How I built an NBA player profile fetcher with React, Redux-Saga, and Styled Components "IndyWatch Feed Education"

Hello, all! Its been a while since I built something out of personal enjoyment or curiosity, so I surfed the internet exploring cool APIs.

Since its NBA Playoff time (sadly, Im a Knicks fan), I decided to see if there was an existing API that contained the data of every player currently in the NBAand heck yeah, there was.

Also, a project Im working on at my job has introduced me to two awesome libraries called redux-saga and styled components. They are pretty darn exciting, and are two things I definitely plan to try and use in all my future projects.

So lets build a React application with these libraries!

Before we dive in, lets just talk a bit about redux-saga and styled components and why they are handy.

Redux-Saga

In Redux, actions and reducers are pure, meaning they dont have any side effects.

An example of a side-effect could be something like a service request. When you are making a request, it can fail or return a different kind of result even though you always send the same request.

So if your reducers and actions are pure, where can you handle / put side effects? Well redux-saga is a solution. It allows you to listen to actions, perform a side effect, and then dispatch another action.

I know, talk is cheap. Show me the code.

Are you ready to see an example of this beast at work?

https://medium.com/media/bd6d401366599113c5ea68286d8f1be4/href

In a nutshell, we have a function that listens for whenever an action of type IMAGE_FETCH_REQUESTED is dispatched. When it identifies one, itll call the fetchImage function.

Inside the fetchImage function, we simply make a special call to a method on our service object, passing along the userId of the profile image we want to grab. The result gets saved inside our profileImage variable.

Shortly after, we let our store know that we have successfully grabbed an image and would like to pass the image on to be stored. So well just dispatch an action with put with the type of 'IMAGE_FETCH_SUCCEEDED' and pass the image as payload. Our reducer will handle the rest.

But if there is some kind of error, we simply dispatch an action with the type'IMAGE_FETCH_FAIL' and pass the error as payload.

The beauty of it lies in how nicely it reads and sits within a simple try catch block.

Feel free to read more about redux-saga...

17:18

How to create an online poll with ASP.NET Core, Angular 5, and Highcharts "IndyWatch Feed Education"

The Mumbai Indians won the 2017 IPL title. Image source.

In this article, we will create an online polling application using ASP.NET Core, Angular 5, and the Entity Framework Core. Since this is the season of Indian Premiere League cricket in India, we will create an online poll for Who is going to win IPL 2018? The poll results will be displayed as a column chart that is created using Highcharts.

We will use Visual Studio 2017 and SQL Server 2014.

Take a look at the final application.

Prerequisites

  • Install .NET Core 2.0.0 or above SDK from here.
  • SQL Server 2008 or above.

Source code

Before proceeding, I would recommend that you to get the source code from GitHub.

Creating the table

We will store the team data in the IplTeams table. Execute the following commands to create the table.

CREATE TABLE IplTeams   
(
TeamId INTEGER IDENTITY(1,1) PRIMARY KEY,
TeamName VARCHAR(30) NOT NULL,
VoteCount INTEGER NOT NULL
)

Now, we will put in the team names and initialize the vote count to zero. Execute the following insert statements.

INSERT INTO IplTeams VALUES ('Chennai Super Kings',0)  
INSERT INTO IplTeams VALUES ('Delhi Daredevils',0)
INSERT INTO IplTeams VALUES ('Kings XI Punjab',0)
INSERT INTO IplTeams VALUES ('Kolkata Knight Riders',0)
INSERT INTO IplTeams VALUES ('Mumbai Indians',0)
INSERT INTO IplTeams VALUES ('Rajasthan Royals',0)
INSERT INTO IplTeams VALUES ('Royal Challengers Bangalore',0)
INSERT INTO IplTeams VALUES ('Sunrisers Hyderabad',0)

Create the MVC web application

Open Visual Studio and select File >> New >> Project. After selecting the project, a New Project dialog will open. Select .NET Core inside the Visual C# menu from the left panel.

Then, select ASP.NET Core Web Application from the available project types. Put the name of the pr...

13:04

Interview tips that will give you confidence and help you land a dev job "IndyWatch Feed Education"

Landing those first few developer roles in your career can be hard.

How do you convince someone to hire you when you have limited experience? What things are critical to know? What if you get asked a question you dont know the answer to?

Do you really need to know how to write a tag from scratch?

(Spoiler: you dont).

Ive been working as a web developer for about a decade. Ive held various roles in companies of all shapes and sizesfrom global tech companies to small local agencies. Ive been interviewed more times than I can count, and Ive had more rejections than successes. As I have progressed to more senior positions, I increasingly find myself on the other side of the table.

Im going to share some things that I look for when Im interviewing new candidates. Perhaps more importantly, they are things that have helped me feel more confident when Im the one being interviewed.

The technical requirements of any given role will vary, so I wont be giving you any suggestions about addressing those. There are plenty of articles with titles like 10 Things Every Modern Web Developer Must Know. You can use those to guide (or more likely, overwhelm) you.

What I am going to suggest, overall, is that you shouldnt fret about the things you dont know.

1. Be comfortable with your experience and abilities

Talking about your experience is usually the starting point for an interview. Its also usually the first thing on your CV. Showing your experience and how youve applied your skills and abilities is a fundamental part of any interview process.

Its normal to feel the pressure of making a good first impression. As such, it can be tempting to oversell yourself and your abilities, or to exaggerate the importance of a project you have worked on.

But you must rememberyoure not expected to have a wealth of experience or technical ability when starting out. Exaggerating or overselling your experience will create a less than ideal first impression, even if youre otherwise well-suited for the role. This is something that is true at any point in your career, but its an easy trap to fall into when youre starting out.

Its much better to simply be factual about your experience and ability. Talk about the projects youve worked on and your specific role within those projects. Highlight the skills you used and technology youve been exposed to while working on them.

Show, dont tell.

This is a p...

06:14

How to create realistic 3D objects in Figma "IndyWatch Feed Education"

Prior to using Figma, I used Adobe Illustrator for most of my designs (like logos, mockups, illustrations, and so on). But since I joined the Figma gang , Ive dropped illustrator so I can focus on Figma and learn as much as I can about it.

I wanted to discover more tricks with the software, so I could arrive at end-results that arent typical Figma. This stemmed from the fact that the designs I hope to make arent necessarily what the software was developed to do.

Figma is more of a UI/UX design tool than a visual designing or illustrating tool like Adobe Illustrator.

This post is about me exploring Figma beyond UI/UX to uncover new ways of using it and new things I could discover while using it as my complete design tool. In the end, it didnt really matter what type of design I might want to do or venture into.

So, I will take you through the process of how I came up with the above image.

Step 1: Create a similar box

The first thing I created was a box that looks similar to the brown one in the picture above. This was created with the use of shapes (rectangles only). I know some people are fans of the pen tool. But in the above example, the pen tool doesnt afford us the flexibility to create shadows, add gradients, or do any sort of object manipulation to individual shapes or parts of the box.

step one 

In the above illustration, I used the edit object tool to resize and manipulate the rectangles to make a rhombus-like shape. The next thing I did was recreate the same rectangles and turn them backwards to make up the third and fourth sides of the box.

edit object tool

Step 2: adding shading

I added color to differentiate each side of the box, and also to give an idea of how the shadows, contrast, and gradient fill would be applied. This laid a foundation so that the sides of the box could be worked on independently. I also created the box lid pieces.

creating covers

Step 3: making it more realistic

I added a gradient fill to the visible box lids (f1 & f2) to make it look much more realistic and flat. Notice the way the gradient is layered on f2? I did the same for f1, and then adjusted the degree of the gradient fill to match the direction of light on the box.

...

03:27

How to set up continuous integration and deployment for your React app "IndyWatch Feed Education"

Setting up a React development environment can be confusing and daunting to newcomers. You might have heard developers talking about how different packages like babel, Webpack and so on, are needed as well (but this is debatable).

With React getting more popular, there are a few boilerplate projects that aim to help developers create a suitable React development environment. create-react-app is one of the most popular starter templates.

It aims to allow developers to create a react app with zero build configuration.

Developers no longer have to worry about how webpack should be setup, what should be configured with babel to use es6, or which linter and test package to use. Everything will just work out of the box. Yes, it is so easy!

For developers who need to manage the underlying configuration, it has a npm run eject that allows them to mess with the configuration and do what they couldnt do previously. The only thing to note is that once eject is run, it cannot be reversed.

Development Stack for React

I wrote the following guide to help developers build a Continuous Integration and Continuous Deployment stack for their React app. We will be using CircleCI, CodeClimate, and Heroku. If you do not have an account at any of the services above, head over to sign uptheyre FREE!

At the end, we will have a React app in a Github Repo that will automatically deploy any changes on master branch to Heroku after all tests pass. Here is a sample of the deployed React website.

Lets Start!

The first step is to follow the create-react-app guide to create a new React app. Do this:

$ npm install -g create-react-app
$ create-react-app my-react-app
$ cd my-react-app/
$ npm start

Then the browser should automatically open a page at http://localhost:3000/. If you see a Welcome to React page running, everything is good.

CircleCI Setup...

02:28

Web Servers Explained by Running a Microbrewery "IndyWatch Feed Education"

If you can understand the different inputs and outputs of a microbrewery, then you can understand how a web server works.

When you are just getting started with web development, you might wonder, How exactly do all these new concepts connect to each other when someone types https://mysite.com into their browser?

Sure, you might know the difference between front-end and back-end, but that only gives you a high-level view.

To help, I wanted to create a full guide that explains the connection between the client-side (the browser) and the server-side (multiple servers).

For example, do you know the difference between a server and a database?

Heres the deal: the client-server model operates kind of like a microbrewery. And if you can understand the different parts of a microbrewery, then you can understand the basics of web servers.

The Client-Server model

In this microbrewery, your goal is to sell a high volume of beer to bars, liquor stores and supermarkets. You have a variety of customers that will make large orders every week or every month.

This means that customers will call your sales team or send an email every so often with a request. On the internet, this is known as a client. A client does not share any of its computing power with the other members of the network that it is requesting. It just asks for a certain piece of content or functionality.

On the other side of the equation, your brewery operations team exists so that it can brew beer that will meet the demands of the customers. In this situation, they are the server. That means that they await requests from clients, and use their computing power to share the appropriate resources based on the request.

A common example of a client is a web browser like Chrome. Servers are located in remote location, and are managed by companies like Amazon (Amazon Web Services).

You might think this is one-dimensional, like yeah, these are the basics of any buying process! But as you will see in a moment, it can get a little more complicated as more parties enter the picture.

Request-Response model

As you can see, each side has different rol...

01:35

Free Tutorial Mega-List: How to Build Your Own Cryptocurrency, Operating System, Programming "IndyWatch Feed Education"

Free Tutorial Mega-List: How to Build Your Own Cryptocurrency, Operating System, Programming Language, and More

I recently stumbled upon a new GitHub repository that had a long list of tutorials about how to build many technologies. The list includes tutorials on how to Build your own Blockchain / Cryptocurrency, Web Server, Template Engine, and many more.

I stumbled upon this repository while browsing through the most popular GitHub repositories in a new Chrome tab using GitHunt. It is a really long list, and may overwhelm you a bit, but this repository is worth checking out. You can always watch it and come back to it. Maybe you need to learn something better by building it, or perhaps youll find some tutorial you need.

Here is the complete list that has been added to GitHub and made public by the author Daniel Stefanovic at the time of this writing.

Here, Ill list/link to some of the articles from each category to give you an idea of whats on offer:

Build your own 3D Renderer

Build your own Blockchain / Cryptocurrency

Go Back:30 Days | 7 Days | 2 Days | 1 Day

IndyWatch Education Feed Today.

Go Forward:1 Day | 2 Days | 7 Days | 30 Days

Tuesday, 15 May

19:41

How I used algorithms to solve the knapsack problem for my real-life carry-on knapsack "IndyWatch Feed Education"

Im a nomad and live out of one carry-on bag. This means that the total weight of all my worldly possessions must fall under airline cabin baggage weight limitsusually 10kg. On some smaller airlines, however, this weight limit drops to 7kg. Occasionally, I have to decide not to bring something with me to adjust to the smaller weight limit.

As a practical exercise, deciding what to leave behind (or get rid of altogether) entails laying out all my things and choosing which ones to keep. That decision is based on the items usefulness to me (its worth) and its weight.

This is all my stuff, and my Minaal Carry-on bag.

Being a programmer, Im aware that decisions like this could be made more efficiently by a computer. Its done so frequently and so ubiquitously, in fact, that many will recognize this scenario as the classic packing problem or knapsack problem. How do I go about telling a computer to put as many important items in my bag as possible while coming in at or under a weight limit of 7kg? With algorithms! Yay!

Ill discuss two common approaches to solving the knapsack problem: one called a greedy algorithm, and another called dynamic programming (a little harder, but better, faster, stronger).

Lets get to it.

The set up

I prepared my data in the form of a CSV file with three columns: the items name (a string), a representation of its worth (an integer), and its weight in grams (an integer). There are 40 items in total. I represented worth by ranking each item from 40 to 1, with 40 being the most important and 1 equating with something like why do I even have this again? (If youve never listed out all your possessions and ranked them by order of how useful they are to you, I highly recommend you try it. It can be a very revealing exercise.)

Total weight of all items and bag: 9003g

Bag weight: 1415g

Airline limit: 7000g

Maximum weight of items I can pack: 5585g

Total possible worth of items: 820

The challenge: Pack as many items as the limit allows while maximizing the total worth.

Data structures

Reading in a file

Before we can begin thinking about how to solve the knapsack problem, we have to solve the problem of reading in and storing our data. Thankfully, the Go standard librarys io/ioutil package makes the first part...

18:45

How to think reactively and animate moving objects using RxJs "IndyWatch Feed Education"

These days, many software systems have to deal with asynchronous behaviors and time-related issues.

Continuous connectivity, distributed systems, microservices-based architectures, the cloud, non blocking platformsthe consequence of all these things is that we somehow have to deal with asynchronicity and time. Our software systems have to learn how to deal with streams of events, which are, by their nature, asynchronous.

Reactive programming provides powerful tools, based on a functional programming style, that help us model systems that work in such a world. But these systems require us to think reactively when we design our solutions.

Thinking reactively often represents a challenge, as does any change of perspective. At the same time, it may be easier than you expect. Just look at what happens in the real world and try to map it in a straightforward way.

In this article, I aim to show you how to apply reactive and functional thinking to solve a very well-known problem in a natural way: how to animate an object with controlled motion. The metaphor Ill use is that of a vehicle which can accelerate and brake, following the commands issued by a remote controller.

A quick recap of the simple basics of dynamics

If you want to change the velocity of an object, you need to apply a force to it which in turn impresses an acceleration to the same object. If you know the value of acceleration A of the object, you can calculate the variation of its velocity dV in a certain time interval dT with the formula

dV = A * dT

Similarly, if you know the velocity V, then you can calculate the variation in space dS in a time interval dT with the formula

dS = V * dT

Conclusion: if you have an acceleration A impressed to an object whose initial velocity is V0, you can approximate the velocity of the object in the time interval dT with its average, like this:

averageVel = (V0 + V1) / 2 = (V0 + V0 + dV) / 2 = V0 + A/2 * dT

and then calculate the approximate variation of space dS in the same interval dT with the formula

dS = averageVel * dT = V0 * dT + A/2 * dT

The shorter the time interval dT, the better the a...

17:03

How you can access your dark data with Amazon Redshift Spectrum "IndyWatch Feed Education"

Amazons Simple Storage Service (S3) has been around since 2006. Enterprises have been pumping their data into this data lake at a furious rate. Within 10 years of its birth, S3 stored over 2 trillion objects, each up to 5 terabytes in size. These companies know their data is valuable and worth preserving. But much of this data lies inert, in cold data lakes, unavailable for analysis, as so-called dark data.

The Dark Data Problem. Source: Amazon AWS.

Analyzing Dark Data

So what lies below the surface of data lakes? The first thing for organizations to do is to find out what dark data they have accumulated. Then then need to analyze it in search of valuable insights. That means analysts need solutions that allow them to access petabytes of dark data.

With Amazon Redshift Spectrum, you can query data in Amazon S3 without first loading it into Amazon Redshift. For nomenclature purposes, Ill use Redshift for Amazon Redshift, and Spectrum for Amazon Redshift Spectrum.

There are three major existing ways to access and analyze data in S3.

  • Amazon Elastic MapReduce (EMR). EMR uses Hadoop-style queries to access and process large data sets in S3.
  • Amazon Athena. Athena offers a console to query S3 data with standard SQL and no infrastructure to manage. Athena also has an API.
  • Amazon Redshift. You can load data from S3 into an Amazon Redshift cluster for analysis.

So why not use these existing options? For example, companies already use Amazon Redshift to analyze their hot data. So why not load that cold data from S3 into Redshift and call it a day?

There are two main reasons:

  • Effort. Loading data into Amazon Redshift involves extract, transform, and load (ETL) steps. Those steps are necessary to convert and structure data for analysis. Amazon estimates that figuring out the right ETL consumes 70% of an analytics project.
  • Cost. You may not even know what data to extract until you have analyzed it a bit. Uploading lots of cold S3 data for analysis requires growing your clusters. That translates to paying more, as Redshift pricing is based on the size of your cl...

13:24

Arguing and organising for a Statutory Youth Service continued "IndyWatch Feed Education"

Article: Winning a Statutory Youth Service

Doug-Nicholls

Doug Nicholls reflects on the momentous Roundtable event which took place at the Palace of Westminster on 23rd April 2018. He posits that there are shifts towards a new Youth Service with support from key politicians, youth organisations and young people. Setting the political and economic context, Nicholls suggests how a new youth service if both needed and affordable.

CHOOSEYOUTH EVENT:

CREATING A STATUTORY YOUTH SERVICE TEN MINUTE BILL

6 June at 10:0014:00 at Portcullis House (The MacMillan Room), SW1A 2JR London

...

10:18

How to streamline your React.js development process using Webpack 4 "IndyWatch Feed Education"

Original photo at: https://www.instagram.com/p/BiaH379hrAp/?taken-by=riittagirl

In the real world of development, we have to add new features very quickly. In this tutorial, I will show you everything you can do to streamline this process and reach 120% of your dev speed.

Why, you might ask?

Because doing manual work is extremely counter-productive when it comes to programming. We want to automate as much as possible. So I will show you what parts of the development process with React we can adjust using Webpack v4.6.0.

I will not cover the first steps of setting up the webpack configuration, since I have already done it in my previous post. There, I described how to configure Webpack in greater detail. I will assume you are already familiar with the Webpack configuration basics, so we can start with a ready setup.

Setting up Webpack

In your webpack.config.js, enter the following code:

// webpack v4
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const WebpackMd5Hash = require('webpack-md5-hash');
const CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
entry: { main: './src/index.js' },
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].[chunkhash].js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
}
]
},
plugins: [
new CleanWebpackPlugin('dist', {} ),
new HtmlWebpackPlugin({
inject: false,
hash: true,
template: './src/index.html',
filename: 'index.html'
}),
new WebpackMd5Hash()
]
};

and in your package.json:

{
"name": "post",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack --mode production",
"dev": "webpack --mode development"

},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-loader": "^7...

03:45

A quick guide to test-driven development in React "IndyWatch Feed Education"

Random picture by Deanna Ritchie on Unsplash

Following the principles of Test-Driven Development (TDD) when writing a front-end React app might seem more difficult than doing the same on the back-end.

First, we need to somehow render our component. Then we need to simulate user interaction with a browser. Next we respond to changes in props and state, and finally come up with a way to test asynchronous methods triggered by the click of a button.

Trying to cover all these cases in our tests often results in tests that are difficult to read. They also often depend on one another. We mock a lot, and in return we have tests full of anti-patterns.

Dont waste your time

From what Ive seen, many programmers create working React components first.Then they try to cover them with tests, just to realize that the components cannot be tested in their current implementation. Then they need to refactor. Because of that they lose patience, time, and their employers money.

Available solutions

Fortunately for us, there are many testing libraries that can help us address these problems. We can try rendering React components with Enzyme and mock API responses using MockAxios. However, these libraries usually have so many methods and options that it might get confusing, especially for people who have just started writing tests.

Lets take Enzyme for examplewhats the difference between the Shallow, Mount and Render methods? And which should you use? This is not what you should be worried about when you write your tests, in my opinion. It should be as straight forward as possible.

Our project

For our Quick Guide purposes, were going to create a small React app. After clicking on a button, a random joke about Chuck Norris will be fetched and displayed.

No one has ever pair-programmed with Chuck Norris and lived to tell about it.

So lets begin.

Kick-off by creating a React project in CodeSandbox, and then install the following dependencies (Jest i...

00:32

How point-free composition will make you a better functional programmer "IndyWatch Feed Education"

Photo by Hans-Peter Gauster on Unsplash

Point-free styleaims to reduce some of the visual clutter by removing unnecessary parameter-argument mapping.
Kyle Simpson in Functional-Light JavaScript

Consider the flowing code:

let newBooks = books.filter(point => isTechnology(point))

Now look at the same code after eliminating points (parameters/arguments):

let newBooks = books.filter(isTechnology)

Point-free in List Operations

Lets do list operations in a point-free style.

Say we need to find the technology titles in a list of books, prepare the book object with all information for the view, and sort the books by the authors name.

Here is how the code would look:

function getBooks(){
return books.filter(isTechnology)
.map(toBookView)
.sort(ascByAuthor);

}
//Pure functions with points
function isTechnology(book){
return book.type === "T";
}
function toBookView(book){
return Object.freeze({
title : book.title,
author : authors[book.authorID].name
});
}

function ascByAuthor(book1, book2){
if(book1.author < book2.author) return -1;
if(book1.author > book2.author) return 1;
return 0;
}

The callbacks isTechnology(), toBookView(), ascByAuthor() are small, pure functions with intention-revealing names. They are not built in a point-free style.

The code assembling all these functions in getBooks() is point-free.

Decomposition and composition

Our natural way of dealing with a problem is to break it into smaller pieces and then put everything back together.

We break the bigger task up into several functions doing smaller tasks. Then we re-combine these smaller functions to solve the initial problem.

Lets read the requirements again:

We need to find the technology titles in a list of books, prepare the book object with all info...

Monday, 14 May

23:50

How to get your GraphQL Java server up and running in no time "IndyWatch Feed Education"

GraphQL is a query language for fetching data over the internet. Since its public announcement by Facebook in 2015, it has sparked interest in many minds. GraphQL has primarily been used in JavaScript. In fact, Facebook released the reference implementation for it in JavaScript (graphql-js).

GraphQL Java

How to build a GraphQL Java Server in springboot

Lets take the example of a magic school from the Harry Potter Universe. The magic schools data is as follows:

Here the DataStores can be backend servers, or even Databases. A RESTful fetching will look like below.

GET: /student?{parameters}
GET: /House?{parameters}

Basically expose an interface for a service. Thus if Professors are added in the above model, then a new endpoint has to be opened and the client has to take multiple round trips. Also if the client wants nested data like Harrys wand origin or Rons house color, then the API server has to call the backend twice. It will also result in some unwanted House and wand information.

https://medium.com/media/8a4114958934b8693a64900379701811/href

Enter GraphQL: GraphQL is a schema-driven approach to fetching data. It models the data as graphs, and you have to issue a query to fetch the data. It works like SQL, but for web objects. So, a graphQL query for Harry looks like:

query{
Magic School{
Student{
name
wand{
origin
}}}}

Before going into GraphQL, we need to setup a spring MVC. The easiest way to do this is...

IndyWatch Education Feed Archiver

Go Back:30 Days | 7 Days | 2 Days | 1 Day

IndyWatch Education Feed Today.

Go Forward:1 Day | 2 Days | 7 Days | 30 Days

IndyWatch Education Feed was generated at Community Resources IndyWatch.

Resource generated at IndyWatch using aliasfeed and rawdog