<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ed Halliwell on Medium]]></title>
        <description><![CDATA[Stories by Ed Halliwell on Medium]]></description>
        <link>https://medium.com/@edhalliwell?source=rss-2f3b1a8aa5f9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*8SvJDuIkmivzumoC.</url>
            <title>Stories by Ed Halliwell on Medium</title>
            <link>https://medium.com/@edhalliwell?source=rss-2f3b1a8aa5f9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 20:41:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@edhalliwell/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Chat App driven by WebSockets using Socket.IO and TypeScript]]></title>
            <link>https://medium.com/@edhalliwell/chat-app-driven-by-websockets-using-socket-io-and-typescript-ed49611d6077?source=rss-2f3b1a8aa5f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed49611d6077</guid>
            <category><![CDATA[websocket-api]]></category>
            <category><![CDATA[socket-io-client]]></category>
            <category><![CDATA[socketio]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[websocket]]></category>
            <dc:creator><![CDATA[Ed Halliwell]]></dc:creator>
            <pubDate>Thu, 18 Jul 2024 09:02:22 GMT</pubDate>
            <atom:updated>2024-07-18T09:02:22.008Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How to use WebSockets and Socket.IO to build a chat application in Typescript and React</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wkfNYZDD0cJIONT0" /><figcaption>Photo by <a href="https://unsplash.com/@federize?utm_source=medium&amp;utm_medium=referral">Federico Beccari</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>In <a href="https://medium.com/stackademic/getting-started-with-websockets-in-typescript-c48c5519f7d4">my last article</a>, I got some experience with WebSockets, building a simple chat app using the ws library. This time I wanted to go deeper and spend a bit more time expanding my knowledge and practical experience with WebSockets.</p><p>At the end of that project, I identified a few areas that I wanted to cover next time, so my goals this time were to:</p><ul><li>Build a more complex chat app with users and rooms</li><li>Use socket.io instead of ws</li><li>Confirm message delivery with acknowledgments</li><li>Improve reliability and prevent (or mitigate) disconnecting WebSockets</li></ul><p>All the code can be found on <a href="https://github.com/ed-halliwell/ws-chat">GitHub</a> so let’s dive in.</p><h3>The CRUD bit</h3><p>Before I could get going with Socket.IO and implementing WebSockets, I needed to build out a much more extensive CRUD application. As in the previous project, I used the pg library for my PostgreSQL database and express to create my API.</p><p>I made 4 tables — users, rooms, messages and room_members. A user can create (own) multiple rooms, and can join multiple rooms (that they don’t necessarily own). A room can have many messages, and each message is created by a user. Joining a room will insert a row in the room_members table and leaving that room will remove the row.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KagaD9OoMPFM9R9kpOhp1w.png" /></figure><p>I made routes for users to create themselves (register) and login. The passwords are encrypted using bcrypt and stored as hashed values. I manage the user tokens using jsonwebtoken - signing the tokens on login and verifying them where necessary. It’s probably not the most secure but it’s sufficient for the project - I may look at security and password management in a future project 🤔.</p><p>The routes for creating rooms and messages and joining or leaving rooms are all protected by auth middleware in express. The auth middleware grabs the token from the headers and checks that it is valid — if not, it’ll bounce the user out to the login page.</p><p>The front end uses React and some custom styled components — in retrospect, it may have been easier to use a design library like chakra, radix or tailwind.</p><p>It’s all in a monorepo using yarn workspaces — I started using this pattern with my last WebSockets project and I love it. For a small, full stack app like this, it is great to be able to run both the server and client at the same time with one command and move between the package folders without having to change windows.</p><p>This time, I found that I had types that I wanted to use in both the front and back end — like Messages and Rooms. Instead of duplicating them in the client and server, I pulled them into a common package so that they could be accessed from both and so I only had to maintain one set of types.</p><p>The trickiest part in the front end was getting the authenticated context right. I haven’t built this from scratch in a while and it took longer than it should have to get this working properly 😫</p><h3>Getting started with Socket.IO</h3><p>I started (as ever) with the <a href="https://socket.io/docs/v4/">documentation</a> which has a very handy <a href="https://socket.io/docs/v4/tutorial/introduction">tutorial</a> for beginners and getting set up was pretty straight forward. Similar to the previous project with ws, the server will broadcast a new chat message to all connected clients.</p><p>What is different, or more complicated, this time is that there is a separate socket ‘channel’ for each chat room. Without this filtering, the broadcasted message will go to every client whichever room they are in — a big problem for a chat app!</p><p>Last time, I had the client send each message to the server over the WebSocket. Then the server would store the message and then broadcast out to the connected clients.</p><p>I learned afterwards that this was a slightly strange approach and a more conventional one would be to have the client send a message via a simple POST call and then have the server save the message and distribute it to connected clients via WebSockets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d8agZTIDtOa62bSHy9SGbQ.png" /></figure><h3>Socket.IO on the server side</h3><p>The server uses the socket.io package which is imported into my index.ts file in the server package.</p><p>The express app is passed into a createServer method imported from the http package, and then that server is passed into the new Server()call imported from the socket.io package:</p><pre>import express, { Request, Response } from &#39;express&#39;;<br>import { Client } from &#39;pg&#39;;<br>import { createServer } from &#39;http&#39;;<br>import { Server } from &#39;socket.io&#39;;<br>import cors from &#39;cors&#39;;<br><br>const app = express();<br>const db = new Client(); // pg<br>const server = createServer(app); // http<br>const io = new Server(server, {<br>  cors: { origin: &#39;*&#39;, methods: [&#39;GET&#39;, &#39;POST&#39;] },<br>});<br><br>async function clientConnect() {<br>  await db.connect();<br>  console.log(&#39;Postgres database connected&#39;);<br>}<br><br>app.use(express.json());<br>app.use(cors());<br><br>// routes...<br><br>void clientConnect();<br>server.listen(4000, () =&gt; console.log(&#39;Server started on port 4000&#39;));</pre><p>I’ll build up the the WebSocket functionality as we go through the article. Initially, we just listen for the default connection and disconnect events:</p><pre>io.on(&#39;connection&#39;, (socket) =&gt; {<br>  console.log(&#39;a user connected&#39;);<br>  <br>  socket.on(&#39;disconnect&#39;, () =&gt; console.log(&#39;user disconnected&#39;));<br>});</pre><p>The server makes a chat message event on creation of each message. This is done from inside the create message handler, just after the message is successfully added to the database.</p><pre>// create message handler<br>app.post(&#39;/messages&#39;, auth, async (req: Request, res: Response) =&gt; {<br>  try {<br>    const message = await addMessage({ db }, req.body as MessageInput);<br>    if (!message) throw new Error(&#39;Message creation failed&#39;);<br><br>    // emit event to send message data to connected clients<br>    io.to(message.roomId).emit(&#39;chat message&#39;, message); <br><br>    res.status(201).send(message);<br>  } catch (err) {<br>    console.error(err)<br>    res.status(500).send();<br>  }<br>});</pre><p>The emit event uses the to method to scope the broadcast to only clients connected to the correct room ID. Then, the emit method sends the event name chat message and the message object. Note that there’s no need to JSON.stringify() the message (and then parse it on the client) as Socket.IO is able to handle sending the full object.</p><p>We’ll listen for the event called chat message on the front end so we can capture messages sent via the WebSocket and display them to the user.</p><h3>Adding socket.io-client to the front end</h3><p>Firstly, it’s a case of adding this code to my index.tsx file:</p><pre>import { io } from &#39;socket.io-client&#39;;<br><br>export const socket = io(&#39;ws://localhost:4000&#39;);<br><br>socket.on(&#39;connect&#39;, () =&gt; {<br>  console.log(&#39;WebSocket connected&#39;);<br>});</pre><p>Next, in the Room component, we can setup the listener for the chat message events coming from the server:</p><pre>export const Room = () =&gt; {<br>    const [messages, setMessages] = useState&lt;Message[]&gt;([]);<br>    // etc<br>	<br>    socket.on(&#39;chat message&#39;, (msg: Message) =&gt; {<br>      setMessages([...messages, msg]);<br>    });<br>  <br>  return (<br>    // components<br>  )<br>}</pre><p>The socket is imported from the index.tsx file then, on an event with the name chat message, the new message is spread into the messages state (which is shown in a list to the user).</p><h3>Joining and leaving rooms</h3><p>One of the key things to get right with this project was separating the messages by room so that users receive the correct messages via the WebSocket for the room they are in.</p><p>To achieve this, it was necessary to have a user ‘join’ and ‘leave’ a room and thus subscribe / unsubscribe to a particular ‘room’ (Socket.IO also call them ‘rooms’).</p><p>In the client, we fire a join room event from the ‘create’ and ‘join’ handler functions and a leave room event from the ‘leave’ room handler function.</p><pre>// from the create and join room handlers <br>socket.emit(&#39;join room&#39;, roomId);<br><br>// from the leave room handler<br>socket.emit(&#39;leave room&#39;, roomId);</pre><p>Then on the server side, I added event listeners for those join and leave events and call the join and leave methods on the socket, passing in the room ID (which we used in the to method on broadcasting the chat messages above):</p><pre>io.on(&#39;connection&#39;, (socket) =&gt; {<br>  console.log(&#39;a user connected&#39;);<br><br>  socket.on(&#39;join room&#39;, async (roomId: string) =&gt; {<br>    await socket.join(roomId);<br>  });<br>  socket.on(&#39;join room&#39;, async (roomId: string) =&gt; {<br>    await socket.leave(roomId);<br>  });<br><br>  socket.on(&#39;disconnect&#39;, () =&gt; console.log(&#39;user disconnected&#39;));<br>});</pre><h3>Ensuring message delivery</h3><p>One of the things I wanted to add to this project compared to the previous ws one was some kind of message confirmation - as well as retry logic when message sending fails. This functionality needed to be built out manually in ws but Socket.IO has some of this functionality built in.</p><blockquote><a href="https://socket.io/docs/v4/delivery-guarantees">Documentation: Delivery Guarantees</a><br>Socket.IO does guarantee message ordering, no matter which low-level transport is used. By default, Socket.IO provides an <strong>at most once</strong> guarantee of delivery.</blockquote><p>We can also implement retries for the messages that are sent — both from server to client and from client to server.</p><p>Socket.IO events can have an optional callback added that will fire when the message is received on the other side. The below diagram shows that for events sent from the client (like joining or leaving a room), we can get a confirmation from the server. And for events sent from the server (like chat messages), we can get a confirmation from the client on receipt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DqmZhXOmDOXejPqaC13iyg.png" /></figure><h4><strong>Client to server events</strong></h4><p>For the join and leave room events, we can make a couple of changes to add in the logic. On the client side in index.tsx , we can add ackTimeout (the time between retries) and the number of retries to the io config on instantiation.</p><pre>export const socket = io(&#39;ws://localhost:4000&#39;, {<br>  ackTimeout: 10000, // in ms<br>  retries: 3,<br>});</pre><p>You don’t have to use the built in retries, and it’s possible to build out your own logic as shown in the <a href="https://socket.io/docs/v4/tutorial/step-8">tutorial documentation</a>.</p><p>On the server side in index.ts , we need to add in callback functions and return something to the front end - I’ve chosen to send status message here but it could be anything.</p><pre>io.on(&#39;connection&#39;, (socket) =&gt; {<br>  console.log(&#39;a user connected&#39;);<br>  <br>  socket.on(&#39;join room&#39;, async (roomId: string, callback: ({ status }: EventResponse) =&gt; void) =&gt; {<br>    await socket.join(roomId);<br>    callback({ status: &#39;room join acknowledged&#39; });<br>  });<br>  socket.on(&#39;leave room&#39;, async (roomId: string, callback: ({ status }: EventResponse) =&gt; void) =&gt; {<br>    await socket.leave(roomId);<br>    callback({ status: &#39;room leave acknowledged&#39; });<br>  });<br><br>  socket.on(&#39;disconnect&#39;, () =&gt; console.log(&#39;user disconnected&#39;));<br>});</pre><h4>Server to client events</h4><p>For sending events from the server, it was necessary to create the retry logically manually with this function:</p><pre>import { Message } from &#39;@ws-chat/common/src&#39;;<br>import { Server } from &#39;socket.io&#39;;<br><br>const RETRY_INTERVAL = 5000;<br>const MAX_RETRIES = 3;<br><br>export const emitWithRetry = async (<br>  io: Server,<br>  roomId: string,<br>  event: string,<br>  data: Message,<br>  retries = MAX_RETRIES,<br>) =&gt; {<br>  return new Promise&lt;void&gt;((resolve, reject) =&gt; {<br>    let attempts = 0;<br>    const sendEvent = () =&gt; {<br>      attempts++;<br>      io.to(roomId).emit(event, data, (ack: boolean) =&gt; {<br>        if (ack) {<br>          console.log(`Acknowledgment received for event: ${event}`);<br>          resolve();<br>        } else if (attempts &lt; retries) {<br>          console.log(`No acknowledgment received for event: ${event}, retrying... (${attempts})`);<br>          setTimeout(sendEvent, RETRY_INTERVAL);<br>        } else {<br>          console.log(`Failed to deliver event: ${event} after ${retries} attempts`);<br>          reject(new Error(`Failed to deliver event: ${event} after ${retries} attempts`));<br>        }<br>      });<br>    };<br>    sendEvent();<br>  });<br>};</pre><p>Then I replaced the old emit event with a call to the new function:</p><pre>// create message handler<br>app.post(&#39;/messages&#39;, auth, async (req: Request, res: Response) =&gt; {<br>  try {<br>    const message = await addMessage({ db }, req.body as MessageInput);<br>    if (!message) throw new Error(&#39;Message creation failed&#39;);<br><br>    // emit event to send message data to connected clients<br>    // io.to(message.roomId).emit(&#39;chat message&#39;, message); old<br>    await emitWithRetry(io, message.roomId, &#39;chat message&#39;, message);<br><br>    res.status(201).send(message);<br>  } catch (err) {<br>    console.error(err)<br>    res.status(500).send();<br>  }<br>});</pre><p>Finally, we need to look for that acknowledgement function on the front end and send back a response after we’ve received the message:</p><pre>export const Room = () =&gt; {<br>    const [messages, setMessages] = useState&lt;Message[]&gt;([]);<br>    // etc<br>	<br>    socket.on(&#39;chat message&#39;, (msg: Message, ack: (response: boolean) =&gt; void) =&gt; {<br>      setMessages([...messages, msg]);<br>      if (ack) ack(true);<br>    });<br><br>  return (<br>      // components<br>    )<br>}</pre><h3>Handling disconnections</h3><p>Socket.IO has useful built-in state recovery tooling which <strong>temporarily</strong> stores all the events that are sent by the server and will try to restore the state of a client when it reconnects — restoring its rooms and sending any missed events. It’s enabled on the server side in the config:</p><pre>const io = new Server(server, {<br>  connectionStateRecovery: {}, // add this!<br>  cors: { origin: &#39;*&#39;, methods: [&#39;GET&#39;, &#39;POST&#39;] },<br>});</pre><p>It’s not enabled by default as it doesn’t always work (e.g. the client state might not be saved in the case of an abrupt crash or restart) and it does not scale well.</p><p><a href="https://socket.io/docs/v4/tutorial/step-7">Socket.IO’s tutorial</a> goes through the steps to synchronise the state of the client upon reconnection by having the client keep track of the last event it has processed and the server sends the missing pieces (another option is for the server to send the whole state).</p><p>However, in my project, the room component will fetch all the messages when the page is loaded, so there was no need to send through all the messages via the WebSocket.</p><h3>Wrapping up</h3><p>This project took much longer than the previous ws one but I found working with Socket.IO much easier. Their library is much more extensive and the documentation is pretty easy to follow, with a few more handy built in capabilities.</p><p>As always, there is always more that could have done… Socket.IO’s tutorial has documentation on <a href="https://socket.io/docs/v4/tutorial/step-9">horizontal scaling</a> to handle sending messages to clients connected across multiple servers. Also, it’s all hard coded to localhost at the moment and will only work locally, so I’d love to look into deploying the code too.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed49611d6077" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with WebSockets in TypeScript]]></title>
            <link>https://blog.stackademic.com/getting-started-with-websockets-in-typescript-c48c5519f7d4?source=rss-2f3b1a8aa5f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c48c5519f7d4</guid>
            <category><![CDATA[event-driven-programming]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[socketio]]></category>
            <category><![CDATA[websocket-api]]></category>
            <category><![CDATA[websocket]]></category>
            <dc:creator><![CDATA[Ed Halliwell]]></dc:creator>
            <pubDate>Wed, 27 Mar 2024 11:32:23 GMT</pubDate>
            <atom:updated>2024-03-29T00:42:23.407Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How to get started using WebSockets in Typescript and React to create a simple chat application</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zZmAuTTdf-RTBM3jOvQh5A.jpeg" /><figcaption>Image credit: <a href="https://unsplash.com/photos/assorted-electric-cables-l090uFWoPaI">John Barkiple via Unsplash</a></figcaption></figure><h4>Introduction</h4><p>WebSockets are a technology that I haven’t yet had any cause to use at work but I know are a handy tool to know about. My goal with this article was to get some experience implementing WebSockets in a simple chat application so that I can use them in more complex products in future.</p><h4>What are WebSockets?</h4><p>WebSockets are an industry standard way to allow clients and servers to exchange messages in real-time without having to refresh the page or poll for changes.</p><p>They are commonly used to facilitate the broadcasting the same data (a message) to a large number of recipients simultaneously, supporting use cases like streaming live score updates, sending traffic updates, distributing notifications or news alert and transmitting live financial information, such as stock quotes and market updates.</p><p>In December 2011, the Internet Engineering Task Force standardised the WebSocket protocol and it’s now supported by all modern browsers. <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API">MDN</a> describes them like this:</p><blockquote>The <strong>WebSocket API</strong> is an advanced technology that makes it possible to open a two-way interactive communication session between the user’s browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply.</blockquote><h4>Project plan</h4><p>My plan was to make a simple chat app using a WebSocket server that would accept connections from multiple clients. It would receive new messages from the clients and then broadcast those messages to all the clients currently connected to it.</p><p>I also wanted to save the messages to a database so that users could see historic messages when they loaded the page, as well as newly added messages as they arrive from the WebSocket. To achieve this, my server app would have two functions:</p><ol><li>A WebSocket server to accept new messages and broadcast them to connected clients</li><li>An HTTP server to allow clients to fetch existing messages</li></ol><p>When a new message arrives on the server, I planned to save the message to the database before broadcasting out to connected clients via the WebSocket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cMn0YdWPR8A5LApYgvxqZA.png" /></figure><h4>Project setup</h4><p>I use projects with yarn workspaces all the time in my professional work but I’ve never created one from scratch for a personal project. I wanted to use this opportunity to try it out and have two packages in one ‘monorepo’: one for the client, and another for the server.</p><p>On the backend, I decided to use the package ws. I am aware that I could have used <a href="http://socket.io/">Socket.io</a> to achieve the same thing but, from what I had read, ws is more lightweight and thus less complex so would be a good fit for my simple project. There’s plenty written on the pros and cons of tooling for WebSockets and I found this <a href="https://ably.com/topic/socketio-vs-websocket"><strong>ably</strong> article</a> helpful.</p><p>If I was implementing something more complex, I think I’d spend the time with <a href="http://socket.io/">Socket.io</a> but, for this project, my goal was to understand the basics of WebSockets. To that end, I wanted a package that wouldn’t be too abstract or complex as I felt this would mean I’d be learning the framework more than the underlying technology.</p><p><a href="http://socket.io/">Socket.io</a> has a client version but it seemed that using isomorphic-ws would be the best choice when using ws in the backend.</p><p>A NoSQL database may have been a better choice for messaging app but, as I’m familiar with it, and given the low degree of complexity, I decided to use use Postgres with a simple messages table for storage.</p><p>The project (GitHub: <a href="https://github.com/ed-halliwell/ws">ws</a>) is written in typescript and uses prettier, eslint and nodemon for development ease.</p><h4>Setting up the WebSocket server</h4><p>First I needed to create my simple HTTP server to allow users to fetch historic messages, and also define methods for fetching and inserting new messages into the database.</p><p>I used express and made one endpoint to fetch all existing messages. Then, in my messages repository file, I created two methods - one to getMessages and the other to insertMessage. This server then listens on port 4000.</p><pre>import express, { Request, Response } from &#39;express&#39;;<br>import { getAllMessages } from &#39;./messages/messages.controller&#39;;<br>import { Pool } from &#39;pg&#39;;<br>import cors from &#39;cors&#39;;<br>import { Message, insertMessage } from &#39;./messages/messages.repository&#39;;<br><br>const app = express();<br>const db = new Pool();<br><br>app.use(express.json());<br>app.use(cors());<br><br>app.get(&#39;/messages&#39;, async (_: Request, res: Response) =&gt; {<br>  const messages = await getAllMessages({ db });<br>  res.send(messages);<br>});<br><br>const start = (): void =&gt; {<br>  try {<br>    app.listen(4000, () =&gt; console.log(&#39;Server started on port 4000&#39;));<br>  } catch (error) {<br>    console.error(error);<br>    process.exit(1);<br>  }<br>};<br><br>void start();</pre><p>Next, I added the WebSocket server to my index.ts file, using the ws <a href="https://github.com/websockets/ws">documentation</a> as a guide.</p><pre>import { WebSocketServer, WebSocket } from &#39;ws&#39;;<br><br>const wss = new WebSocketServer({ port: 8080 });<br>// HTTP server setup goes here<br><br>const start = (): void =&gt; {<br>  try {<br>    app.listen(4000, () =&gt; console.log(&#39;Server started on port 4000&#39;));<br><br>    wss.on(&#39;connection&#39;, (ws) =&gt; {<br>      ws.on(&#39;error&#39;, console.error);<br><br>      ws.on(&#39;message&#39;, (msg, isBinary) =&gt; {<br>        const msgAsString = msg.toString(&#39;utf-8&#39;);<br>        const msgObject = JSON.parse(msgAsString) as Message;<br>        insertMessage(msgObject, { db }).catch((e) =&gt; console.error(e));<br><br>        wss.clients.forEach((client) =&gt; {<br>          if (client.readyState === WebSocket.OPEN) {<br>            client.send(msgAsString, { binary: isBinary });<br>          }<br>        });<br>      });<br>    });<br><br>    wss.on(&#39;close&#39;, () =&gt; console.log(&#39;Connection closed&#39;));<br>  } catch (error) {<br>    console.error(error);<br>    process.exit(1);<br>  }<br>};<br><br>wss.on(&#39;close&#39;, () =&gt; console.log(&#39;Connection closed&#39;));<br><br>void start();</pre><p>Here, the WebSocket Server (wss) is instantiated and set to port 8080. On connection, we listen for errors and for messages. In the ws.on(’message’… function we take the message (which is an object sent as a string) and parse it so we can read the component parts.</p><p>The insertMessage function saves it to the database before it is broadcast to each connected client with the forEach loop. I was surprised to find that the WebSocket server’s broadcast capability really boiled down to a simple for-loop!</p><h4>Creating the client</h4><p>Next, I needed a way for users to interact with the WebSocket server and input and view messages.</p><p>On the client side, I used the isomorphic-ws package and the WebSocket setup looks like this in my index.ts file:</p><pre>import WebSocket from &#39;isomorphic-ws&#39;;<br><br>export const ws = new WebSocket(&#39;ws://localhost:8080/&#39;);<br><br>ws.onopen = () =&gt; console.log(&#39;WebSocket connected&#39;);<br>ws.onclose = () =&gt; console.log(&#39;WebSocket disconnected&#39;);</pre><p>The variable ws is exported and then imported in the components where we need to interact with it.</p><p>It’s used in the Form component when we submit the form. The createMessage function here sets the message id, userId, a createdAt timestamp.</p><pre>import { ws } from &#39;./index&#39;;<br><br>export const Form = ({ userId }: { userId: string }) =&gt; {<br>  const [input, setInput] = useState(&#39;&#39;);<br><br>  const handleSubmit = (e: FormEvent&lt;HTMLFormElement&gt;) =&gt; {<br>    e.preventDefault();<br>    if (!input) return;<br>    const messageToSend = createMessage(input, userId);<br>    <br>    ws.send(JSON.stringify(messageToSend));<br>    <br>    setInput(&#39;&#39;);<br>  };<br><br>  return ({/* the form */});<br>};</pre><p>ws.send transmits the message object (as a string) to the server which is listening on port 8080.</p><p>Next, we need to display messages. For that, I made a MessageList component which fetches all the messages in the database on load from the HTTP endpoint I set up on the server.</p><p>After that, we listen for the onmessage event from the WebSocket - this is the other side of the client.send call made from the for loop when the WebSocket broadcasts to connected clients. We parse the new message from a string to a Message object and add it to the end of the messages array.</p><p>So, historic messages come from the database on load (or refresh), and any new messages are displayed instantly via the WebSocket connection.</p><p>There’s a bit of styling in there and on the child Message component but you can look in the GitHub repo for those details.</p><pre>import { useEffect, useState } from &#39;react&#39;;<br>import { ws } from &#39;./index&#39;;<br>import { Message } from &#39;./message&#39;;<br><br>export interface Message {<br>  readonly id: string;<br>  readonly content: string;<br>  readonly created: string;<br>  readonly userId: string;<br>}<br><br>export const MessageList = ({ userId }: { userId: string }) =&gt; {<br>  const [messages, setMessages] = useState&lt;Message[]&gt;([]);<br><br>  useEffect(() =&gt; {<br>    async function getAllMessages() {<br>      const res = await fetch(`http://localhost:4000/messages`);<br>      if (!res.ok) throw new Error(res.statusText);<br>      const response = (await res.json()) as Message[];<br>      setMessages(response);<br>    }<br><br>    getAllMessages().catch((e) =&gt; console.log(e));<br>  }, []);<br><br>  ws.onmessage = (e) =&gt; {<br>    const msgObject = JSON.parse(e.data as string) as Message;<br>    setMessages([...messages, msgObject]);<br>  };<br><br>  return (<br>    &lt;List&gt;<br>      {messages.map((message) =&gt; (<br>        &lt;Message message={message} myUserId={userId} /&gt;<br>      ))}<br>    &lt;/List&gt;<br>  );<br>};</pre><h4>Bringing it together</h4><p>Running both the server and the client together, we can go to <a href="http://localhost:3000/">localhost:3000</a> and see the front end interface. Opening multiple windows will create multiple connections to the WebSocket.</p><p>The front end checks to see if the userId on the message is the one assigned to that client - if so, it shows the message as Me: … and if not, it’ll show it as Them:…. I could have done plenty more with users, authentication and styling to make this better but that wasn’t really the purpose of the project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*-vEQNrCcgXU4d3R-Cujviw.png" /></figure><h4>Challenges</h4><p>Initially, I had tried to fetch only new messages from the server and spread those on top of the ones I had in my React state. I found this created lots of issues with ‘too many re-renders’ so I decided to just have it fetch all the messages in the database on refresh / load. This won’t scale but it served the purpose for now.</p><p>Before I started coding, I had read that WebSockets can sometimes disconnect so you can end up in situations where the server doesn’t know if the client has disconnected and the client doesn’t know if the server has disconnected. I definitely experienced this a lot during development and it felt like the WebSocket connections were quite ‘fragile’.</p><h4>What next</h4><p>To combat the issue of disconnected WebSockets, the recommendation is it setup a ‘heartbeat’ and have the server and client ping each other to check if they are still connected. I decided not to include it in this project but this functionality would definitely be the next thing to implement as it’ll have a big impact on the stability of the user experience.</p><p>I read about was how WebSockets are not good at guaranteeing message delivery. I guess you could have the server return a confirmation that the message was received each time, and, by extension, you’d have to have the client return a confirmation when it receives a message from the server — but this is doubling the traffic on both directions. This is a reason to <a href="http://socket.io/">Socket.io</a> which does appear to guarantee both message delivery and the ordering of those messages (<a href="https://socket.io/docs/v4/delivery-guarantees#:~:text=Message%20ordering%E2%80%8B,design%20of%20the%20upgrade%20mechanism">documentation</a>). Again, <a href="http://socket.io/">Socket.io</a> provides a much more complete set of tooling for WebSockets and using ws you’re free to implement your own solutions.</p><p>I would also want to do much more with users — initially allowing users to set a username and maybe an avatar, and then see other people’s information on their messages so it’s clear who they are from. I’d also want to implement different chat ‘rooms’ so people can choose the group with whom they want to message.</p><h4>Wrapping up</h4><p>I enjoyed getting some basic exposure to WebSockets and I learned a lot about how they work. With my baseline understanding I think, in future, I would look to try out <a href="http://socket.io/">Socket.io</a> instead of ws and utilise it’s more robust features.</p><p>It was also good to get some exposure to setting up yarn workspaces that will definitely help me at work and in my future side projects.</p><h3>Stackademic 🎓</h3><p>Thank you for reading until the end. Before you go:</p><ul><li>Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏</li><li>Follow us <a href="https://twitter.com/stackademichq"><strong>X</strong></a><strong> | </strong><a href="https://www.linkedin.com/company/stackademic"><strong>LinkedIn</strong></a><strong> | </strong><a href="https://www.youtube.com/c/stackademic"><strong>YouTube</strong></a><strong> | </strong><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a></li><li>Visit our other platforms: <a href="https://plainenglish.io/"><strong>In Plain English</strong></a><strong> | </strong><a href="https://cofeed.app/"><strong>CoFeed</strong></a><strong> | </strong><a href="https://venturemagazine.net/"><strong>Venture</strong></a><strong> | </strong><a href="https://blog.cubed.run/"><strong>Cubed</strong></a></li><li>More content at <a href="https://stackademic.com/"><strong>Stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c48c5519f7d4" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/getting-started-with-websockets-in-typescript-c48c5519f7d4">Getting Started with WebSockets in TypeScript</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using RabbitMQ and Kafka to send messages between applications]]></title>
            <link>https://medium.com/@edhalliwell/using-rabbitmq-and-kafka-to-send-messages-between-applications-84c962420149?source=rss-2f3b1a8aa5f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/84c962420149</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[event-driven-programming]]></category>
            <category><![CDATA[rabbitmq]]></category>
            <category><![CDATA[event-driven-architecture]]></category>
            <dc:creator><![CDATA[Ed Halliwell]]></dc:creator>
            <pubDate>Fri, 20 Oct 2023 08:01:34 GMT</pubDate>
            <atom:updated>2024-02-12T11:24:00.210Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How to get started with RabbitMQ and Kafka to set up simple message queues between separate applications</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*Lg3pHmsJzuxSQibh" /><figcaption>Image credit: <a href="https://unsplash.com/photos/white-and-black-rabbit-on-green-grass-hcxqLJjI99E">Gavin Allanwood via Unsplash</a></figcaption></figure><h4><strong>Introduction</strong></h4><p>I’ve been keen to have a play with message queues for a while as they are not something I’ve used before. Queues can bring lots of benefits when it comes to decoupling applications whilst retaining reliability and enabling scalability — so let’s dive in!</p><h4><strong>RabbitMQ vs. Kafka</strong></h4><p>Kafka and RabbitMQ are both message queue systems and I wanted to get some experience with both as I’m not sure which one I’ll need to use (maybe both!). There is plenty written about how to choose which technology to use (see this piece by <a href="https://eranstiller.com/rabbitmq-vs-kafka">Eran Stiller</a>), and this useful article on <a href="https://aws.amazon.com/compare/the-difference-between-rabbitmq-and-kafka/">AWS</a> explains how they’re both quite similar and quite different:</p><blockquote>“RabbitMQ is a distributed message broker that collects streaming data from multiple sources to route it to different destinations for processing. Whereas Apache Kafka is a streaming platform for building real-time data pipelines and streaming applications. Kafka provides a highly scalable, fault-tolerant, and durable messaging system with more capabilities than RabbitMQ.”</blockquote><p>Architecturally, they’re obviously very different, but in essence both <strong><em>“RabbitMQ and Apache Kafka allow producers to send messages to consumers.”</em></strong></p><h4><strong>Project Plan</strong></h4><p>My plan was to create two applications, then connect them using queues (rather than have one app directly call the other), so I made:</p><ul><li>A producer app that would publish events or messages to a queue</li><li>A consumer app that would read from the queue and do ‘something’ (probably just store the message somewhere)</li><li>To connect the apps, I setup a cloud-based RabbitMQ queue and then a docker-based Kafka Topic.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QmLlou6fVUtU73sGXf5PDw.png" /></figure><p>These projects (GitHub: <a href="https://github.com/ed-halliwell/events-consumer">events-consumer</a> and <a href="https://github.com/ed-halliwell/events-producer">events-producer</a>) are written in typescript and use prettier, eslint and nodemon for development ease.</p><h4><strong>Creating the producer</strong></h4><p>I used express to create a simple endpoint which I could use to send messages to the queue. I wanted to trigger the messages myself (to mimic an event in the UI) so I created a basic form to render on the home page:</p><pre>&lt;!DOCTYPE html&gt;<br>    &lt;html&gt;<br>       &lt;head&gt;<br>          &lt;title&gt;Event Testing&lt;/title&gt;<br>       &lt;/head&gt;<br>       &lt;body&gt;<br>          &lt;h1&gt;Event Testing!&lt;/h1&gt;<br>          &lt;form action=&quot;/&quot; method=&quot;post&quot; id=&quot;form1&quot;&gt;<br>             &lt;label for=&quot;message&quot;&gt;Message:&lt;/label&gt;<br>             &lt;input type=&quot;text&quot; id=&quot;message&quot; name=&quot;message&quot;&gt;<br>             &lt;input type=&quot;submit&quot; value=&quot;OK&quot; /&gt;<br>          &lt;/form&gt;<br>       &lt;/body&gt;<br>    &lt;/html&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*ENpLVOZ2uOwRDwFJqrDgyA.png" /></figure><p>Submitting this form calls the root domain with a POST call with the message data:</p><pre>app.post(&quot;/&quot;, (req: Request, res: Response) =&gt; {<br>  console.log(&quot;Firing event... &quot;);<br><br>  // get the message from the form<br>  const { message } = req.body;<br><br>  return res.redirect(&quot;/&quot;);<br>});</pre><h4><strong>Getting started with (CloudAMQP) RabbitMQ</strong></h4><p>I wanted to create a decoupled producer and consumer to more closely mimic a real world setup, so I used CloudAMQP (Advanced Message Queuing Protocol) to host my message queue.</p><p>I signed up at <a href="https://www.cloudamqp.com/">cloudamqp.com</a> and created a development instance (using the free ‘Little Lemur’, plan), a queue, and then utilised the <a href="https://www.rabbitmq.com/tutorials/tutorial-one-javascript.html">RabbitMQ Getting Started Documentation (Javascript)</a> to write the producer and consumer code.</p><p>On the producer side, I created this class:</p><pre>import amqplib, { Channel } from &quot;amqplib&quot;;<br><br>export class MyRabbitMqProducer {<br>  private queueName: string;<br><br>  private queueUrl: string;<br><br>  private queue!: Channel;<br><br>  constructor(queueName: string, queueUrl: string) {<br>    this.queueName = queueName;<br>    this.queueUrl = queueUrl;<br>  }<br><br>  async connect() {<br>    console.log(&quot;BEGINNING OF CONNECT FUNCTION&quot;);<br>    const connection = await amqplib.connect(<br>      this.queueUrl ?? &quot;amqp://localhost&quot;<br>    );<br>    console.log(&quot;CONNECTION: &quot;, connection);<br><br>    const channel = await connection.createChannel();<br>    channel.assertQueue(this.queueName);<br><br>    this.queue = channel;<br>  }<br><br>  async sendMessage(msg: string): Promise&lt;void&gt; {<br>    await this.queue.sendToQueue(this.queueName, Buffer.from(msg));<br>  }<br>}</pre><p>I used a connect() function to get around some async / await issues I was having with the setup described in the docs. The class is instantiated in the index.ts file and called inside the POST call:</p><pre>const queueName = process.env.QUEUE_NAME ?? &quot;&quot;;<br>const queueUrl = process.env.QUEUE_URL ?? &quot;&quot;;<br><br>// RABBIT MQ<br>const messageQueue = new MyRabbitMqProducer(queueName, queueUrl);<br><br>async function connectToRabbitQueue() {<br>  await messageQueue.connect();<br>  console.log(&quot;RabbitMQ connected successfully&quot;);<br>}<br>connectToRabbitQueue();<br><br>interface Log {<br>  sentAt: Date;<br>  message: string;<br>}<br><br>... <br><br>app.post(&quot;/&quot;, (req: Request, res: Response) =&gt; {<br>  const { message } = req.body;<br>  const log: Log = { sentAt: new Date(Date.now()), message };<br>  console.log(&quot;Firing event... &quot;, log);<br>  messageQueue.sendMessage(JSON.stringify(log));<br>  return res.redirect(&quot;/&quot;);<br>});</pre><p>I added a timestamp to the message object to keep track of exactly when the message was created / sent from the producer (I’ll use this later to track how long the messages are in the queue before reaching the consumer).</p><h4><strong>Creating the consumer</strong></h4><p>Similar to the producer app, the consumer also uses express but this time, it’s enough to have one GET endpoint to display the messages. The connection to RabbitMQ ‘listens’ for new messages automatically but we’ll need to refresh the root page to see any new messages that have been consumed (though we can see them arrive in real time in the console).</p><p>I created this class to interact with my queue in CloudAMQP:</p><pre>import amqplib, { Channel } from &quot;amqplib&quot;;<br><br>export class MyRabbitMqConsumer {<br>  private queueName: string;<br><br>  private queueUrl: string;<br><br>  constructor(queueName: string, queueUrl: string) {<br>    this.queueName = queueName;<br>    this.queueUrl = queueUrl;<br>  }<br><br>  async createRabbitConnection(): Promise&lt;Channel&gt; {<br>    const connection = await amqplib.connect(this.queueUrl);<br><br>    const channel = await connection.createChannel();<br><br>    channel.assertQueue(this.queueName, { durable: true });<br><br>    return channel;<br>  }<br><br>  async consumeMessages(channel: Channel) {<br>    await channel.consume(<br>      this.queueName,<br>      (message) =&gt; {<br>        if (message) {<br>          console.log(` [/] Message successfully received from RabbitMQ`);<br>          console.log(JSON.parse(message.content.toString()));<br>        }<br>      },<br>      { noAck: true }<br>    );<br>  }<br>}</pre><h4><strong>Linking the producer and consumer with RabbitMQ</strong></h4><p>The above class is instantiated in the main index.ts file of the consumer before setting up the express route:</p><pre>// RABBITMQ CONSUMER<br>async function connectToRabbit() {<br>  const rabbit = new MyRabbitMqConsumer(queueName, queueUrl);<br>  const channel = await rabbit.createRabbitConnection();<br>  await rabbit.consumeMessages(channel);<br>}<br>connectToRabbit();<br> <br>... <br><br>app.get(&quot;/&quot;, async (req: Request, res: Response) =&gt; {<br>  res.send(&quot;...you can render something here&quot;);<br>});</pre><p>I added some decoration to the logs (which I’ve not shown in the code samples here but it is in the GitHub repos) to timestamp when they were created in the producer and then when they arrived in the consumer as I was interested to see how long it would take for the message to do the round trip to the queue and then onto the consumer.</p><p>With both apps running locally, I can fill out and submit the form in the producer. The message body (along with a createdAt timestamp) is then sent to the RabbitMQ queue. This queue holds the message until the consumer application ‘consumes’ the message. It then adds a receivedAt timestamp and runs the calculation to determine the time taken to make the journey (delayInSeconds) which provides the following output:</p><pre>[<br>  {<br>    &quot;source&quot;: &quot;rabbit&quot;,<br>    &quot;receivedAt&quot;: &quot;2023-10-19T12:55:00.257Z&quot;,<br>    &quot;sentAt&quot;: &quot;2023-10-19T12:54:11.198Z&quot;,<br>    &quot;delayInSeconds&quot;: 49,<br>    &quot;message&quot;: &quot;hello&quot;<br>  }<br>]</pre><p>There is far more I could look into on RabbitMQ but this was as far as I’d planned to go to get my feet a little wet. So, onto Kafka…</p><h4><strong>Adding Kafka to the producer</strong></h4><p>There isn’t a cloud based Kafka offering (that I’m aware of) like CloudAMQP so I had to look into running Kafka in a docker container on my machine. This meant ‘dockerising’ both the producer and consumer, so I added a Dockerfile and a docker-compose.yaml to both apps.</p><ul><li>On the consumer side, docker just runs the consumer app as a service and attaches it to an events network (to allow the apps to connect to Kafka).</li><li>On the producer side, it sets up the producer app as a service and attaches it to the same events network. It then adds kafka, zookeeper and akhq services and links them all together on the same network.</li></ul><p>We use Apache Zookeeper to coordinate distributed processes and services and AKHQ to visual the data in the Kafka ‘Topic’ (equivalent to ‘queues’ in RabbitMQ).</p><p>I added the following class for the Kafka producer, using the kafkajs library and their <a href="https://kafka.js.org/docs/getting-started">Getting Started documentation</a>:</p><pre>import { Kafka, Partitioners, Producer } from &quot;kafkajs&quot;;<br><br>export class MyKafkaProducer {<br>  private clientId: string;<br><br>  private topicName: string;<br><br>  private producer: Producer;<br><br>  constructor(clientId: string, topicName: string) {<br>    this.clientId = clientId;<br>    this.topicName = topicName;<br>    this.producer = this.#createProducer();<br>  }<br><br>  async connect(): Promise&lt;void&gt; {<br>    try {<br>      await this.producer.connect();<br>    } catch (error) {<br>      console.log(&quot;Error connecting the producer: &quot;, error);<br>    }<br>  }<br><br>  async sendMessage(msg: string): Promise&lt;void&gt; {<br>    await this.producer.send({<br>      topic: this.topicName,<br>      messages: [{ value: msg }],<br>    });<br>  }<br><br>  async shutdown(): Promise&lt;void&gt; {<br>    await this.producer.disconnect();<br>  }<br><br>  #createProducer(): Producer {<br>    const kafka = new Kafka({<br>      clientId: this.clientId,<br>      brokers: [&quot;kafka:9092&quot;],<br>    });<br><br>    return kafka.producer({<br>      createPartitioner: Partitioners.DefaultPartitioner,<br>    });<br>  }<br>}</pre><p>This class is then instantiated in the index.ts file (just after setting up the RabbitMQ connection but before the express routes):</p><pre>// KAFKA<br>const kafka = new MyKafkaProducer(kafkaClientId, kafkaTopicName);<br><br>async function connectToKafka() {<br>  await kafka.connect();<br>  console.log(&quot;Kafka connected successfully&quot;, {<br>    kafkaClientId,<br>    kafkaTopicName,<br>  });<br>}<br>connectToKafka();<br><br>... <br><br>app.post(&quot;/&quot;, (req: Request, res: Response) =&gt; {<br>  const { message } = req.body;<br><br>  const log: Log = { sentAt: new Date(Date.now()), message };<br><br>  console.log(&quot;Firing event... &quot;, log);<br>  messageQueue.sendMessage(JSON.stringify(log)); // RABBIT MQ<br>  kafka.sendMessage(JSON.stringify(log));        // KAFKA<br><br>  return res.redirect(&quot;/&quot;);<br>});</pre><h4><strong>Adding Kafka to the consumer</strong></h4><p>As before, I made the following class in the consumer to manage Kafka:</p><pre>import {<br>  Consumer,<br>  ConsumerSubscribeTopics,<br>  EachMessagePayload,<br>  Kafka,<br>} from &quot;kafkajs&quot;;<br><br>export class MyKafkaConsumer {<br>  private kafkaConsumer: Consumer;<br><br>  private clientId: string;<br><br>  private topicName: string;<br><br>  public constructor(clientId: string, topicName: string) {<br>    this.clientId = clientId;<br>    this.topicName = topicName;<br>    this.kafkaConsumer = this.#createKafkaConsumer();<br>  }<br><br>  public async startConsumer(): Promise&lt;void&gt; {<br>    const topic: ConsumerSubscribeTopics = {<br>      topics: [this.topicName],<br>      fromBeginning: false,<br>    };<br><br>    try {<br>      await this.kafkaConsumer.connect();<br>      await this.kafkaConsumer.subscribe(topic);<br><br>      await this.kafkaConsumer.run({<br>        eachMessage: async (messagePayload: EachMessagePayload) =&gt; {<br>          const { message } = messagePayload;<br>          console.log(` [/] Message successfully received from Kafka`);<br>          console.log(JSON.parse(message?.value?.toString()));<br>        },<br>      });<br>    } catch (error) {<br>      console.log(&quot; [X] Error: &quot;, error);<br>    }<br>  }<br><br>  public async shutdown(): Promise&lt;void&gt; {<br>    await this.kafkaConsumer.disconnect();<br>  }<br><br>  #createKafkaConsumer(): Consumer {<br>    const kafka = new Kafka({<br>      clientId: this.clientId,<br>      brokers: [&quot;kafka:9092&quot;],<br>    });<br>    const consumer = kafka.consumer({ groupId: &quot;consumer-group&quot; });<br>    return consumer;<br>  }<br>}</pre><p>And again, adding the connection setup to the index.ts file:</p><pre>// KAFKA CONSUMER<br>async function connectToKafka() {<br>  const kafka = new MyKafkaConsumer(kafkaClientId, kafkaTopicName);<br>  await kafka.startConsumer();<br>}<br>connectToKafka();</pre><h4><strong>Bringing it all together</strong></h4><p>Running docker-compose up -d in both consumer and producer apps, I can then visit my producer (running on localhost:4000) and submit the form in the UI. The same message is then sent to both the RabbitMQ queue on CloudAMQP and to the Kafka Topic I have running in a docker container.</p><p>Then in the consumer app I can see (either in the console or by refreshing localhost:4001) the following output:</p><pre>[<br>  {<br>    &quot;source&quot;: &quot;kafka&quot;,<br>    &quot;receivedAt&quot;: &quot;2023-10-19T12:54:11.259Z&quot;,<br>    &quot;sentAt&quot;: &quot;2023-10-19T12:54:11.198Z&quot;,<br>    &quot;delayInSeconds&quot;: 0,<br>    &quot;message&quot;: &quot;hello&quot;<br>  },<br>  {<br>    &quot;source&quot;: &quot;rabbit&quot;,<br>    &quot;receivedAt&quot;: &quot;2023-10-19T12:55:00.257Z&quot;,<br>    &quot;sentAt&quot;: &quot;2023-10-19T12:54:11.198Z&quot;,<br>    &quot;delayInSeconds&quot;: 49,<br>    &quot;message&quot;: &quot;hello&quot;<br>  }<br>]</pre><p>It’s interesting to see that the delay for Kafka is barely any time at all (as it’s all only running locally) but the round trip to CloudAMQP takes a little while longer.</p><p>I can also view the Kafka topic on AKHQ at <a href="http://localhost:8080/">localhost:8080</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cNCigxTULPf4B2It4Nq-JA.png" /></figure><h4>Wrapping up</h4><p>There are loads more features and configuration I could have explored in both systems — exchanges, dead letter queues, retries, retention policies and so much more — and I hope to go back and visit these in future.</p><p>For this project, I enjoyed getting some (simple) exposure to RabbitMQ and Kafka and I learned a lot about how they both work, as well as getting some useful practise Docker-ising my apps.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84c962420149" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scraping and Visualising Data with Cheerio and Prometheus]]></title>
            <link>https://medium.com/@edhalliwell/scraping-and-visualising-data-with-cheerio-and-prometheus-d16e31a9bc29?source=rss-2f3b1a8aa5f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/d16e31a9bc29</guid>
            <category><![CDATA[prometheus]]></category>
            <category><![CDATA[cheeriojs]]></category>
            <category><![CDATA[scraping]]></category>
            <category><![CDATA[node-cron]]></category>
            <dc:creator><![CDATA[Ed Halliwell]]></dc:creator>
            <pubDate>Fri, 24 Mar 2023 15:10:03 GMT</pubDate>
            <atom:updated>2023-03-24T15:10:03.306Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How to use Cheerio, node-cron and Prometheus to scrape data from a website and visualise it over time.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EgJ-wxIOAKFq-wsO" /><figcaption>Photo by <a href="https://unsplash.com/@glenncarstenspeters?utm_source=medium&amp;utm_medium=referral">Glenn Carstens-Peters</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4><strong>Introduction</strong></h4><p>Recently, I needed to periodically capture some data from multiple websites for a project my team was working on. In the process, I learned a bunch about site scraping, running scheduled jobs and logging data. In this write up, I’ll explain what I did and the tools I used.</p><p>I can’t show the exact project I worked on, so I will use stock prices here. Finance data is obviously well served by APIs so scraping isn’t usually necessary but it’s a good example of useful, numeric website data which changes frequently that can be scraped. You could use this setup for tracking product availability, getting the latest prices on e-commerce or travel websites and lots more.</p><h4><strong>Project Plan</strong></h4><p>Let’s say I want to get the FTSE 100 value and then track it over time. I’ll need some way to get the data from a website (scraping), then some method to get data periodically (a scheduled job) and somewhere to store that data so I can visualise it.</p><p>This project is written in Typescript and uses Prettier, ESlint, ts-node and nodemon for development ease. The full project code can be found on <a href="https://github.com/ed-halliwell/site-scraper">Github</a>.</p><h4><strong>Getting Started with Cheerio</strong></h4><p>For the site scraping, I’ll use <a href="https://cheerio.js.org/">Cheerio</a> which describes itself as: <em>“The fast, flexible &amp; elegant library for parsing and manipulating HTML and XML.”</em> It’s a widely used library for scraping data from websites and the documentation was helpful and easy to follow.</p><p>I’ll use <a href="https://www.hl.co.uk/shares/stock-market-summary/ftse-100">Hargreaves Lansdown</a> for the data as their site is server-side rendered — it’s worth noting that Cheerio doesn’t work very well with client-side rendered sites!</p><p>I can use axios to make the call to the target website then pass that into Cheerio to fetch the HTML from the page, so let’s get those dependencies installed:</p><pre>yarn add cheerio axios</pre><p>My first step is to write a simple function to get the data from the HL site and console log it to verify it’s working. I can destructure data from the axios.get() call and then a structured version of the HTML using cheerio’s load method:</p><pre>const { data } = await axios.get(&#39;https://www.hl.co.uk/.../ftse-100&#39;);<br><br>const $ = cheerio.load(data);</pre><p>After that, I need to target the specific element on the page which contains the data I want to scrape. This should be consistent each time the page loads — so an element ID or a static class name would be perfect.</p><p>To get this information, right click the element and inspect. Here I can use the span’s ID #indices-val-UKX to select it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MhgY_cB1SQmXfDAbtHOtvw.png" /></figure><p>You could also copy the selector by right clicking the element in the developer tool panel, going to ‘Copy’, then ‘Copy selector’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*m2chWqmcNmEz3-z_nArcFQ.png" /></figure><p>I can then plug the ID selector into Cheerio and use the .text() method to get the content of the span element — the FTSE 100 value in this case. I need to clean up that string (which includes a comma) and convert it into a number with two decimal places before logging it out:</p><pre>import * as cheerio from &#39;cheerio&#39;;<br>import axios from &#39;axios&#39;;<br><br>async function scrape(): Promise&lt;void&gt; {<br>  try {<br>    const { data } = await axios.get(&#39;https://www.hl.co.uk/.../ftse-100&#39;);<br><br>    const $ = cheerio.load(data);<br>    <br>    const ftse100StringValue = $(&#39;#indices-val-UKX&#39;).text();<br>    <br>    const ftse100NumberValue = parseFloat(ftse100StringValue.replace(&#39;,&#39;, &#39;&#39;));<br>    <br>    console.log(`FTSE 100 value: ${ftse100NumberValue}`);<br><br>  } catch (error) {<br>    console.error(error);<br>  }<br>}<br><br>scrape()</pre><p>So far, so good — my scraping function works but I need to get this running on a periodic basis and I need to log the data somewhere more persistent than my console.</p><h4><strong>Logging metrics to Prometheus</strong></h4><p>Next, I want to log the data to Prometheus so I can visualise the data over time. I could also add more metrics (such as the DOW, NASDAQ or a specific stock price) to it in future if I wish .</p><p>I will use <a href="https://github.com/siimon/prom-client">prom-client</a> which is <em>“a prometheus client for Node.js that supports histogram, summaries, gauges and counters”</em>.</p><pre>yarn add prom-client</pre><p>First, I need to define the metrics I want to collect and then register them with Prometheus. I will use a ‘gauge’ in this case — a single value that will change (going both up and down) over time.</p><pre>import client, { Registry } from &#39;prom-client&#39;;<br><br>export function config(): Registry {<br>  // Create a Registry which registers the metrics<br>  const register = new client.Registry();<br><br>  // Add a default label which is added to all metrics<br>  register.setDefaultLabels({<br>    app: &#39;site-scraper&#39;,<br>  });<br><br>  // Register the metric<br>  register.registerMetric(<br>    new client.Gauge({<br>      name: &#39;ftse_100_value&#39;,<br>      help: &#39;Value of FTSE 100 Index&#39;,<br>      labelNames: [&#39;index_value&#39;, &#39;index_name&#39;],<br>    }),<br>  );<br><br>  return register;<br>}</pre><p>I need to make sure this config function runs every time the app starts up so I’ll call it from the index.ts file but before I do that, I need to setup an endpoint to expose the metrics in prometheus’s UI.</p><p>I can use docker to run the Prometheus instance and expose the metrics on a port (localhost:8080/metrics in this case and visualise it on localhost:9090). It’s a bit much to show it all in this article so checkout prometheus.yml, Dockerfile, docker-compose.yml and the server.ts files in the <a href="https://github.com/ed-halliwell/site-scraper">GitHub repository</a>.</p><p>Bringing these pieces together, I can add a few more lines to the top of my index.ts file to register the metrics and then start the server when the app is started.</p><pre>import * as dotenv from &#39;dotenv&#39;;<br>import axios from &#39;axios&#39;;<br>import * as cheerio from &#39;cheerio&#39;;<br>import { config } from &#39;./prometheus-config&#39;;<br>import { startServer } from &#39;./server&#39;;<br><br>dotenv.config();<br>const prometheusRegister = config();<br>startServer(prometheusRegister);<br><br>async function scrape(metricsRegister): Promise&lt;void&gt; {<br>  try {<br>    const { data } = await axios.get(&#39;https://www.hl.co.uk/.../ftse-100&#39;);<br><br>    const $ = cheerio.load(data);<br><br>    const ftse100StringValue = $(&#39;#indices-val-UKX&#39;).text();<br><br>    const ftse100NumberValue = parseFloat(ftse100StringValue.replace(&#39;,&#39;, &#39;&#39;));<br><br>    const ftse100Metric = await metricsRegister._metrics.ftse_100_value;<br><br>    ftse100Metric.set({ index_name: &#39;ftse_100&#39; }, ftse100NumberValue);<br><br>  } catch (error) {<br>    console.error(error);<br>  }<br>}<br><br>scrape(prometheusRegister)</pre><p>We also need to take the FTSE 100 value we scraped before and update the metric in the prometheus register (instead of logging it to the console).</p><p>I can now see the metrics in Prometheus, but I only get the data once (when I first start the app) so I need to setup a cron job to fetch the data periodically.</p><h4><strong>Setting up the cron job</strong></h4><p>A cron job allows us to run a given function either at a specific time or on a schedule. I’ll use node-cron which is a <em>“tiny task scheduler in pure JavaScript for node.js”</em>.</p><pre>yarn add node-cron</pre><p>We want the scrape function to run on a schedule so instead of just calling it at the bottom of the index.ts file, we can replace that with:</p><pre>cron.schedule(process.env.CRON_SCHEDULE, () =&gt; scrape(prometheusRegister));</pre><p>The CRON_SCHEDULE is set in an environment variable. I suggest using <a href="https://crontab.guru/">crontab.guru</a> to get the value you needed for the schedule you’re after. For instance, * * * * * would fire the function every minute, /10 * * * * would fire it once every 10 minutes and 0 0 * * * would fire at midnight every day.</p><p>With all the pieces together, we can now see the FTSE 100 value being logged to prometheus over time:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FgsCPpZaPPaMxp5guzTvTw.png" /></figure><h4><strong>Wrapping up</strong></h4><p>In this article, we’ve used Cheerio, node-cron and Prometheus to fetch and visualise data over time. It’s a simple example but there are many more ways and scenarios in which these tools can be used.</p><p>I’ve used Cheerio to get just one data point here but it can be used to fetch multiple data points on a page, or even loop through a list of items and fetch a given element (like a price) from each. Also, it can be a challenge to use Cheerio when a site is client site rendered, but it is possible to scrape JSON data from an API call on the page instead as a workaround.</p><p>You could utilise Grafana to visualise the data in a more delightful and user friendly way. Prometheus can also log other data types such as counters (to measure cumulative data) and histograms (to group data into configurable buckets).</p><p>I hope you found this article helpful and the complete code for this project can be found on <a href="https://github.com/ed-halliwell/site-scraper">GitHub</a>. 🙂</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d16e31a9bc29" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[7 Key Learnings from our Experience of Pair Programming]]></title>
            <link>https://medium.com/hacking-talent/7-key-learnings-from-our-experience-of-pair-programming-b0e45859015e?source=rss-2f3b1a8aa5f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0e45859015e</guid>
            <category><![CDATA[developer-experience]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[pair-programming]]></category>
            <category><![CDATA[collaboration]]></category>
            <dc:creator><![CDATA[Ed Halliwell]]></dc:creator>
            <pubDate>Thu, 10 Nov 2022 12:14:22 GMT</pubDate>
            <atom:updated>2022-11-10T15:17:47.021Z</atom:updated>
            <content:encoded><![CDATA[<p><em>We love pair programming at </em><strong><em>Beamery</em></strong><em> as it is a great way to share knowledge and build a collaborative, effective engineering team.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JVVYddDLMO6uuRwNmyFPOw.jpeg" /></figure><p>At <a href="https://beamery.com/"><strong>Beamery</strong></a>, pair programming is a vital practice in our collaboration toolbox. As a company, we believe strongly in communicating openly and pairing allows our engineers to collaborate, share knowledge and move more quickly than they can when working alone.</p><p>However, it’s important to remember that pairing is a tool that needs to be used in the right context, with the right intentions and expectations otherwise the benefits can be lost.</p><p>In this article, <a href="https://www.linkedin.com/in/vallesmanuel/"><strong>Manu</strong></a> and <a href="https://www.linkedin.com/in/edhalliwell/"><strong>Ed</strong></a> from Team Quantum (one of a group of teams who own ‘candidate experiences’ at Beamery) take us through their experience of pairing in their team and explain what they’ve learned along the way.</p><h4>🚀 About us</h4><p><strong>Ed:</strong> I joined Quantum back in March after completing Beamery’s engineering bootcamp. I was previously a Lead Product Manager at Beamery but this was my first role as a software engineer. Having been at the company for 2 years already, I had a good knowledge of Beamery and its core product, but I had (and still have) loads to learn as an engineer.</p><p>I was really fortunate to join a team where the culture was already strongly orientated towards pairing and collaborating. This was great for me as I needed a lot of hand-holding in the first few weeks as I found my feet with the new product area, the code and being an engineer for the first time.</p><p>Manu kindly agreed to be my ‘buddy’ in the team to help me get up to speed and, from my first day in Quantum, he and I teamed up to work together.</p><p><strong>Manu:</strong> I started working as a mid-level software engineer at Beamery a year ago when the Quantum team was composed of only very senior engineers. I had been in a couple of tech companies before and I thought this would be a perfect opportunity to both learn from experienced engineers as well as share my knowledge with juniors.</p><p>I believe that working side-by-side with other engineers is the best way to grow as a professional and to build a great team atmosphere. Having regular pair programming sessions, either working on the same task or just helping others to debug an issue, is one of the main reasons why I became a software engineer. To me, all these activities help us bring out the best in each other and grow together whilst delivering for the company.</p><p>I feel lucky to have been able to apply this way of working and thinking in our team, especially once Ed joined us. I could see how fast he was learning and growing in just a few weeks, even though the environment we were working in was increasingly fast-paced.</p><h4>🤝 Build a relationship first</h4><p>In our experience, a good working relationship creates a strong foundation for effective pairing. If you’re pairing with someone but you don’t feel like you can offer advice, ask questions or interrupt them if you have a suggestion to make, you become merely an observer and the value of working together is lost.</p><p>Everyone will have different working and communication styles, but it’s important to build a connection that allows for open communication. This could begin with a quick, informal chat before you get started — something of a ‘getting to know you’ session. Even if you don’t hit it off straight away, there is always something to be gained from pairing with another engineer so it’s worth taking the time to get to know your pairing partner, understand how they work, their skill level and what they hope to get out of the experience.</p><p>Building empathy and trust allows both parties to speak openly without fear of causing offence, creating an environment for collaboration. To foster the most effective and collaborative environment, it is necessary to communicate openly, give and receive feedback, have empathy for one another and be vulnerable and risk being wrong.</p><p>These things don’t happen overnight and are built slowly over time as a team works together but that journey starts with a first step. Ultimately, the goal is to do the work and deliver for the team, the company and your customers — but there’s no reason why it can’t be fun at the same time!</p><h4>🔗 Pair with new members of the team</h4><p>When starting out as an engineer, a junior can feel like they’re not adding any value and worry that getting help and support from their seniors is distracting them from their work. However, without access to more senior engineers, juniors can very quickly become stuck.</p><p>Whilst this is a particular issue for juniors, it’s also true for any new member joining a team. Joining a new team can be quite challenging, especially when a project has already been started or a product is quite mature. There is always a period of learning or ‘ramping up’ as the new person familiarises themselves with people, the product and the codebase.</p><p>For busy teams, hoping that someone new will get up to speed and add value by themselves is often ineffective. At Beamery, we recognise that growth is a shared responsibility and so we ensure new engineers are paired, or ‘buddied up’, with more senior members of the team to guide them and promote their development from their first week. This creates an environment where new team members can get involved more quickly and make valuable contributions to the team’s work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rICFVzuQtJWIBal5JtTJRg.jpeg" /></figure><h4>💭 Decide together on a pairing style</h4><p>When pairing, we generally utilise the ‘driver / navigator’ approach whereby one person shares their screen and codes (the driver) whilst the other gives directions and provides suggestions (the navigator). Then, after a while, you swap roles. This approach is great as it allows the driver to practise their coding whilst it allows the navigator to think about potential issues, bugs and plan the next steps. With this method, we’ve found that it’s important to establish a couple of ‘rules’ to ensure the collaboration is effective.</p><p>It’s good practice for the navigator to apply a ‘5-second rule’ if they spot a typo or an error. Giving the driver the chance to correct their own mistake is far more helpful than interrupting them constantly and pointing out their errors. Often, the navigator will be aware of what they’ve done but sometimes it’s easy to overlook a typo, even with the help of linting and formatters.</p><p>There are variations in this style of pairing. For instance, for those at a similar skill level, working together jointly on a problem, it can sometimes feel more like a pair of navigators with one person driving. This can be helpful if one is testing functionality for the other, looking up documentation or simply providing alternative ideas to solve a problem.</p><p>We also look to over-communicate whilst pairing so that it’s clear what is happening, what the next step is and what kind of approach is being taken. This also makes it easier to ask questions as there’s already an ongoing dialogue, rather than awkward periods of silence.</p><p>For any of these tips to work well, as above, it’s important to build a relationship first and ensure you’ve created an environment open to collaboration. Pointing out a mistake or suggesting that you swap over can be difficult if you’re not yet comfortable with that person and you fear them taking offence — especially if you’re the more junior engineer — so having agreed practices ahead of time can help with this.</p><p>There are lots of styles of pairing — try out a few to see what works best for you. You could try ‘ping pong’ pairing where one person writes a failing test and the other writes the code to make it pass. Alternatively, the ‘tour guide’ might work best — where one engineer (usually the more senior of the two) takes the reins and codes while the junior engineer focuses on asking questions and learning from what’s happening.</p><h4>⚙️ Get the tooling right</h4><p>When pair programming in the same physical location, it’s necessary to prepare and figure out how it will be comfortable for both sides. We’ve found using second screens, ideally on the same desk, is ideal.</p><p>With the shift to more frequent working from home, remote pairing has become far more common than it was before the pandemic. Fortunately, video conferencing and screen-sharing tools which allow both engineers to see and control each other’s machines, have made this a great experience. Also, online visualisation tools can be helpful substitutes for a piece of paper or a whiteboard to sketch ideas or explain a solution.</p><p>When pairing remotely, we’ve found that it’s better to have your video on as this improves the communication considerably, allowing you to pick up on visual cues, behaviours and expressions to help communicate.</p><p>Whilst there are certainly benefits to remote pairing, we’ve found that it’s very easy to lose focus and multitask, particularly if you’re not ‘driving’. It’s important to avoid this by minimising distractions, taking frequent breaks and reserving a specific block of time each day for pairing. When it is necessary to multitask or answer a Slack message, be sure to over-communicate with your partner and ensure focus isn’t lost.</p><h4>💡 Rotate within the team and don’t be limited to pairs</h4><p>Pairing with the same person all the time can be great, but it can also be tiring. We’ve found that pairing and interacting with a wide variety of people is ideal. By pairing up with a mixture of people, it’s possible to learn about, or help others with, more topics and techniques. It also enables you to build a better relationship with your team members and see how different people communicate.</p><p>As a team, we sometimes find ourselves ‘mob’ or group programming with up to 4 or 5 people. It’s rarely organised ahead of time, but we’ll often swarm together on a problem — either pulling people into a call or organising it ad hoc at our morning stand-up.</p><p>‘Mobbing’ is a great way to share and pool knowledge quickly and having multiple eyes on a thorny production bug can be very helpful. It can also be a useful technique to ensure engineers are on the same page about a process change or a new technology as it is an efficient way to spread understanding in the team. We would caution this by saying mobbing should be used as the exception rather than the rule — it’s very costly for all team members to stop what they’re doing and work on a single problem together, and it will undoubtedly affect your team’s velocity.</p><h4>🛑 Stop, take a break</h4><p>Whatever your chosen style of pairing, we’ve found that it’s also critical to take breaks often. Pairing is tiring as it requires your full concentration for long periods of time, so after a while, your mind needs a rest. This extends to working in general of course (!) but it’s tricky to stop when two or more of you need to agree to have a break.</p><p>It can sometimes be hard to know when to stop, and some engineers will be more keen to ‘power through’ than others. Try setting a time limit, such as saying that you’ll switch after a certain period of time. Or you could try picking a specific task and plan to swap when you’ve implemented a certain piece of functionality or closed a particular ticket.</p><p>In our experience, we’ve found that working for around 45 mins to an hour, then having a break, and swapping when you come back together works well. Everyone is different though, so try out a few different approaches to see what your team prefers.</p><p>If you don’t take breaks, you can quickly become less productive, more prone to making mistakes or you might just get annoyed with each other — it’s really important!</p><h4>🚦 Know when to pair and when not to</h4><p>Whilst pairing has many benefits, it’s important to be mindful of when it’s best to pair and when it’s best to work independently.</p><p>It’s not possible to pair all day and, in practice, engineers have many tasks, like meetings and self-learning, to do alongside coding. It’s necessary to strike a balance and one way to achieve this is by setting and sticking to core pairing hours.</p><p>There will be times when you are pairing that you’ll reach a dead end where neither person knows how best to proceed. Researching and experimenting together can sometimes be frustrating as people explore things in different ways and at different paces. In these situations, agree on the different questions to be answered then split up to do individual investigations.</p><p>Sometimes it’s necessary to deliver more quickly for a customer or for the business, and pair programming limits the number of tasks a team can work on in parallel. In this case, pairing can temporarily take a back seat but it’s important to reflect in a retrospective to ensure that any knowledge sharing that is required is acted upon.</p><p>For a junior engineer, it can be fantastic to pair up with senior engineers when starting out as it has the ability to greatly accelerate your development. However, as a junior’s confidence builds, pairing should be mixed with working on tasks independently to allow them to take ownership of their work. It’s still crucial to get feedback but this can be via comments and peer reviews.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ck6ijD375ukMYu4Oo-giJQ.jpeg" /></figure><h4>🧠 Two heads are better than one</h4><p>There should always be space for independent working but we firmly believe that pair programming enables us to share ideas, collaborate and work more effectively as a team.</p><p>Pairing is great for sharing knowledge and spreading the ownership of code, and it is particularly important for juniors or new members of the team. Disseminating knowledge is not only great for each individual’s development, it also ensures that there are no single points of failure in the team, where only one person knows how something works. More experienced engineers benefit from explaining the ‘why’ behind each block of code and it helps consolidate their knowledge and practice and improve their teaching techniques.</p><p>Having more than one pair of eyes on a problem can bring a diversity of thinking, giving a chance for different ideas of perspectives to be heard. It can often be useful to think about multiple solutions before charging ahead with the first one you think of. It’s more like an extended brainstorming process where multiple ideas and solutions are explored.</p><p>The practice reminds you that your code won’t just be seen by you and that it is important that what you write is clean and understandable to others. You also get the added benefit of your code being reviewed as you type it. Particularly for complex or large tasks, this really takes the onus off the reviewer who comes into a big PR cold and has to try and work out what you’ve done.</p><p>Overall, pairing leads to better outcomes — with higher quality code as well as improved coordination and collaboration between team members.</p><h4>🤔 What’s next</h4><p>Beamery is looking for Software Engineers Front &amp; Back Mid/Senior/Director, SRE Platform Engineers, Engineering Managers, Tech Leads, Product Operations/Managers/Designers across all levels, and even more roles across London, Remote &amp; Berlin! To join us — <a href="https://ter.li/4l918d"><strong>Learn more HERE!</strong></a></p><p><strong><em>Written by Ed Halliwell &amp; Manuel Valles</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0e45859015e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hacking-talent/7-key-learnings-from-our-experience-of-pair-programming-b0e45859015e">7 Key Learnings from our Experience of Pair Programming</a> was originally published in <a href="https://medium.com/hacking-talent">Beamery Hacking Talent</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making Growth a Shared Responsibility through Mentorship at Beamery]]></title>
            <link>https://medium.com/hacking-talent/making-growth-a-shared-responsibility-through-mentorship-at-beamery-61e401b6dfbf?source=rss-2f3b1a8aa5f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/61e401b6dfbf</guid>
            <category><![CDATA[mentor]]></category>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[mentorship]]></category>
            <category><![CDATA[mentoring]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Ed Halliwell]]></dc:creator>
            <pubDate>Fri, 29 Jul 2022 10:10:12 GMT</pubDate>
            <atom:updated>2022-07-29T10:10:12.404Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Explore real stories of how pairing up our bootcampers with established engineers at Beamery has proven to be mutually beneficial</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pylduo_hUGowAJXbyxX_dA.png" /><figcaption>Our mentors and mentees (clockwise from top-left): Lyndsey, Ed, Grace and Tom</figcaption></figure><p>At the beginning of October 2021, seven aspiring software engineers started on Beamery’s engineering bootcamp. Over the next four months, they were thrown into learning a variety of technical, people and problem solving skills to enable them to join the Beamery engineering team in early 2022.</p><p>From the first week of the program, each bootcamper was paired up with a Beamery mentor to provide technical assistance as well as a friendly ear to listen, help and ease the transition into being a full time Beamerino.</p><p>In this article, our Senior Engineering Director, Simon Coutts, sits down with two former bootcampers (Ed Halliwell and Grace Zaborski) and their mentors (Tom Gallacher and Lyndsey Scott) to look back on their experience of being mentees and mentors at Beamery.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ck6ijD375ukMYu4Oo-giJQ.jpeg" /></figure><h4><strong>Beamery is passionate about mentorship</strong></h4><p><strong>Simon:</strong> Pairing people together to share knowledge and grow is a key part of Beamery’s value to ‘act with kindness’. We were keen to demonstrate to our bootcampers that we live our Beamery values and act on our virtues to ‘make growth a shared responsibility’ and ‘bring out the best in others’.</p><p>We wanted to ensure that the bootcampers felt supported so we paired each trainee with an existing Beamery engineer from the first week of the program. We asked the whole engineering team for volunteers and lots of people were keen to step forward — in fact, we had more mentor volunteers than we had bootcamper mentees!</p><p>This meant that, right from day one of the program, each bootcamper had a key contact and a friendly face at Beamery who they could go to for questions, advice, technical help or just to chat.</p><h4><strong>Simon: What did you think when you found out you would be paired up with a Beamery mentor?</strong></h4><p><strong>Ed:</strong> I thought it was really positive for Beamery to pair us up with experienced engineers as our mentors. I knew that the faculty from <a href="https://academy.tech/">Academy</a> (who ran the bootcamp) would provide support during the course but this was generally in group or class settings where it’s not always easy to ask for help. Having a mentor meant that there would be someone who I could ask ‘silly’ questions, or someone I could ask about a technical topic and discuss it in depth.</p><p><strong>Grace:</strong> For me being brand new to the company, having someone already at Beamery gave me the chance to ask about the company and familiarise myself with the teams and the people across the business before ‘officially’ starting in an engineering team.</p><h4><strong>Simon: What made you want to volunteer to be a mentor?</strong></h4><p><strong>Tom: </strong>Having mentored before, and been a mentee myself in the past, I knew how important and beneficial this interaction can be. As a mentee, it helped me find my feet in a new company with new processes, and it gave me an opportunity to grow and challenge my own development. As a mentor, it offers similar challenges and growth potential. Crucially, I love mentoring as it can provide different perspectives on the day-to-day that can be lost as you progress in your career.</p><p><strong>Lyndsey:</strong> I have really benefited from mentoring at Beamery, as well as outside of the company. The team I joined, when I finished my bootcamp (a couple of years ago), were so great and struck a great balance between being supportive and pushing me. It helped me develop my skills and confidence much more quickly. Outside of work, I had a mentor through <a href="https://codefirstgirls.com/">Code First Girls</a> and I became a mentor myself with them just before the Beamery bootcamp started.</p><p>Discussing things with someone who had gone through the same things as me in their role made me feel heard. And there were definitely situations I found myself in where I wouldn’t have been able to navigate through them as well as I had without a mentor’s guidance — I really wanted to pass that on.</p><h4><strong>Simon: How often did you meet during the program and now it’s over? What did you talk about?</strong></h4><p><strong>Ed: </strong>Tom and I met up weekly during the Academy course between October and January. Mostly, we would catch up on the things we were working on in the bootcamp at the time and Tom would help me with some code examples and explanations to help round out the material. It was great to get a second (much more experienced!) pair of eyes on the code I was writing.</p><p>What I found most helpful was going in depth on something we were covering as part of the course, such as testing. Deciding how best to write tests can be a little subjective, so it was really helpful to be able to ask Tom to explain, with real world examples, how Beamery approaches testing. As well as drawing on his own experience, Tom also suggested useful reading to help fill in any other gaps.</p><p>The engineering team I moved into after the program is very supportive so I get plenty of technical help. Tom and I have kept our one to one meetings, though we now do them fortnightly instead of weekly and they’re often about areas of development — with Tom recommending reading material that would be helpful or a specific technical topic.</p><p><strong>Tom:</strong> As Ed mentioned, we typically met up every week, and we would usually start chatting through anything that was the focus within the Bootcamp that week, diving a bit deeper or discussing how it translated into what Beamery was doing. We would also use the Bootcamp content or problems as a jumping off point to discuss wider best practices on that topic in the industry, calling out the constant balance that is played in order to ensure the engineering approach is reliable and pragmatic.</p><p>Beyond the technical discussions, we would also make time to chat through normal life stuff; a large aspect of the relationship of the mentor/mentee is exactly that — a relationship. It can’t be a chore and must be a safe, supportive place where everyone can grow and overcome problems. As a result of the relationship we built, we still catch up even though the program has now concluded.</p><p><strong>Grace:</strong> During the program, Lyndsey and I had a recurring weekly meeting. Most of the time was spent working through technical problems together but we also discussed other challenges I faced, like exploring my areas of interest, learning about Beamery, feeling more confident as an engineer and exploring ‘Lyndsey-approved’ networks and resources. Now, we still meet ad-hoc whenever I have questions or need support.</p><p><strong>Lyndsey: </strong>Bootcamps can be intense at times so it was really important to me to make just a general safe space in sessions that Grace could come to and speak about whatever was on her mind — be it a technical problem, career stuff or just a general chance to chat or vent.</p><p>We spent most of our time on technical problems or the course content each week. Now the program is over, I am really happy we still get to have ad-hoc sessions where we can still go through anything together or have a catch up and coffee.</p><h4><strong>Simon: What would you say is the best thing about having a mentor?</strong></h4><p><strong>Grace: </strong>Having a mentor has helped me feel really well supported throughout my journey. Having a fellow ex-bootcamper as a mentor especially helped me feel I can always reach out when I needed support.</p><p><strong>Ed: </strong>I agree, having a mentor definitely made me feel supported, and having someone I felt I could go to for help was really important. Tom’s wealth of experience as well as his patience in explaining things meant I got (and still get) loads from our meetings together.</p><h4><strong>Simon: What would you say has been your biggest learning from being a mentor?</strong></h4><p><strong>Lyndsey: </strong>I think realising that everyone will experience a situation differently and to always make sure that they feel seen and heard. Also, striking the balance between “I want to tell you the answer” and “I know you have the ability to find the answer yourself”.</p><p><strong>Tom: </strong>Remembering that as a mentor you have more to offer than just the factual knowledge you have on certain topics. Being able to share your experiences and learnings from your own path and career can be just as — sometimes more — valuable. And for any potential future mentors, especially if you have imposter syndrome that is common in our industry, being a mentor is a great way to push through that barrier to help yourself build confidence in your experiences whilst also helping out mentees grow — and hopefully avoid this — in the future.</p><h4><strong>Simon: What’s next? Will you volunteer to be a mentor in future?</strong></h4><p><strong>Grace: </strong>Absolutely! Starting on a journey to become a software engineer can be very daunting. I would love to pass on everything I have learned on my journey so far to any future mentees. Software engineers come from all backgrounds so I’d also be excited to gain new perspectives and solve new challenges with my future mentees.</p><p><strong>Ed: </strong>Absolutely. After the positive experience I had, I think it’s really important to try and make sure that future bootcampers (and all employees at Beamery) feel supported at the company.</p><p><strong>Tom: </strong>Of course. I find the process very interesting and rewarding, as everyone has different perspectives and thus encounters different challenges. As well as being able to help someone grow and overcome these challenges, it offers a wide range of opportunities to learn and grow as a mentor as well.</p><p><strong>Lyndsey: </strong>Of course! I really loved being part of the bootcamp again and I second what Tom says — I definitely learnt a lot from Grace as her mentor.</p><h4><strong>Simon: What advice would you have for people looking to become a mentor?</strong></h4><p><strong>Tom: </strong>Everyone has something of value to pass on: we can learn something from any experience that we’ve all had in this industry. And the fact that everyone has a different journey is something alone that can be reassuring for mentees to hear.</p><p><strong>Lyndsey:</strong> Don’t worry about not being experienced or qualified enough! I think a lot of people put off mentoring because they feel like they need to know everything. There is almost always good advice or support you can provide to people, so just be honest and be yourself. If you want to get involved, organisations like <a href="https://www.theaccessproject.org.uk/">The Access Project</a>, <a href="https://codebar.io/">Codebar</a>, <a href="https://codingblackfemales.com/programmes?p=cbfmentor2022">Coding Black Females</a>, <a href="https://www.blackvalley.co.uk/get-involved/become-a-mentor">Black Valley</a> and <a href="https://blackcodher.com/mentors">Black Codher</a> (and many others) are always looking for mentors.</p><h4><strong>Simon: What advice would you have for future mentees?</strong></h4><p><strong>Grace:</strong> Always reach out when you’re feeling overwhelmed — your needs don’t have to be technical. A lot of our meetings didn’t involve clear problems or solutions; sometimes it felt more like peer-coaching and it was just helpful to be each other’s sounding boards.</p><p><strong>Ed:</strong> When going into a mentor meeting, it’s worth thinking about areas of interest you could ask about or areas of growth you think you could work on to make sure you get the most from each session and make the best use of your time together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z5AD2Ihbxq0WzTAbmfuFgg.jpeg" /><figcaption>Beamery’s 2021 Bootcampers</figcaption></figure><h4><strong>Looking ahead…</strong></h4><p>The Beamery bootcamp is back in 2023 with a new intake of budding engineers — <a href="https://careers.beamery.com/life-at-beamery/engineering-bootcamp/">find out more and sign up for this year’s program</a>.</p><p>Mentorship, just like other career growth opportunities, such as projects, rotations and learning, are essential to the development of employees. At Beamery, we believe in supporting the development of all our staff, and mentorship is a key component of that goal — but it’s not something only available to our engineering bootcampers. We recently used our own tool, <a href="https://beamery.com/platform/talent-mobility-and-career-navigation">Beamery Grow</a>, to match mentors and mentees in the wider engineering department and saw fantastic interest and engagement across the organisation.</p><p><a href="https://beamery.com/platform/talent-mobility-and-career-navigation">Beamery Grow</a> helps employees easily find and connect with mentors across the company, and it will be able to intelligently recommend mentors to mentees based on their interests and career needs. It also helps employees find all types of development and internal mobility opportunities within a company. We’re excited about the opportunities that Beamery Grow will bring for our people and, by democratising access to mentors for all employees, we are staying true to Beamery’s value to make growth a shared responsibility.</p><p>Interested in joining our Engineering, Product &amp; Design Teams?</p><p>We’re looking for Software Engineers Front &amp; Back Mid/Senior/Director, SRE Platform Engineers, Engineering Managers, Tech Leads, Product Operations/Managers/Designers across all levels and even more roles across London, Remote &amp; Berlin! to join us — <a href="https://careers.beamery.com/?gh_src=ca356c9d3us&amp;utm_source=medium&amp;utm_medium=organicsocial&amp;utm_campaign=edmentorshipblog&amp;utm_term=global&amp;utm_content=blog"><strong>apply here</strong></a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61e401b6dfbf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hacking-talent/making-growth-a-shared-responsibility-through-mentorship-at-beamery-61e401b6dfbf">Making Growth a Shared Responsibility through Mentorship at Beamery</a> was originally published in <a href="https://medium.com/hacking-talent">Beamery Hacking Talent</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Becoming an Engineer after 10 years in Product | Why it’s never too late]]></title>
            <link>https://medium.com/hacking-talent/becoming-an-engineer-after-10-years-in-product-why-its-never-too-late-200b9a4d8bb3?source=rss-2f3b1a8aa5f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/200b9a4d8bb3</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[career-switch]]></category>
            <category><![CDATA[bootcamp]]></category>
            <category><![CDATA[career-change]]></category>
            <dc:creator><![CDATA[Ed Halliwell]]></dc:creator>
            <pubDate>Thu, 24 Mar 2022 11:03:10 GMT</pubDate>
            <atom:updated>2022-03-24T11:03:10.754Z</atom:updated>
            <content:encoded><![CDATA[<p>As I write this at the beginning of 2022, I find myself in the middle of a career change from product manager to software engineer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rSmru-z8_vzF5msSkfUliA.jpeg" /></figure><p>Whilst I was contemplating my career switch, I found surprisingly few articles written about people making this particular transition, so I wanted to share my story in the hope that it helps anyone thinking of making the same change.</p><p>This is my story and my reasons for switching.</p><h3>Why the change?</h3><p>I was a product manager for over 10 years. After university (and a brief stint as an intern), I moved into a product role when I was in my early twenties. This means that almost my whole career so far has been as a product manager. I have been lucky enough to work across multiple industries and companies of different sizes and maturity.</p><p>I loved the varied nature of the job and I am exceedingly grateful for the opportunities it afforded me. When I started out, I loved it — I remember thinking to myself that I couldn’t believe I was being paid to do the job. However, over the past year or two, I have found myself enjoying product management less and less.</p><p>In a cross-functional team, a product manager is less of a ‘player’ but more of an orchestrator, a go-between. I’ve been to a lot of meetings, made a lot of slide decks, spreadsheets and reports, but I am rarely able to point to something and say that ‘I did that’ and that I was fundamental in delivering the value for customers. I had started to feel like a passenger in my team.</p><p>Whilst the role of product is critical to the overall success of a team, I was no longer sure it was right for me. After 10 years, I had risen to Lead Product Manager, probably the top of the individual contributor tree for that role in most companies. I felt like there were two paths in front of me: to push up the chain into management or to continue at around the same level as an individual contributor.</p><p>Neither of these options appealed to me. I love being in the weeds, close to the implementation and seeing products delivered and customer reactions and feedback. I also didn’t feel that people management was something I wanted to do just yet.</p><p>I made a decision that I wanted to make a change and that, in my next role, I really wanted to be closer to the value creation and take ownership and responsibility for making things and building products myself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gdCwa3YK4KrYP7Vc.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@soymeraki">Javier Allegue Barros</a></figcaption></figure><h3>Why engineering?</h3><p>As a product manager, your role is to deeply understand ‘why’ you are building something, but I have always taken an active interest in ‘how’ as well — more active than most product managers perhaps. I love to understand how things fit together, the technologies that were used and know why things were built in the way they were.</p><p>Product management requires time spent on a wide range of concerns such as strategy, customer relationships, positioning and so on. As a result, a typical product manager role would never allow me to spend the time I would like on technology.</p><p>When I started looking into how I could make a change from product to engineering, I found lots of stories of people making the switch from engineering into product management, but found it far less common for product managers to go the other way.</p><p>Whilst some career changes can be achieved through utilising transferable skills and on the job learning, I knew this wouldn’t be the case for me in a change to engineering. My degree is in economics and my experience was almost exclusively product management, so I was missing the ‘hard’ skills required of an engineer.</p><p>Having built my career in product management, I knew that switching would mean going down an uncertain path. Starting at the bottom again and learning to code would mean a significant monetary and time commitment, as well as a serious commitment from myself to see it through.</p><h3>Making the change</h3><p>Having made a decision to explore an engineering career, I knew that I needed to take some purposeful steps to make it happen. To start with, I needed to determine whether engineering was something that I could do, and do well. I also wanted to find out whether it was something I would enjoy doing full time.</p><p>I had dabbled with coding in the past (doing CodeAcademy courses and building some simple websites) but I had never managed to find the time to properly dedicate myself to learning outside of my day job (which, as all product managers will know, can be pretty full on).</p><p>However, in 2020 and 2021, the UK entered a series of lockdowns as a result of the coronavirus pandemic which suddenly left me with a lot of free evenings and weekends. I leapt at the opportunity to use this time to do some courses. I purchased a couple of lengthy Udemy courses for the first time and set about completing over 100 hours of online learning.</p><p><a href="https://www.udemy.com/user/coltsteele/">Colt Steele</a> deserves a huge shout out here. I found his online courses to be excellent and I really connected with his teaching style. It was a slog, but I loved doing those courses and each time I finished a section, I was hungry to move on and learn something new.</p><p>I was fortunate to have friends and former colleagues who are software engineers to speak to about my decision to change. People were really encouraging and pointed me in the right direction for reading and resources. My confidence was growing but I knew I was still a million miles away from being able to apply for a software engineering role.</p><h3>Starting again</h3><p>By the middle of 2021, I felt sure that engineering was the path for me and I was ready to leave my product role at <a href="https://beamery.com/">Beamery</a>. I know a few people who have done paid, bootcamp courses and gone on to start a career in engineering and so I started exploring options and pricing up training courses with the likes of General Assembly and Makers Academy. I knew that a course like that would be the quickest way to kick start my transition and put a significant marker on my CV that I was serious about moving into engineering.</p><p>Beamery was (and still is) growing fast and software engineers are in high demand as the company grows. The company had previously run a graduate program for engineers, which had been a great success.</p><p>When I spoke to my manager at Beamery about my decision, he was really supportive and told me that the company was planning to run another bootcamp later in the year and that I might have the opportunity for a place on it. At this point, I’d worked at Beamery for two years and I had seen a few other folks given opportunities for internal mobility but I’d never considered that it could allow me to transition into engineering.</p><p>I spoke with the engineering leaders and People (HR) team and explained the training I’d done and my intention to change careers. From Beamery’s perspective, I was already very familiar with the product, people and customers and so I hope I represented a known quantity. They were all amazingly supportive and encouraged me to join the four month program which started in October 2021.</p><p>Beamery partnered with <strong>Academy</strong> to carry out the teaching — you can find out more about them <a href="https://academy.tech/">here</a>. The course covered the basics of HTML, CSS and Javascript / Typescript, as well as providing full stack training across React, Node, Express and PostgreSQL.</p><p>One of the big benefits to Academy’s course is having a cohort of students going through the same experience at the same time. It’s been fantastic to have a group to pair with, learn from and collaborate with — it’s made the experience much more enjoyable than any of the solo learning I had done previously.</p><p>I feel really fortunate to be at a company like Beamery that doesn’t just ‘talk the talk’ about providing opportunities for internal mobility, but is also prepared to ‘walk the walk’ and make it happen.</p><p>I am hugely grateful to everyone who worked to make the program a reality and for giving me the opportunity to have a place on it.</p><h3>Looking ahead</h3><p>At the beginning of 2022, I am coming to the end of Academy’s program and I am amazed at how much I’ve learned in a short period of time. I feel privileged to have had the support of Beamery to make my career change, and I have loved every minute of the course.</p><p>I’m really looking forward to making the transition into working in one of Beamery’s engineering teams. I am well aware that I am starting at the bottom of the ladder again but I am keen to get stuck in and keep learning every day. This is just the beginning of my journey in engineering and I’m excited about doing something I love again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*omNTdPgtx9Cz8_by.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@carrier_lost">Ian Taylor</a></figcaption></figure><h3>Interested in joining our Engineering, Product &amp; Design Team?</h3><p>We’re looking for Data Scientists, Software Engineers Front &amp; Back Mid/Senior/Director, SRE Platform Engineers, Engineering Managers, Tech Leads, Product Operations/Managers/Designers across all levels and even more roles across London, Remote, USA &amp; Berlin! to join us — <a href="https://careers.beamery.com/our-teams/engineering-product-and-design/?utm_medium=Organic&amp;utm_source=MediumBlog&amp;utm_campaign=Ed%20Product%20to%20Engineering&amp;utm_term=Careers&amp;utm_content=March23">apply here</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=200b9a4d8bb3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hacking-talent/becoming-an-engineer-after-10-years-in-product-why-its-never-too-late-200b9a4d8bb3">Becoming an Engineer after 10 years in Product | Why it’s never too late</a> was originally published in <a href="https://medium.com/hacking-talent">Beamery Hacking Talent</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Practical Advice for Product Managers Starting a New Role]]></title>
            <link>https://medium.com/@edhalliwell/practical-advice-for-product-managers-starting-a-new-role-33ae9e2aa8cc?source=rss-2f3b1a8aa5f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/33ae9e2aa8cc</guid>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[first-day]]></category>
            <category><![CDATA[new-job-tips]]></category>
            <category><![CDATA[product]]></category>
            <category><![CDATA[new-job]]></category>
            <dc:creator><![CDATA[Ed Halliwell]]></dc:creator>
            <pubDate>Fri, 19 Jul 2019 09:16:42 GMT</pubDate>
            <atom:updated>2019-07-19T09:16:42.921Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sh5uyCdrw2p3f_6RGU_5Ow.jpeg" /></figure><p>Starting a new job can be a daunting prospect. There are new people to meet, a new commute to make and, most importantly, a new coffee machine to work. 😉<br><br>As a product manager, it is crucial that you ramp up quickly and orientate yourself within the team and the business. You can’t sink into the background and hope that others will pick up the slack. Even without a grand title, being a product manager is inherently a strategic role.</p><p>You are the one responsible for the product and you are accountable to the senior stakeholders. You are (almost) always outnumbered by engineers, designers and researchers. Yet people will look to you to be the expert and to guide the team towards providing great products for your customers.<br><br>You need to know your customers, the business, and a whole raft of other areas inside out before you can start adding value. It’s important you get up to speed quickly, but speed isn’t everything. Going deep and being thorough in your first few months will stand you in good stead in the future.</p><p>Being new to a team gives you a golden opportunity to bring a beginners mind, to question assumptions, to ask the dumb questions and to really get to the bottom of how things work.<br><br>If you’re moving into your first product role, you should look for guidance and help from more experienced product people in the company rather than jumping into the list below. Generally speaking, the areas I’ve outlined below are relevant to everyone, but the levels of responsibility expected of you will vary greatly depending on your title, your prior experience and the company structure. <br><br>Having recently started in a new Senior Product Manager role myself, I wanted to put down a few pointers that help me make sure I dig into the right areas and ask the right questions from day one. It’s hard to have a clear priority here but I’d broadly look to tackle the following areas in this order:</p><ul><li>Learn Your <strong>Domain</strong></li><li>Identify Your <strong>Stakeholders</strong></li><li>Understand Your <strong>Customers</strong></li><li>Get to Know Your <strong>Team</strong></li><li>Explore Your <strong>Product Market</strong></li></ul><p>It’s not easy, in fact it’s exhausting — in those first few weeks, I found myself coming home most nights shattered. But because of the joy I took in learning my new space, I woke up each morning energised to dive back in for more.</p><h3>Learn Your Domain</h3><p>The domain, or the industry in which the company sits, will be something that affects everything about the people you meet and the product you build. Context is key and, as a product manager, people will expect you to be a domain expert far sooner than you might think. <br><br>For disciplines outside of product, the need for expert-level domain knowledge is less stringent. Even the very best software engineers cannot be experts in both the industry and in writing great code. And even in the most dedicated cross-functional teams, product is responsible for bringing that context and knowledge to the table. Understanding your industry landscape is something you’ll need to put serious energy into — not just in your first few weeks, but throughout your involvement in it.<br><br>Without a solid grounding in your subject matter, you won’t be able to have in depth conversations with the people around you and with your customers. Being genuinely knowledgable in the field can gain you respect in even the toughest conversations and, more importantly, it will help you make the best decisions to drive your product’s success.<br><br>You may be fortunate and join a company from another in the same industry. Resist the temptation to relax and believe you can trust in your prior knowledge. Your new company (and the people in it) will have a different view on the market and on the customers. It’s still important to do your due diligence and understand the business’s particular niche and positioning within the wider environment. <br><br>However, if you’re starting as a product manager in a new industry it can be a scary case of “where do I even start...?”. <br><br>I recently started a product role in the pharmaceutical sector, with a specific focus on the US market. It’s an industry well recognised for being extremely complex, as well as being highly regulated (which only adds to the complexity). Also, being from the UK, my knowledge of the US healthcare system was limited at best. Having never worked in the pharmaceutical industry before, I knew I was starting from zero. <br><br>I began with some internal stakeholder interviews to get a feel for what our team had been up to so far. Once I understood more about the expectation of stakeholders and our area of focus, I decided my best bet was to spread my net wide and seek out as many sources of information as I could. <br><br>There will be plenty of literature out there: read industry reports, news articles, medium articles, analyst reports, market forecasts, market research, user research, interview write ups and so on. Read internal and external documents. When you interview people internally, ask them to send you anything and everything they have — you never know what research people are sitting on. Ask them what information and data they use to make decisions and ask for access. <br><br>Find and read books related to the industry — ask people for recommendations. Be open to reading as much as you can around the subject. If the founder of your company has written a book — read it. If there’s a book that “everyone in the industry has read” — read it. If there’s a book one of your key stakeholders recommends — read it.<br><br>Read up on other companies (both competitors and partners) in the space. Find out about their history and the history of their products, what sets them apart and what makes them successful (there’s more on this below). <br><br>The team I joined didn’t have a pre-existing archive of domain documentation and, personally, I find that writing up reports on certain topic areas was the best way for me to consume the information available and put it in a form that was easily digestible for myself, and for others. As a result, I started to build up a repository of articles as I worked through my discovery. Gathering the information is not just crucial for yourself, but knowing that others will read it, and are relying on you to make it concise, gives you the impetus to be thorough and produce quality content.<br><br>If the team you join is well established, there might already be a repository of domain information that team members of have built up over time. Obviously, read these but be sure to check when those documents were written and when they were last updated. In most cases, these documents will be a little old — so do the research and update them. <br><br>Remember that the research doesn’t just have to be for your benefit. Find the best way to share what you have learned with your team. This could be formal presentations, summary articles or just informal team conversations. You not only help yourself to skill up but you can help the team keep their knowledge sharp too. And, any subsequent new starters will appreciate your efforts too! 😄</p><h3>Identify Your Stakeholders</h3><p>Product management is still a relatively new discipline and is often defined differently from business to business. This can provide its own challenges as you might find yourself in an organisation with different expectations of product and product management to your own. To get ahead of this issue, it’s important to get a handle on the expectations of the business and senior stakeholders as soon as possible. <br><br>This investigation is best done through face-to-face interviews, and ideally 1:1 so that people can speak freely. If this isn’t possible, I wrote up some thoughts on how best to conduct stakeholder interviews via a call <a href="https://medium.com/@edhalliwell/stakeholder-interviews-what-to-do-when-youre-not-face-to-face-92d37ada483b">here</a>.<br><br>To be honest, it’s important to get a good grasp of what’s expected of you before you join a company. By meeting the right people and asking the right questions at interview stage, you should have a pretty good feel for the product culture you’re about the join before accepting your job offer.</p><p>Even if you’ve spoken to the senior stakeholders before, or if you were interviewed by them, it’s key to have this conversation again once you start. Now that you’re on the same team, you can speak openly and honestly about their expectations. You can also question their answers with more freedom than you could previously.<br><br>Most businesses give you an onboarding ‘buddy’ who will introduce you to team members in your first couple of weeks. If the business you join doesn’t do this, push ahead and appoint one yourself. Your manager is probably best placed to be your onboarding buddy, but any senior advocate will work well. You need a use a bit of their ‘job title clout’ to get meetings set up with a wide range of people quickly, and to ensure people take the meetings seriously (and actually turn up!).</p><p>Try and organise 1-hour long sessions with stakeholders in your first couple of weeks, and prioritise those that have a direct impact or relationship to your team. There are plenty of articles — <a href="https://medium.com/caboodle/5-quick-tips-for-more-effective-stakeholder-interviews-f30c146d4b64">here</a>, <a href="https://insights.dice.com/2016/12/14/tips-conducting-stakeholder-interviews/">here</a>, <a href="https://www.testingtime.com/en/blog/stakeholder-interview-guide/">here</a>, <a href="https://www.userinterviews.com/ux-research-field-guide-chapter/internal-stakeholder-interviews">here</a> and <a href="http://boxesandarrows.com/a-stakeholder-interview-checklist/">here</a> — on how to run an effective stakeholder interview so I won’t labour the point here. The key things are to build rapport and comfort (see Julia Whitney’s <a href="http://www.whitneyandassociates.uk/blog/2017/5/19/zxx1nu8q9lbo0ynh4zec8gex527aii">CREDiT model</a>) so that you can have the most open and honest conversation possible. <br><br>If you can, ask permission to record the sessions with stakeholders instead of taking notes. This will allow the conversation to flow more naturally and you can then listen back and write up your notes afterwards. Before the meeting begins, set expectations and explain why you’d like to record — so you can focus on them and on the discussion. Be clear about who you’ll share the recordings and notes with — building trust is absolutely crucial here. <strong>Never</strong> share those recordings with anyone without explicit permission to do so! <br><br>You can also offer your stakeholder the chance to review your write up. This gives the interviewee an opportunity to correct any misunderstands and censor themselves if they feel something cannot be shared out of the two of you. Having done this recently, people hugely appreciate the opportunity to check your write up. I was expecting people to make big changes to what they’d said but I actually found they changed very little — I think they were more concerned about whether I’d understood them well rather than if they’d said too much!<br><br>Ask people to talk about their goals and how they measure success as well as their blockers and what they think their biggest challenges are within the business. Try and get them to open up about their particular point of view — solid facts are great, but those different perspectives can be interesting to explore too.<br><br>The best place to start is with your line manager. If they’re not already your onboarding ‘buddy’ put some time in to talk to them about their expectations of you and their intentions for your work on the product. Use the first sessions to help frame questions to ask in subsequent stakeholder interviews and where to focus your efforts on domain investigation. <br><br>Also, these 1:1s with your manager can set the tone for how you interact in future and how open you are able to be with them. I believe it’s really important to establish a culture of honest two-way feedback to aid your own development. If you’re not sure where to start with this, I suggest reading <a href="https://www.radicalcandor.com/the-book/">Radical Candour</a> and <a href="https://www.amazon.co.uk/Crucial-Conversations-Tools-Talking-Stakes/dp/0071401946">Crucial Conversations</a> to understand how to engage in these conversations and how to feedback constructively.</p><h3>Understand Your Customers</h3><p>There is no substitute for talking directly to your customers. Get out there and talk to as many existing and potential customers as soon as you can. Don’t wait for a good time to invite them into your office, go to theirs. If there isn’t a good culture of talking to customers in your new company — get scrappy and create one. Don’t rely on second or third party data. You need to meet customers yourself, face-to-face, a lot.<br><br>Depending on your company and your product, you will need to adjust the number of customers you speak to in order to make sure your findings are relevant. The bigger and more complicated your product, the more customers you will need to meet. Also, watch out for any existing processes which prevent or restrict access to customers. In some industries there may be red tape to navigate before you can simply go ahead and reach out to customers. Some of this may be unnecessary but some will certainly be there for a good reason. <br><br>Don’t just focus on your biggest customers or ones that are ‘most friendly’ to talk to either. Focussing on those easily approachable or easily accessible customers will give you a skewed or narrow view, and therefore limit your understanding of your potential addressable market. Make sure you engage with a wide range of customer types and sizes and find those in different locations. Be sure to speak to different seniority levels (personas) at those organisations. Depending on the company (and commonly in B2B), the buyer of your product may not be your end user — but they still both matter.<br><br>There is a wealth of information out there on how to properly engage with customers and how to carry out user interviews — building rapport, avoiding non-leading questions and so on. If you’re not comfortable at doing this, ask a user researcher to help you out. Shadow them and learn these techniques — you will need them. <br><br>When interviewing customers, it can be easy to focus on the positives or the good outcomes. Ensure you ask about pain points and challenges as well. Ask about competitor products or cases where they’re using a number of solutions to achieve their goals (workarounds). All of this will teach you first-hand about the real desires, intentions and practices or your customers. Empathy is key throughout — if you don’t care about your customers and what they’re trying to accomplish then product management might not be for you.<br><br>Although interviews are the best when it comes to gathering customer information, do not forget about analysing data. It said that “data is the plural of anecdote” and, try as you might, you are unlikely to be able to sit down with all your customers in the first few weeks of a new job. Analysing how customers in general as using your products will give you some great insights and assumptions to take forwards and look to validate. Remember that data is great for telling you <strong>what</strong> is happening, but you will need to back it up with user research interviews to properly understand <strong>why </strong>something is happening.</p><h3>Get to Know Your Team</h3><p>A product manager is an orchestrator and a communicator, and no more so with their own team. Whether you’re in a cross-functional group, or one where disciplines are separated but expected to work together, you need to know the people and understand their approach and ways of working. <br><br>For the initial introductions, lean on your onboarding buddy (or you manager) to get those early conversations scheduled. One of the key relationships I look to establish first is with my engineering lead (or leads if you have multiple teams). This person is the gateway to the engineering team and, if they’re good, will be respected and listened to by the rest of the team. They can give you an overview of the work that’s already in progress as well as some insight into how the team is set up and how it’s changed over time. They can also give you some helpful tips on eccentric characters or the plain challenging ones. <br><br>As with building any relationship, empathy is key. Depending on their past experience, teams can be a little wary of new product managers. Due to their strategic viewpoint and influence over prioritisation, product people can too easily force an agenda on the team which may harm morale as well as the long-term quality of the codebase (and thus the product). Don’t play politics or power games — be real, be honest. Look to build rapport and common ground: the end goal and the team’s ultimate purpose should always be about driving success for the customers. <br><br>Look to understand how much the team knows already and what their connection with customer is like. If this appears disjointed or weak, then look for ways you can address it in future. It’s pretty easy to bring engineers along to customer meetings (even just to observe) or make recordings of user interviews easily available for the team to listen back in their own time.<br><br>Work out how hierarchical the structure is and whether sign offs are required (and why). These will all be in place for a reason and finding out why will help you understand the team dynamics better. Identify the key influencers in the team. Who are the people that others in the team look to for guidance or leadership? Make sure you build trust with those people so you can align on priorities and get their buy-in. <br><br>Investigate how the team interacts with other disciplines in the organisation. Keep an eye out for bottlenecks or repeated gripes or issues with other teams. Common issues might include multiple ‘urgent’ requirements pushed on the team by sales, or frequent slow downs when waiting for sign off by legal. Both of these situations will ultimately affect your customer — either through not producing the right things or through being too slow to release. As a result, it is your responsibility as the product manager to own the issues and look for ways to resolve them. <br><br>In these cases, don’t just jump in with a solution. Instead, ask questions and observe. Try to understand why these things happen this way. With your team, explore how you can minimise the effects over the longer term.<br><br>It’s not all about work. Take the time to ask people about their families, hobbies and life outside of work. This background context allows people to see you as human as well as not simply as another colleague. Bringing your whole self to work is only possible once psychological safety is established. If people think you’re holding something back, they will mirror that behaviour. If things work out, you might end up working with these people for years so be open and honest (but still professional).<br><br>It’s usually not appropriate to record these conversations with your own team. Unlike stakeholders, you should have very easy access to your team — if you’re not sat directly next to them, think about moving so that you are. Instead, jot down what you can in the knowledge that you can always ask them again.</p><h3>Explore Your Product Market</h3><p>Last, but by no means least, you need to go deep into your existing product offering. If you can, you should familiarise yourself with the company’s products before your interview. You should to be able to speak purposefully about why the product is something that resonates with you and is something you’re passionate about.<br><br>If you’re joining a B2B company, this pre-research may simply not be possible. These products can be closely guarded and don’t often have free trials available for just anyone to try. That’s ok, but make sure you get access on day one. Again, this should be something your on-boarding buddy can help you with. <br><br>You might be joining a business that doesn’t have a product yet or one that wants to expand into a new area. This is a great opportunity to look not only at competitors but also adjacent products to try and understand more about behaviours and similar interactions. Look for products that have mechanisms that are alike, or those which are achieving a similar goal but in a different industry.<br><br>Whatever situation you find yourself in, put yourself in your customer’s shoes. Go through the whole sign up and login process. As the customer or user of a product, think about what you are trying to get done and how easily is it to accomplish those goals. What value does the product provide and how? What’s great about it and what’s lacking?<br><br>Think about how different customers of different sizes would use the product differently. Think about different personas and think about how the product might appeal differently to different people. Is the product available in other countries? Is it available in different languages? How would you feel if you weren’t a non-English speaker trying to use this tool? What’s that experience like?<br><br>Ask yourself, what would you do if this product wasn’t available? What low-cost workarounds could you think of? Are these easier or is the price tag on your product worth it?<br><br>Whilst you’re meeting people around the company, ask them what they think about the product. What do they like and what do they dislike? What do they think works well and adds value and where do they think urgent attention is required? Expect to find a difference of opinion: those in engineering may tell one story and those in sales or account management may tell a contrary one. <br><br>Find out about your competitors. This can be pretty easy if you’re in a B2C market — you can simply sign up and try out the competition. However, in a B2B setting, as I said above, access to products might be much harder to come by. You might have to get scrappy — use some trials, ask around the team if they have access or any slide decks or screenshots. Your sales and marketing teams are often the best source of this intel. Look at review sites or testimonials. Look for articles or Tweets about competitors too. <br><br>You can (and should) ask your customers about competitors and other systems they’ve used before — but be careful. Remember people might be a bit guarded over what they say and may be under NDA so cannot say anything. Also, keep in mind that whatever you’re doing to find out about the competition, you can bet that there’s another product manager out there trying to find out all about your products.<br><br>This may seem like a lot of questions and a lot of work but it’s important to get this grounding. All of these questions will help to round out your knowledge and deeply understand the setting in which your product exists (or could exist).</p><h3>Good Luck!</h3><p>Starting a new job is daunting and challenging but it’s also hugely rewarding. I love meeting new people and finding out new things. Being fresh faced gives you license to talk to everyone, question assumptions and ask uncomfortable questions.<br><br>The above areas are pointers of where to get started but things might be different at your company. Be open minded and adaptable to your given environment. Seek to learn as much as you can, in any way you can — then share what you know.<br><br>Don’t focus on getting to ‘done’ in these areas — continuous learning and curiosity are fundamental parts of being a product manager. So don’t just look to get to the end, enjoy the journey instead.<br><br>Marty Cagan said <a href="https://www.mindtheproduct.com/2019/06/product-is-hard-by-marty-cagan/">product is hard</a> and he’s right, but it’s also awesome 🚀<br><br>I hope this helps you — have fun and good luck in your new role! 😄</p><p><em>Over to you: What did I miss? What other techniques would you use? What other areas would you explore?</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33ae9e2aa8cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stakeholder Interviews: What to do when you’re not face-to-face?]]></title>
            <link>https://medium.com/@edhalliwell/stakeholder-interviews-what-to-do-when-youre-not-face-to-face-92d37ada483b?source=rss-2f3b1a8aa5f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/92d37ada483b</guid>
            <category><![CDATA[remote]]></category>
            <category><![CDATA[stakeholder-management]]></category>
            <category><![CDATA[interview-tips]]></category>
            <category><![CDATA[phone-interview]]></category>
            <category><![CDATA[stakeholder]]></category>
            <dc:creator><![CDATA[Ed Halliwell]]></dc:creator>
            <pubDate>Fri, 21 Jun 2019 09:28:43 GMT</pubDate>
            <atom:updated>2019-06-21T09:28:43.723Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Eza4lMA8YjQ8C7LwE4p-DQ.jpeg" /></figure><p>Sitting at the intersection of technology, design and the business, a crucial initial step for any product manager is to understand the expectations of key stakeholders <strong><em>before</em></strong> diving headlong into building product. <br> <br>Stakeholders have the power to bestow sponsorship and funding and, once they buy in, can exert great positive influence to help you and your team achieve your goals and drive success. They are experts in their fields, with unique insight, experience and knowledge about the business, the market and the customer. <br> <br>However, whilst stakeholders can be valuable advocates, a mis-alignment or a mis-understanding can quickly lead to lost trust and cut funding. Building good quality relationships across the business allows you and your team to quickly gain a shared understanding of different perspectives and learn how other key players align on goals, contribute to business success as well as mitigate or avoid risks.</p><p>Stakeholder interviews are one of the key items in a Product Manager’s arsenal. They are crucial for building trust and alignment with key players associated to your product. All PMs should carry these out when joining a new business or beginning a new initiative. They usually take the form of a structured, one hour meeting in a 1:1 setting. The aim is to get the interviewee to speak openly and candidly about their desires, constraints and incentives. I find that these sessions often surface things which could easily go unsaid and then have a major impact on decisions made later.<br> <br>Recently I was asked to give some feedback to a team member on their stakeholder interview technique. With our team based in the UK and our stakeholders in the US, a lot of the interviews we are currently doing are being carrying out via a phone call (but sadly not a video call). <br> <br>As I was making notes, I realised that the pointers were just as useful to remind myself of best practices. There are loads of articles on stakeholder interview techniques already, but not so many on how to conduct a good interview remotely. So I decided to put together some thoughts on what I believe constitutes good technique when you’re not face-to-face.</p><p>The key thing to keep in mind is that in-person interactions are <strong>very different</strong> to interactions on a call, particularly one without video. Even if you are a seasoned pro when it comes to face-to-face interviews and tricky conversations, you should adapt your technique when you’re speaking to someone remotely. Changing the way you interact is important to ensure your meaning is not lost, your interviewee remains comfortable and open, and you get real value from your interactions.<br> <br>How many of the following have you used in a conversation to convey meaning above and beyond what you’re saying? Arm waving, nodding your head, making chopping motions with your hands, raising your eyebrows, winking, putting your finger on your nose… Most, if not all, of them — right?<br> <br><strong>None</strong> of these will work on a call. Body language and facial expression are powerful things but are completely useless when you cannot see the person you’re talking to. So what can we do when we don’t have body language, expressions, looks and gestures to fall back on? In the absence of seeing, interviewees will need to hear it, which means:</p><blockquote>You have to <strong>say it</strong>.</blockquote><p>It may seen forced and strange but it’s important to let your interviewee <strong>hear</strong> that you’re listening to them. You can do this in several ways:<br> <br><strong>Vocalise your thoughts and feelings.</strong> If you’re surprised about something and your body’s reaction is to raise your eyebrows, it won’t be seen. You will need to say <em>“that is surprising to me”.</em> Better yet, you need to explain why it’s surprising… is that new information to you (raised eyebrows + wide eyes + head nod) or does that run contrary to something you thought you knew (frown + pursed lips)?<br> <br>Likewise, if you understand and agree with what’s being said, you will need to say <em>“I agree”</em> or <em>“that’s right” </em>out loud because your head nod is going unseen (don’t agree all the time though, we’ll talk about this more later). Again, the ideal would be to follow your affirmation up by clarifying (and saying) exactly what you agree with to remove any doubt. This agreement also helps to build shared understanding and rapport with your interviewee.</p><p>When you’re on a call, remember that <strong>nodding along will not be enough</strong>. You will need to let the interviewee know that you have heard what they’ve said by saying so out loud. Resist the temptation to say “ya huh” and “ok” after every sentence. This practice may work in-person but can easily be disruptive for an interviewee on a call. If you have an even slightly poor internet connection, your affirmations may be heard out of step with your interviewee’s dialogue. This could easily cause them to lose their thought or thread or, worse, force them into truncating their answer to your question — a bad outcome all round. If you find this particularly hard, a little trick here is to put yourself on mute when you’re not talking. This allows you to “ya huh” all you like without being heard.<br> <br>A common trap is to say something like <em>“that’s interesting” — </em>be sure to <strong>clarify why </strong>that’s interesting for you, what gap does it fill in your knowledge, how does that new piece of information build on something else you know? By adding this extra information, it tells the interviewee what is interesting to you and where they should focus their answers. It may also encourage the interviewee to further build on that point and provide even more ‘interesting’ insight for you.<br> <br>Another technique to demonstrate that you are actively listening is to repeat or <strong>paraphrase</strong> an interviewee’s answer. Firstly, this makes it clear that you have been listening to what is being said and, more importantly, that you understand it. It also gives someone the opportunity to correct, clarify or adjust their meaning if they feel your explanation is not on point.<br> <br>Finally, be aware of your surroundings. Ideally, find a quiet room where you can conduct the interview alone without distractions. If things are a little noisy around you be conscious that this could interrupt the interviewee. Put yourself on mute when you’re not talking.</p><p>Aside from these, there are a few other key pointers I recommend for any interviewer, but particularly for interviews carried out via phone.<br> <br><strong>They talk, you listen</strong>. Remember that the purpose of an interview is to get information you don’t already have. You need to strike a balance between building rapport and providing context. However, don’t forget that your key activity during an interview is to <strong>listen</strong>. <br> <br><strong>Don’t cut people off, allow for some silence. </strong>With a phone interview, you cannot see from someone’s body language whether they are finished speaking or not. You also cannot expect the interviewee to be clear and ‘say it’ like you would. Allow for a bit of breathing space between questions to make sure that the interviewee has finished speaking before posing your next question. Remember, if you’re running out of time but still getting a lot of value out of the conversation, don’t rush your final questions. Instead, look to schedule more time with that person to carry on the discussion with the necessary breathing space to talk.<br> <br>When you do speak, <strong>be concise and clear</strong> about what you’re saying. You only have limited call time so use it wisely. You should have a list of questions prepared before the meeting. Ideally a consistent set that you use across all stakeholder interviews. This is helpful but you should not feel like a slave to the questions. To strike a balance, focus on just a handful of key questions that you <strong>must</strong> ask but allow the conversation to flow naturally. If you find yourself rattling off questions from the list, there probably isn’t enough rapport and safety built up to sustain an open and honest conversation. <br> <br>If you think you’ve not been clear, <strong>summarise with clarity.</strong> We’ve all been there… you get going on a point and launch into an explanation, but lose your thread and stumble. You can’t rely on checking the facial expression of you interviewee to know whether they understood what you were saying. Asking <em>“did that make sense?”</em> is a leading question which invites the interviewee to agree even if they don’t. It’s better to stop and clarify the key points of what you’ve said than to leave the interviewee’s understanding up to chance. <br> <br><strong>Say thank you, but not too much.</strong> If you find a particular answer really useful, or if it was challenging for the interviewee to talk about a topic, it’s ok to thank them directly. However, whilst it’s easy to want to thank people for every piece of new information, overdoing your gratefulness can make the conversation feel transactional rather than conversational (like you’re extracting information rather than having a chat). And even worse, if used too much, your thanks can begin to feel insincere. You wouldn’t thank everyone for every sentence they tell you in-person so why do it on the phone!</p><p>It’s important to adjust your technique when carrying out stakeholder interviews which are not face-to-face. I hope this article has provided some useful reminders and techniques to sharpen your game and get more from your interviews. Only with a clear understanding of stakeholder drivers and fears is it possible achieve the best outcomes for your products. So remember…</p><ul><li><strong>Let them hear that you’re listening</strong>: paraphrase and clarify why.</li><li><strong>You have to say it</strong>: Vocalise your thoughts and feelings.</li><li>They talk, <strong>you listen</strong>. Use “ya huh” and “ok” sparingly — remember a poor connection can disrupt the flow.</li><li>Don’t cut people off, <strong>allow for some silence</strong>.</li><li><strong>Be concise and clear</strong>. When that’s not possible, <strong>summarise with clarity</strong>.</li><li><strong>Say thank you, but not too much 🙂</strong></li></ul><p>Is there anything I missed? Do you have any more tips and tricks you use when interviewing people on the phone?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92d37ada483b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>