Louise Persson, Author at ProdSens.live https://prodsens.live/author/louise-persson/ News for Project Managers - PMI Sun, 24 Mar 2024 20:20:51 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://prodsens.live/wp-content/uploads/2022/09/prod.png Louise Persson, Author at ProdSens.live https://prodsens.live/author/louise-persson/ 32 32 Bubble Sort Algorithm in JavaScript https://prodsens.live/2024/03/24/bubble-sort-algorithm-in-javascript/?utm_source=rss&utm_medium=rss&utm_campaign=bubble-sort-algorithm-in-javascript https://prodsens.live/2024/03/24/bubble-sort-algorithm-in-javascript/#respond Sun, 24 Mar 2024 20:20:51 +0000 https://prodsens.live/2024/03/24/bubble-sort-algorithm-in-javascript/ bubble-sort-algorithm-in-javascript

Bubble sort is an algorithm for sorting elements by repeatedly comparing adjacent pairs and swapping them if they…

The post Bubble Sort Algorithm in JavaScript appeared first on ProdSens.live.

]]>
bubble-sort-algorithm-in-javascript

Bubble sort is an algorithm for sorting elements by repeatedly comparing adjacent pairs and swapping them if they are in the wrong order until the entire list is sorted.

We will sort based on ascending order.

How Bubble Sort Works:

  • Traverse from the left and compare adjacent elements and the higher one is placed on the right side.
  • The largest element is moved to the rightmost end at first.
  • Then continue to find the second largest and place it until the data is sorted.

Algorithm:

bubbleSort(array)
  for i <- 1 to indexOfLastUnsortedElement-1
    if leftElement > rightElement
      swap leftElement and rightElement
end bubbleSort

JavaScript Implementation:

let arr = [12, 8, -5, 6, -8, 2];        // input array. 

bubbleSort(arr);            // bubbleSort() function call. 

function bubbleSort(arr){
    let n = arr.length;     // 'n' is array size. 

    for (let j=0; j<n-1; ++j){
        for (let i=0; i<n-j-1; ++i){
            if (arr[i] > arr[i+1]){
                let temp = arr[i];
                arr[i] = arr[i + 1];
                arr[i + 1] = temp;
            }
        }
    }

    console.log(arr);           // Print the Sorted Arry. 
}

Output:

[ -8, -5, 2, 6, 8, 12 ]

How we can optimize the bubble sort algorithm?

All the comparisons are made in the above algorithm even if the array is already sorted. This increases the execution time.
We can optimize by checking if the elements are sorted or not. The value of swapped is set to 1 (true) if there occurs a swapping of elements. Otherwise, it is set to 0 (false).

This will reduce the execution time to optimize the bubble sort.

Optimized Bubble Sort Algorithm

bubbleSort(array)
  swapped <- false
  for i <- 1 to indexOfLastUnsortedElement-1
    if leftElement > rightElement
      swap leftElement and rightElement
      swapped <- true
end bubbleSort
let arr = [12, 8, -5, 6, -8, 2];        // input array. 

bubbleSort(arr);            // bubbleSort() function call. 

function bubbleSort(arr){
    let swapped = 0;        // check if swapping occurs

    let n = arr.length;     // 'n' is array size. 

    for (let j=0; j<n-1; ++j){
        for (let i=0; i<n-j-1; ++i){
            if (arr[i] > arr[i+1]){
                let temp = arr[i];
                arr[i] = arr[i + 1];
                arr[i + 1] = temp;

                swapped = 1;
            }
        }
        // no swapping means the array is already sorted. so no need for further comparison. 
        if (swapped == 0) {
            break;
        }
    }

    console.log(arr);           // Print the Sorted Arry. 
}

Time Complexity: O(N^2)

Thanks for Reading đŸ©”â­

Reference:

https://www.programiz.com/dsa/bubble-sort
https://www.geeksforgeeks.org/bubble-sort/
https://www.geeksforgeeks.org/time-and-space-complexity-analysis-of-bubble-sort/

The post Bubble Sort Algorithm in JavaScript appeared first on ProdSens.live.

]]>
https://prodsens.live/2024/03/24/bubble-sort-algorithm-in-javascript/feed/ 0
Top 7 Featured DEV Posts of the Week https://prodsens.live/2024/03/04/top-7-featured-dev-posts-of-the-week-6/?utm_source=rss&utm_medium=rss&utm_campaign=top-7-featured-dev-posts-of-the-week-6 https://prodsens.live/2024/03/04/top-7-featured-dev-posts-of-the-week-6/#respond Mon, 04 Mar 2024 19:21:09 +0000 https://prodsens.live/2024/03/04/top-7-featured-dev-posts-of-the-week-6/ top-7-featured-dev-posts-of-the-week

Welcome to our curated selection of standout articles from the DEV Community. This week we have a blend…

The post Top 7 Featured DEV Posts of the Week appeared first on ProdSens.live.

]]>
top-7-featured-dev-posts-of-the-week

Welcome to our curated selection of standout articles from the DEV Community. This week we have a blend of personal narratives and technical insights: empowering stories of women in tech, the transformative potential of local LLMs, candid reflections on learning Rust, and more. Plus, we feature a couple of crossover selections from our we_coded campaign celebrating diversity in tech, and we’re excited to introduce four new voices to the Top 7 this week! Don’t miss out — let’s get to reading!

We’re bending our “no listicles in the Top 7 rule” because this article by @amandamartindev is an incredibly pertinent list of women developers to keep up with and we think everyone should take a look! Whether you are looking for content on design, game development, DevRel, or anything in between, Amanda’s got you covered with this comprehensive roundup. #wecoded

This article stands out for its blend of personal anecdotes and practical advice, creating a relatable and actionable guide for remote workers. @krlz‘s conversational tone and meticulous research provide a refreshing perspective on the challenges and opportunities of remote work. Invaluable guidance for thriving in the remote work landscape!

@theoriginalbpc recounts the relatable experience that many devs face: pushing too hard and experiencing burnout. But rather than tuning it out and plowing onward, Sarah listens to her feelings and draws on advice from past role models to find a healthy balance of growth and self-compassion. Don’t miss the last installment in this six-part series! #wecoded

Witness the transformation of generative AI technology from a realm of proprietary models to an open-source landscape, spearheaded by groundbreaking projects like Ollama. Through insightful analysis and hands-on demonstrations, @sarthology illuminates the potential of local LLMs to revolutionize productivity and innovation.

Make sure your software requirements are unambiguous, testable, and measurable with @m4rri4nne! Alicia teaches us the difference between user, system, functional, and nonfunctional requirements and explains the crucial role of clear requirements in maintaining a happy user base and seamless production.

Through candid reflections and practical demonstrations, @link2twenty chronicles their quest to master Rust, sharing the triumphs, challenges, and discoveries along the way. With a blend of personal anecdotes, practical insights, and code demonstrations, this series is a valuable resource for beginners and seasoned developers alike.

Time conversion is a complex and fascinating topic. Here in this quick tutorial, @kecbm walks us through the basics of converting a 12-hour time format to a 24-hour format in JavaScript.

Curious where you can find more of these fantastic articles? You’re in luck! This week’s top picks will also be showcased in our weekly DEV Community newsletter, arriving in your inbox every Tuesday. Make sure you’re opted in đŸš€đŸ“© so you don’t miss out on the best DEV has to offer!

The post Top 7 Featured DEV Posts of the Week appeared first on ProdSens.live.

]]>
https://prodsens.live/2024/03/04/top-7-featured-dev-posts-of-the-week-6/feed/ 0
Hey Devs , Lets code something usefull…. https://prodsens.live/2024/03/03/hey-devs-lets-code-something-usefull/?utm_source=rss&utm_medium=rss&utm_campaign=hey-devs-lets-code-something-usefull https://prodsens.live/2024/03/03/hey-devs-lets-code-something-usefull/#respond Sun, 03 Mar 2024 06:20:43 +0000 https://prodsens.live/2024/03/03/hey-devs-lets-code-something-usefull/ hey-devs-,-lets-code-something-usefull….

Heys Devs (or programmers) You make programs right ? So you may probably use any library or framework…

The post Hey Devs , Lets code something usefull…. appeared first on ProdSens.live.

]]>
hey-devs-,-lets-code-something-usefull….

Heys Devs (or programmers)
You make programs right ?
So you may probably use any library or framework ?
Sometimes that framework is hard to use or installation is not working well …

Then join us (for free)
We are making new libraries tools for developers to make your apps fast !!
This can also improve developer experience…..

AND the best part is everything will be opensource …
You can join us by contributing with us ….
And contribute to the repo with freedevs topic or any other topic tooooo.
Also if you have any idea for us they you can implement it or tell us to make it …..

Now what are you waiting for solve real world problems with us ….

If you have any feedback you can tell us ..
Github; https://github.com/rudransh61/FreeDevs

Our product : https://github.com/rudransh61/NextGenCSS-

The post Hey Devs , Lets code something usefull…. appeared first on ProdSens.live.

]]>
https://prodsens.live/2024/03/03/hey-devs-lets-code-something-usefull/feed/ 0
🏁🐘Winning Race Conditions With PostgreSQL https://prodsens.live/2024/02/17/%f0%9f%8f%81%f0%9f%90%98winning-race-conditions-with-postgresql/?utm_source=rss&utm_medium=rss&utm_campaign=%25f0%259f%258f%2581%25f0%259f%2590%2598winning-race-conditions-with-postgresql https://prodsens.live/2024/02/17/%f0%9f%8f%81%f0%9f%90%98winning-race-conditions-with-postgresql/#respond Sat, 17 Feb 2024 18:20:39 +0000 https://prodsens.live/2024/02/17/%f0%9f%8f%81%f0%9f%90%98winning-race-conditions-with-postgresql/ winning-race-conditions-with-postgresql

Race conditions suck! They can be extremely difficult to debug, and often only occur naturally in production at…

The post 🏁🐘Winning Race Conditions With PostgreSQL appeared first on ProdSens.live.

]]>
winning-race-conditions-with-postgresql

Race conditions suck! They can be extremely difficult to debug, and often only occur naturally in production at the most critical moments (times of high traffic). Fortunately, many databases (such as PostgreSQL) give us powerful tools to manage and avoid race conditions.

In this article, we will do a deep dive into how to avoid race conditions while using PostgreSQL, focusing especially on enforcing uniqueness constraints. We’ll start with some simpler cases, then move onto more complex ones, so feel free to skip down depending on your level of experience.

This article assumes that you are familiar with race conditions, why they happen, and why they suck. (if you aren’t familiar, don’t worry, you will learn the hard way soon enough! We all do.) The later cases also assume at least an upper-intermediate knowledge of relational databases.

This article will use the Node.js pg library for examples.

Let’s just dive right in and look at some different cases where our code and data are vulnerable to race conditions, and find out how to fix them.

Case 1: Simple Uniqueness

Most applications do not allow two users to share the same email. If a user tries to register with an email already registered by another account, registration should fail.

One might write such a uniqueness check in JavaScript like this:

async function registerUser(email, hashedPassword) {
  const existingUserResult = await pool.query(
    'SELECT 1 FROM "user" WHERE email = ?;',
    [email],
  );

  if (existingUserResult.rows.length > 0) {
    throw new Error('User already exists');
  }

  await pool.query(
    'INSERT INTO "user" VALUES (?, ?);',
    [email, hashedPassword],
  );
}

But this code is vulnerable to race conditions. If two users try to sign up at the exact same time with the same email, then it’s possible for a sequence of events like this to happen:

  1. User #1 SELECT operation
  2. User #2 SELECT operation
  3. User #1 INSERT operation
  4. User #2 INSERT operation

Since the SELECT operations happen for both users before the INSERT happens for either one, both users will survive the duplicate-check and proceed to the INSERT operation. The nature of asynchronous programming allows such sequences of events.

Fortunately this problem is really easy to fix, we just need to add a UNIQUE constraint to the email column in the user table. We can do this when creating the table:

CREATE TABLE "user" (
  "email" VARCHAR UNIQUE NOT NULL,
  "hashedPassword" NOT NULL
);

Or later, by using ALTER TABLE.

By setting a UNIQUE constraint on the email column, we are telling the database that no two rows may have the same value for email, and the database itself will enforce this for us. Even if the two INSERTs happen at exactly the same time, concurrency features in the database guarantee that only one will succeed and the other will error.

Case 2: Compound Uniqueness

Let’s say we’re running a multi-user blogging application, like Dev.to, and we want to allow users to create one highlighted post per week. Our posts table might look like this:

CREATE TABLE "posts" (
  "userId" INT NOT NULL,
  "createdAt" TIMESTAMP WITH TIMEZONE NOT NULL,
  "highlighted" BOOLEAN NOT NULL,
  "postContent" TEXT NOT NULL
);

We could write code similar to the first example, with a uniqueness check like this:

const existingWeeklyHighlightedPostResult = await pool.query(
  `
    SELECT 1
    FROM "posts"
    WHERE
      "userId" = ?
      AND
      "highlighted" IS TRUE
      AND
      /* "createdAt" is greater than the first moment
       * of the current week */
      "createdAt" >= DATE_TRUNC('week', NOW());
  `,
  [userId],
);

However this would have the same issue. If a user submits two highlighted posts at the same time, both of them might pass this existence check.

Like last time, can we create a UNIQUE constraint to help us? Yes! Even though we store an exact timestamp rather than the week that a post was created in, PostgreSQL’s support of indexes on expressions gives us what we need. Further, we need to use the partial index feature to only enforce this constraint on highlighted posts:

CREATE UNIQUE INDEX "one_highlighted_post_per_week_constraint"
ON "posts" ("userId", DATE_TRUNC('week', "createdAt"))
WHERE "highlighted" IS TRUE;

With this UNIQUE index, the database will not not allow two rows to both have "highlighted" IS TRUE and to have the same combination of userId, DATE_TRUNC('week', "createdAt"). In other words, a user may only have one highlighted post per week.

For any rows where "highlighted" IS FALSE, they are exempt from this constraint and we can insert as many of them as we want.

Case 3: Compound Multiple Uniqueness

Same case as above, but rather than one highlighted post per week, we want to allow users to make three highlighted posts per week. Can we do this with a UNIQUE constraint like we did above?

Once again, yes, but the solution here may be a bit more convoluted. First, we create the same posts table, but instead of a BOOLEAN highlighted column we add an INT weeklyHighlightedPostNumber column:

CREATE TABLE "posts" (
  "userId" INT NOT NULL,
  "createdAt" TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  "weeklyHighlightedPostNumber" INT,
  "postContent" TEXT NOT NULL
);

If a post is highlighted, then its "weeklyHighlightedPostNumber" will be an integer. If the post is not highlighted, "weeklyHighlightedPostNumber" will be NULL.

Now we add a constraint that forces weeklyHighlightedPostNumber to be a number between 1 and 3, if it’s not NULL:

ALTER TABLE "posts" ADD CONSTRAINT num_weekly_posts_constraint CHECK
(
  ("weeklyHighlightedPostNumber" IS NULL)
  OR
  ("weeklyHighlightedPostNumber" BETWEEN 1 AND 3)
);

Now we can add a UNIQUE constraint:

CREATE UNIQUE INDEX "three_highlighted_posts_per_week_constraint"
ON "posts" (
  "userId",
  DATE_TRUNC('week', "createdAt"),
  "weeklyHighlightedPostNumber"
)
WHERE "weeklyHighlightedPostNumber" IS NOT NULL;

This will enforce that for any highlighted posts (rows with non-NULL "weeklyHighlightedPostNumber"), they may not have the same combination of "userId", DATE_TRUNC('week', "createdAt"), and "weeklyHighlightedPostNumber". Since the earlier constraint requires "weeklyHighlightedPostNumber" to be between 1 and 3, this limits us to 3 highlighted posts per week per user.

This does mean that when inserting a post, you need to figure out the next available post number. We can do this with a bit of SQL in our INSERT operation. This solution also handles gaps (for example if you have three highlighted posts and delete the second one). It does start getting a little hairy, but check it out:

async function createHighlightedPost(userId, content) {
  const insertResult = await pool.query(
    `
      WITH next_highlighted_post_num AS MATERIALIZED (
        SELECT series_num
        FROM GENERATE_SERIES(1, 3) AS series_num
        WHERE NOT EXISTS (
          SELECT *
          FROM posts
          WHERE
            posts."userId" = $1
            AND
            DATE_TRUNC('week', NOW()) <= posts."createdAt"
            AND
            posts."weeklyHighlightedPostNumber" = series_num
        )
        LIMIT 1
      )
      INSERT INTO posts
      SELECT $1, NOW(), series_num, $2
      FROM next_highlighted_post_num;    
      `,
    [userId, content],
  );

  if (insertResult.rowCount === 0) {
    throw new Error('Could not create highlighted post');
  }
}

Of course you could instead just write a simple SELECT query to get all currently existing "weeklyHighlightedPostNumber"s for the given user and current week, and write JavaScript code to choose the new row’s "weeklyHighlightedPostNumber" to INSERT.

Case 4: Compound Referential Uniqueness

This case will be similar to case #2, but instead of “one highlighted post per week”, we’ll modify the condition slightly to “must wait 7 days before making another highlighted post”.

In case #2, if a user makes a highlighted post on a Wednesday, they’re next able to make one at the start of the next week (Monday).

But here in case #4, if a user makes a highlighted post on a Wednesday, they have to wait until the same time next Wednesday before they can make another.

This would require any constraint to reference the user’s previous highlighted post creation date, which is something that typical UNIQUE constraints simply cannot do. To solve this we’ll need to bust out some extra features: transactions and advisory locks.

This will be the final and trickiest case that we look at.

We will use the same table schema as in case #2:

CREATE TABLE "posts" (
  "userId" INT NOT NULL,
  "createdAt" TIMESTAMP WITH TIMEZONE NOT NULL,
  "highlighted" BOOLEAN NOT NULL,
  "postContent" TEXT NOT NULL
);

And here is a solution in JavaScript:

async function createHighlightedPost(userId, content) {
  const postInsertLockNamespace = 5000;
  const queryRunner = await pool.connect();

  try {
    await queryRunner.query('BEGIN TRANSACTION;');

    await queryRunner.query(
      'SELECT PG_ADVISORY_XACT_LOCK(?, ?);',
      [postInsertLockNamespace, userId],
    );

    const existingWeeklyHighlightedPosts = await pool.query(
      `
        SELECT 1
        FROM posts
        WHERE
          "userId" = ?
          AND
          highlighted IS TRUE
          AND
          "createdAt" >= NOW() - INTERVAL '1 week'
      `,
      [userId],
    );

    if (existingWeeklyHighlightedPosts.rows.length > 0) {
      throw new Error(
        'Already have a highlighted post in the previous seven days'
      );
    }

    await queryRunner.query(
      'INSERT INTO "posts" VALUES (?, ?, ?, ?);',
      [userId, new Date(), true, content],
    );

    await queryRunner.query('COMMIT');
  } catch (err) {
    await queryRunner.query('ROLLBACK');
    throw err;
  } finally {
    queryRunner.release();
  }
}

For this to work, anything which is going to modify (INSERT, UPDATE, or DELETE) records in the posts table should first SELECT PG_ADVISORY_XACT_LOCK(5000, userId);. This takes a lock, and any other transaction that tries to take a lock with the same arguments will have to wait for it to be released. If we’re careful to always take this lock before modifying posts, we can trust that after we take the lock, nothing else will modify posts for that user until after we release the lock. This means after we do the SELECT statement to get existingWeeklyHighlightedPosts, we know that the result of that will remain correct until after our INSERT completes and the transaction commits. This effectively prevents a user from submitting a highlighted post if they have already submitted one in the past seven days.

However, it can be hard to make sure that your code is well-behaved and always takes the lock before modifying posts, especially if other developers are working on the same codebase (or some psycho (totally not yourself of course) logs in with pgAdmin and runs random queries!). If anyone does not properly take the lock before inserting, then this approach breaks.

To help a little bit, we can create a trigger that automatically takes the lock whenever you INSERT or UPDATE or DELETE rows in this table. That would look like this:

CREATE FUNCTION "take_post_modify_lock_function"() 
RETURNS TRIGGER
LANGUAGE PLPGSQL
AS $$
BEGIN
  IF OLD."userId" IS NOT NULL THEN
    PERFORM PG_ADVISORY_XACT_LOCK(5000, OLD."userId");
  END IF;

  IF NEW."userId" IS NOT NULL THEN
    PERFORM PG_ADVISORY_XACT_LOCK(5000, NEW."userId");
  END IF;

  RETURN NEW;
END;
$$;

CREATE TRIGGER "take_post_modify_lock_trigger"
BEFORE INSERT OR UPDATE OR DELETE ON "posts"
FOR EACH ROW
EXECUTE PROCEDURE "take_post_modify_lock_function"();

This trigger will force any modification of posts to take the lock, so you don’t need to remember to do it in code when you modify posts.

You do still need to do it in code before SELECTing to verify your constraint condition though. There is no such thing as SELECT triggers, and even if there were, taking the lock would be wasteful for queries that don’t really need to take it (like when you’re fetching a list of posts to display on the homepage). If you don’t take the lock before SELECTing, then someone else might get the lock and do an INSERT before you do the INSERT you’re planning to do based on the results of the SELECT.

SERIALIZABLE Transaction Isolation Level

There’s actually some secret alternative magic sauce that can make this all work without any explicit locking, and that’s the SERIALIZABLE transaction isolation level. Most SQL databases have this, but it’s often a bit different between them. For example PostgreSQL’s version provides much stronger guarantees that MySQL’s version (which can be a little deceptive).

When you use the SERIALIZABLE transaction isolation level and you do a SELECT inside of a transaction, PostgreSQL “remembers” what you SELECTed, and if any data changes before the transaction finishes in a way that would cause your SELECT query to have returned a different result, then your transaction will get a “serialization failure” and have to ROLLBACK.

I cannot stress enough that this is an extremely powerful feature and if you simply switch it on (as the default: ALTER DATABASE SET DEFAULT_TRANSACTION_ISOLATION TO SERIALIZABLE;) and consistently use transactions, then you can write your code without having to think about explicit locking. However there are a number of guidelines and pitfalls you have to be aware of:

  1. Use explicit transactions (BEGIN TRANSACTION; statement) for any operations you do that execute more than one SQL statement (such as the createHighlightedPost() JavaScript function we looked at above).
  2. Avoid running any transactions with lower isolation levels, and be very careful if you do, since it can be harder to reason about how transactions with different isolation levels interact.
  3. Be ready to retry transactions, since you may encounter serialization failures pretty regularly, which is normal and expected.
  4. Keep transactions as short as possible, since having more transactions running at any given time will increase the chance of serialization failures.
  5. Understand that the predicate locking used by SERIALIZABLE transactions does introduce some non-trivial overhead.
  6. Be aware that certain patterns don’t work well under SERIALIZABLE transaction isolation level. For example using SELECT ... FOR UPDATE SKIP LOCKED to implement a highly concurrent queue will not work (you’ll just get bombarded with serialization failures).
  7. Make sure you have indexes that support your queries, since transactions that have to do full table scans can greatly increase the amount of serialization failures.

Conclusion

Sometimes having to worry about race conditions is a “good problem to have”, since it suggests that you have a lot of users using your system. Hopefully they’re paying you!

But as the user base grows, race conditions can cause more and more mysterious and crippling faults, and can sometimes even be caused on purpose by exploiters.

I hope this article gave you some new techniques to deal with these cases, and if you know of any other good ones, please share in the comments!

While writing this, I had a billion ideas for additional cases, footnotes, and asterisks, but couldn’t include it all without making quite a mess. If you have any questions or are interested in additional cases, feel free to comment!

The post 🏁🐘Winning Race Conditions With PostgreSQL appeared first on ProdSens.live.

]]>
https://prodsens.live/2024/02/17/%f0%9f%8f%81%f0%9f%90%98winning-race-conditions-with-postgresql/feed/ 0
Building a cloud backend in Go using REST and PostgreSQL https://prodsens.live/2023/12/18/building-a-cloud-backend-in-go-using-rest-and-postgresql/?utm_source=rss&utm_medium=rss&utm_campaign=building-a-cloud-backend-in-go-using-rest-and-postgresql https://prodsens.live/2023/12/18/building-a-cloud-backend-in-go-using-rest-and-postgresql/#respond Mon, 18 Dec 2023 13:25:21 +0000 https://prodsens.live/2023/12/18/building-a-cloud-backend-in-go-using-rest-and-postgresql/ building-a-cloud-backend-in-go-using-rest-and-postgresql

TL;DR This guide shows you how to build and deploy and Go backend for a URL Shortener. It’s…

The post Building a cloud backend in Go using REST and PostgreSQL appeared first on ProdSens.live.

]]>
building-a-cloud-backend-in-go-using-rest-and-postgresql

TL;DR

This guide shows you how to build and deploy and Go backend for a URL Shortener. It’s made up of a single service with a REST API, and uses a PostgreSQL database.

To get our Go backend up and running in the cloud in just a few minutes, we’ll be using Encore — a backend development platform that automates infrastructure.

🚀 What’s on deck:

  • Install Encore
  • Create your service and endpoints
  • Add a SQL database
  • Run locally
  • Deploy to Encore’s free development cloud

🏁 Let’s go!

To make it easier to follow along, we’ve laid out a trail of croissants to guide your way.

Whenever you see a đŸ„ it means there’s something for you to do!

đŸ’œ Install Encore

Install the Encore CLI to run your local environment:

  • macOS: brew install encoredev/tap/encore
  • Linux: curl -L https://encore.dev/install.sh | bash
  • Windows: iwr https://encore.dev/install.ps1 | iex

đŸ–„ Create your Encore app

đŸ„ Create a new application by running encore app create and selecting Empty app as the template.

🔹 Create a service and API endpoint

Now let’s create a new url service.

đŸ„ In your application’s root folder, create a new folder url and create a new file url.go that looks like this:

package url

import (
    "context"
    "crypto/rand"
    "encoding/base64"
)

type URL struct {
    ID  string // short-form URL id
    URL string // complete URL, in long form
}

type ShortenParams struct {
    URL string // the URL to shorten
}

// Shorten shortens a URL.
//encore:api public method=POST path=/url
func Shorten(ctx context.Context, p *ShortenParams) (*URL, error) {
    id, err := generateID()
    if err != nil {
        return nil, err
    }
    return &URL{ID: id, URL: p.URL}, nil
}

// generateID generates a random short ID.
func generateID() (string, error) {
    var data [6]byte // 6 bytes of entropy
    if _, err := rand.Read(data[:]); err != nil {
        return "", err
    }
    return base64.RawURLEncoding.EncodeToString(data[:]), nil
}

This sets up the POST /url endpoint. Note the //encore:api annotation on the Shorten function, this is all Encore needs to understand that this is an API endpoint, and it will automatically generate the code necessary to expose it.

🏁 Run your app locally

đŸ„ Let’s see if it works! Start your app by running encore run.

You should see this:

Image description

You’ll also see the Local Dev Dashboard (localhost:9400) open in a new tab. It gives you access to Encore’s API explorer, Local tracing, architecture diagrams, and Service Catalog.

Local Dev Dash

đŸ„ Next, call your endpoint:

You can do this from the API explorer in the Dev Dashboard, or from your terminal like so:

curl http://localhost:4000/url -d '{"URL": "https://encore.dev"}'

You should see this:

{
  "ID": "5cJpBVRp",
  "URL": "https://encore.dev"
}

🎉 It works!

There’s just one problem…

Right now, we’re not actually storing the URL anywhere. That means we can generate shortened IDs but there’s no way to get back to the original URL! We need to store a mapping from the short ID to the complete URL.

đŸ’Ÿ Save URLs in a database

Encore makes it really easy to set up a PostgreSQL database to store our data. To do so, we first define a database schema, in the form of a migration file.

đŸ„ Create a new folder named migrations inside the url folder. Then, inside the migrations folder, create an initial database migration file named 1_create_tables.up.sql. The file name format is important (it must start with 1_ and end in .up.sql).

đŸ„ Add the following contents to the file:

CREATE TABLE url (
    id TEXT PRIMARY KEY,
    original_url TEXT NOT NULL
);

đŸ„ Next, go back to the url/url.go file and import the encore.dev/storage/sqldb package by modifying the import statement to become:

import (
    "context"
    "crypto/rand"
    "encoding/base64"

    "encore.dev/storage/sqldb"
)

đŸ„ Then let’s tell Encore we need a database by adding the following to the end of url/url.go:

// Define a database named 'url', using the database
// migrations  in the "./migrations" folder.
// Encore provisions, migrates, and connects to the database.

var db = sqldb.NewDatabase("url", sqldb.DatabaseConfig{
    Migrations: "./migrations",
})

đŸ„ Now, to insert data into our database, let’s create a helper function insert:

// insert inserts a URL into the database.
func insert(ctx context.Context, id, url string) error {
    _, err := db.Exec(ctx, `
        INSERT INTO url (id, original_url)
        VALUES ($1, $2)
    `, id, url)
    return err
}

đŸ„ Lastly, we can update our Shorten function to insert into the database:

//encore:api public method=POST path=/url
func Shorten(ctx context.Context, p *ShortenParams) (*URL, error) {
    id, err := generateID()
    if err != nil {
        return nil, err
    } else if err := insert(ctx, id, p.URL); err != nil {
        return nil, err
    }
    return &URL{ID: id, URL: p.URL}, nil
}

🚹 Before running your application, make sure you have Docker installed and running. (It’s required to locally run Encore applications with databases.)

đŸ„ Next, start the application again with encore run and Encore automatically sets up your database.

đŸ„ Now let’s call the API again:

curl http://localhost:4000/url -d '{"URL": "https://encore.dev"}'

đŸ„ Finally, let’s verify that it was saved in the database.

Do this by looking at the trace that was automatically captured by Encore, available in the Local Dev Dashboard at localhost:9400.

Trace

🔹 Add an endpoint to retrieve URLs

To complete our URL shortener API, let’s add the endpoint to retrieve a URL given its short id.

đŸ„ Add this endpoint to url/url.go:

// Get retrieves the original URL for the id.
//encore:api public method=GET path=/url/:id
func Get(ctx context.Context, id string) (*URL, error) {
    u := &URL{ID: id}
    err := db.QueryRow(ctx, `
        SELECT original_url FROM url
        WHERE id = $1
    `, id).Scan(&u.URL)
    return u, err
}

Encore uses the path=/url/:id syntax to represent a path with a parameter. The id name corresponds to the parameter name in the function signature. In this case, it’s of type string, but you can also use other built-in types like int or bool if you want to restrict the values.

đŸ„ Let’s make sure it works by calling it (remember to change the id to the one you found when looking at the trace in the last step):

curl http://localhost:4000/url/zr6RmZc4

You should now see this:

{
  "ID": "zr6RmZc4",
  "URL": "https://encore.dev"
}

🎉 And there you have it! That’s how you build REST API and use PostgreSQL databases in Encore.

🚀 Deploy to the cloud

Now let’s commit all our changes to the project repo and deploy our app.

đŸ„ Commit the new files to the project’s git repo and trigger a deploy to Encore’s free development cloud by running:

$ git add -A .
$ git commit -m 'Initial commit'
$ git push encore

Encore will now build and test your app, provision the needed infrastructure, and deploy your application to the cloud.

After triggering the deployment, you will see a URL where you can view its progress in Encore’s Cloud Dashboard.👈

It will look something like: https://app.encore.dev/$APP_ID/deploys/...

From there you can also see metrics, traces, and connect your own AWS or GCP account to use for production deployment.

🎉 Great job – you’re done!

You now have the start of a scalable Go backend app running in the cloud, complete with PostgreSQL database.

Keep building with these Open Source App Templates.👈

If you have questions or want to share your work, join the developers hangout in Encore’s community Slack.👈

The post Building a cloud backend in Go using REST and PostgreSQL appeared first on ProdSens.live.

]]>
https://prodsens.live/2023/12/18/building-a-cloud-backend-in-go-using-rest-and-postgresql/feed/ 0
Introducing Read Replicas https://prodsens.live/2023/12/15/introducing-read-replicas/?utm_source=rss&utm_medium=rss&utm_campaign=introducing-read-replicas https://prodsens.live/2023/12/15/introducing-read-replicas/#respond Fri, 15 Dec 2023 16:24:32 +0000 https://prodsens.live/2023/12/15/introducing-read-replicas/ introducing-read-replicas

Today, we are launching support for Postgres Read Replicas. You can use Read Replicas to: Distribute load across…

The post Introducing Read Replicas appeared first on ProdSens.live.

]]>
introducing-read-replicas

Today, we are launching support for Postgres Read Replicas. You can use Read Replicas to:

  1. Distribute load across various databases.
  2. Serve data closer to your users.
  3. Provide data redundancy.
  4. Run complex queries without affecting your primary database.

You can create read replicas in any of our 12 supported regions. To start, each project supports up to two replicas.

What are Read Replicas?

Read replicas continuously, well, replicate data from a primary database. It contains a constantly-updated copy of the data in the Primary.

You can both read and write data on the Primary database. You can only read, on a Read Replica:

select insert update delete
Primary ✅ ✅ ✅ ✅
Read Replica ✅

Replication is asynchronous. It happens in the background so that transactions aren’t blocked on the primary. The delay between writing data to the primary and the read replica receiving the change is called replication lag.

Why Read Replicas?

To scale your database, you have two choices: horizontal scaling and vertical scaling. Vertical scaling involves adding more RAM and CPU to your existing server. Our 16XL compute add-on has 64 cores CPU and 256 GB RAM – sufficient for almost any well-architected workload.

However, certain workloads may push against the CPU and memory limits of a single server. There’s a limit to how much you can scale vertically. Most cloud providers do not provide instances larger than our 16XL specifications.

This is where horizontal scaling is useful. You can add read replicas to scale more easily. Instead of a single database handling all of your traffic, you can split the traffic across multiple databases.

Compute Size
Our read replicas will inherit the compute size of its primary. They will eventually scale independently.

Read replicas are great for reducing the load on your primary database. For instance, you can designate one of your read replicas for analytical tasks. This way, a runaway query in a read replica won’t impact the primary.

One of the best features of read replicas is that you can launch them in a different region from your primary. This moves the data closer to your users – querying the nearest read replica for data minimizes overall application latency. We are working on making this easier, stay tuned!

The main drawback of horizontal scaling is complexity. Typically, you need to manage replication lag, handle recovery when a replica fails, and implement some level of application level changes to fully utilize the read replica. In line with our promise to “make Postgres simpler for developers”, we have handled most of that complexity for you:

Using Read Replicas

You can manage and visualize read replicas from the infrastructure settings page.

Read replicas

In the SQL editor, you can choose if you want to run the query on the primary or one of the read replicas.

Read replicas

To make use of your read replicas, copy your connection string for the read replica, update your apps to use the new read replica and you are done! A unique connection pool is also provisioned for each read replica via Supavisor.

Each replica also has its own associated instance of PostgREST, a Data API for REST and GraphQL. You can directly access each PostgREST instance, similar to connecting to a specific read replica. Alternatively, we offer a load-balancing endpoint which uses a round-robin strategy to route to each of the PostgREST instances.

Implementation

Postgres offers various methods to replicate data, each with trade-offs. We use the following native methods:

Streaming replication

Postgres generates a Write Ahead Log (WAL) as database changes occur. With streaming replication, these changes stream from the primary to the read replica server. The WAL alone is sufficient to reconstruct the database to its current state.

This replication method is fast, since changes are streamed directly from the primary to the read replica. On the other hand, it faces challenges when the read replica can’t keep up with the WAL changes from its primary. This can happen when the read replica is too small, running on degraded hardware, or has a heavier workload running.

To address this, Postgres does provide tunable configuration, like wal_keep_size, to adjust the WAL retained by the primary. If the read replica fails to “catch up” before the WAL surpasses the wal_keep_size setting, the replication is terminated. Tuning is a bit of an art – the amount of WAL required is variable for every situation.

File-based Log shipping

In this replication method, the primary continuously buffers WAL changes to a local file and then sends the file to the read replica. If multiple read replicas are present, files could also be sent to an intermediary location accessible by all. The read replica then reads the WAL files and applies those changes. There is higher replication lag than streaming replication since the primary buffers the changes locally first. It also means there is a small chance that WAL changes do not reach read replicas if the primary goes down before the file is transferred. In these cases, if the primary fails a replica using streaming replication would (in most cases) be more up-to-date than a replica using file-based log shipping.

File-Based Log shipping đŸ€ Streaming replication

We use a hybrid approach to address the limitations of each method.

Diagram

Streaming replication minimizes replication lag, while file-based log shipping provides a fallback. For file-based log shipping, we use our existing Point In Time Recovery (PITR) infrastructure. We regularly archive files from the primary using WAL-G, an open source archival and restoration tool, and ship the WAL files to S3.

We combine it with streaming replication to reduce replication lag. Once WAL-G files have been synced from S3, read replicas connect to the primary and stream the WAL directly.

What’s coming

Automatic Failover

With automatic failovers, a read replica is promoted to be the primary if the primary is unhealthy. This feature is currently only available on our enterprise plan. However, we are planning to extend this to all paid plans. The introduction of self-serve read replicas is a step in that direction.

Geo-based load balancing

Currently, we have implemented a round-robin strategy of routing PostgREST requests to the different databases. This is useful for sharing the load across the primary and the read replica, but in cases where latency is important, you might want to always route to the closest database instead.

Supabase Products leveraging Replicas

We are working on support for database-level load balancing through Supavisor. When routing database traffic through Supavisor, it routes write queries to the primary and splits read queries between the primary and read replica. This distributes load to all your databases without any changes to your application. Other Supabase products like Auth, Storage, and Realtime use the database heavily. We are working on adding read replica support to these products, so that they can leverage the read replica when appropriate. This means they won’t just query the primary but will also use the read replica’s compute when possible.

Pricing and Availability

Read replicas are priced like regular databases for compute and storage. There is also a per-GB cost for WAL transfer between the primary and read replica. The total price is the sum of:

  • The compute instance of the read replica. The compute hours used by your read replica will be added to the total compute hours used by your organization and charged at the same rate.
  • The disk size of the read replica will be charged at the same rate of 0.125$ / GB
  • Any WAL transfer between the primary and read replica will be charged at 9c / GB

Sign-ups for early access of self-serve Read Replica support are now open. Following which we will progressively rollout self-serve Read Replica support to all paid plans over the next few months.

More Launch Week X

The post Introducing Read Replicas appeared first on ProdSens.live.

]]>
https://prodsens.live/2023/12/15/introducing-read-replicas/feed/ 0
20 ways for Developers to boost income 💰 https://prodsens.live/2023/11/20/20-ways-for-developers-to-boost-income-%f0%9f%92%b0/?utm_source=rss&utm_medium=rss&utm_campaign=20-ways-for-developers-to-boost-income-%25f0%259f%2592%25b0 https://prodsens.live/2023/11/20/20-ways-for-developers-to-boost-income-%f0%9f%92%b0/#respond Mon, 20 Nov 2023 18:25:03 +0000 https://prodsens.live/2023/11/20/20-ways-for-developers-to-boost-income-%f0%9f%92%b0/ 20-ways-for-developers-to-boost-income-

Being a developer opens up a plethora of opportunities not just to enhance your skills but also to…

The post 20 ways for Developers to boost income 💰 appeared first on ProdSens.live.

]]>
20-ways-for-developers-to-boost-income-

Being a developer opens up a plethora of opportunities not just to enhance your skills but also to pad your bank account. Whether you’re a seasoned coder or just starting your coding journey, here are 20 creative ways to bring in extra cash.

1. Freelance Development Projects

Embark on the world of freelancing by offering your skills to a global clientele. Platforms like Upwork, Freelancer, and Toptal can connect you with exciting projects.

  • Upwork: Offer your skills in web development, app development, or specialized areas.
  • Freelancer: Find opportunities to work on various projects with a global client base.
  • Toptal: Connect with top clients and work on high-quality projects.

Explore freelancing platforms like Upwork to offer your coding skills and land projects like developing custom plugins or creating mobile app prototypes.

2. Create and Sell Digital Products

Monetize your expertise by creating and selling digital products. Platforms like Gumroad, Teachable, and Udemy provide avenues for sharing your knowledge.

  • Gumroad: Sell digital products like e-books, courses, and software tools.
  • Teachable: Build and sell online courses to a global audience.
  • Udemy: Share your knowledge through video courses on a variety of tech topics.

Utilize platforms like Gumroad to sell a range of digital products, from e-books on advanced JavaScript to comprehensive online courses.

3. Participate in Bug Bounty Programs

Enhance your skills in ethical hacking by joining bug bounty programs. Platforms like HackerOne, Bugcrowd, and Synack connect you with companies seeking security experts.

  • HackerOne: Join bug bounty programs to identify and report security vulnerabilities.
  • Bugcrowd: Engage with companies looking to secure their software through bug bounties.
  • Synack: Connect with companies seeking ethical hackers to enhance their security posture.

Dive into platforms like HackerOne, where you can contribute your cybersecurity skills by identifying and reporting security vulnerabilities.

4. Start a Coding Blog or YouTube Channel

Share your coding journey and insights through a blog or YouTube channel. Monetize through platforms like Medium Partner Program, Dev.to, and YouTube Partner Program.

  • Medium Partner Program: Share your knowledge and insights through a blog or YouTube channel. Monetize through ads, sponsorships, or affiliate marketing.
  • Dev.to: Build a community around your coding journey. Monetize through the Dev.to partner program.
  • YouTube Partner Program: Monetize your coding tutorials and content on YouTube.

5. Remote Tech Support

Offer remote tech support services through platforms like Support.com, Geek Squad, and HelloTech. Help individuals and businesses troubleshoot tech issues.

  • Support.com: Offer remote tech support services for individuals or small businesses.
  • Geek Squad: Provide tech support services through Geek Squad.
  • HelloTech: Offer on-demand tech support services with HelloTech.

6. Participate in Paid Online Surveys for Developers

Share your opinions on developer-related topics and earn extra cash. Platforms like Survey Junkie, Swagbucks, and Vindale Research offer paid online surveys.

  • Survey Junkie: Share your opinions on developer-related topics and get paid.
  • Swagbucks: Participate in paid online surveys and earn Swagbucks.
  • Vindale Research: Get paid for participating in online surveys with Vindale Research.

7. Develop and Sell WordPress Themes or Plugins

Create and sell WordPress themes or plugins on platforms like ThemeForest, Elegant Themes, and CodeCanyon. Cater to the vast WordPress user base.

  • ThemeForest: Create and sell WordPress themes or plugins.
  • Elegant Themes: Design and sell WordPress themes with Elegant Themes.
  • CodeCanyon: Develop and sell WordPress plugins on CodeCanyon.

8. Affiliate Marketing for Tech Products

Promote tech products you love and earn a commission through affiliate marketing. Join programs like Amazon Associates, ShareASale, and Commission Junction.

  • Amazon Associates: Promote tech products you love and earn a commission through affiliate marketing.
  • ShareASale: Join ShareASale to access a wide range of affiliate programs.
  • Commission Junction: Explore tech-related affiliate programs on Commission Junction.

9. Online Tutoring or Coding Bootcamp Instructor

Share your coding skills by becoming an online tutor or instructor. Join platforms like Chegg Tutors, Udacity, and edX to connect with students.

  • Chegg Tutors: Share your coding skills by becoming an online tutor.
  • Udacity: Teach coding skills through Udacity’s online courses.
  • edX: Become an instructor for coding courses on edX.

10. Sell Stock Photos for Tech Websites

Contribute tech-related stock photos to platforms like Shutterstock, Adobe Stock, and Getty Images. Showcase your creativity.

  • Shutterstock: Contribute tech-related stock photos to Shutterstock.
  • Adobe Stock: Sell tech-themed stock photos on Adobe Stock.
  • Getty Images: Submit your tech-related photos to Getty Images.

11. Develop Mobile Apps or Games

Monetize your coding skills by creating and monetizing mobile apps or games. Join programs like Apple Developer Program, Google Play Console, and Amazon Appstore.

12. Host Webinars or Online Workshops

Organize webinars or online workshops to teach specific skills or share industry insights. Charge participants a fee for attending.

13. Consulting Services for Startups

Offer consulting services to startups looking for technical expertise. Platforms like Clarity.fm, Consulting.com, and Catalant connect you with potential clients.

  • Clarity.fm: Offer consulting services to startups looking for technical expertise.
  • Consulting.com: Join a platform connecting consultants with clients.
  • Catalant: Offer freelance consulting services through Catalant.

14. Sell Code Snippets or Templates

Create and sell reusable code snippets or templates on platforms like CodeCanyon, GitHub Marketplace, and Bitbucket Marketplace. Simplify coding for others.

15. Participate in Remote Hackathons

Engage in remote hackathons and competitions on platforms like Devpost, CodeSignal, and Topcoder. Showcase your coding prowess and win cash prizes.

  • Devpost: Engage in remote hackathons and competitions.
  • CodeSignal: Join coding challenges on CodeSignal to win cash prizes.
  • Topcoder: Participate in coding challenges and competitions, demonstrating your coding prowess and potentially earning cash prizes.)

16. Write Technical Documentation

Offer your expertise in technical writing by creating documentation for software products. Platforms like Write for DOnations can connect you with projects requiring technical documentation.

  • Write for DOnations: Offer technical writing services by creating documentation for software products.

17. Build and Flip Websites

Invest your coding skills in developing websites, optimize them, and sell for a profit. Platforms like Flippa provide a marketplace for buying and selling websites.

  • Flippa: Develop websites, optimize them, and sell them for a profit.

18. Offer Code Review Services

Help fellow developers improve their code by offering code review services. Platforms like Codementor connect experienced developers with those seeking code reviews.

  • Codementor: Help fellow developers improve their code by offering code review services.

19. Create and Sell Merchandise

Design and sell merchandise related to coding on platforms like Printful. Showcase your creativity and cater to the coding community.

  • Printful: Design and sell developer-themed merchandise.

20. Join Freelance Coding Challenges

Participate in coding challenges on platforms like Topcoder to win cash prizes. Showcase your coding skills and compete with developers worldwide.

  • Topcoder: Participate in coding challenges and competitions, demonstrating your coding prowess and potentially earning cash prizes.

Conclusion

Diversifying your income streams as a developer not only brings in extra cash but also enhances your skills and expands your professional network. Whether you choose freelancing, create digital products, or participate in coding challenges, these avenues can help you prosper while doing what you love. Happy coding and earning! đŸ’»đŸ’°

The post 20 ways for Developers to boost income 💰 appeared first on ProdSens.live.

]]>
https://prodsens.live/2023/11/20/20-ways-for-developers-to-boost-income-%f0%9f%92%b0/feed/ 0
Technical Product Manager: Exploring Their Role and Responsibilities https://prodsens.live/2023/11/20/technical-product-manager-exploring-their-role-and-responsibilities/?utm_source=rss&utm_medium=rss&utm_campaign=technical-product-manager-exploring-their-role-and-responsibilities https://prodsens.live/2023/11/20/technical-product-manager-exploring-their-role-and-responsibilities/#respond Mon, 20 Nov 2023 18:24:54 +0000 https://prodsens.live/2023/11/20/technical-product-manager-exploring-their-role-and-responsibilities/ technical-product-manager:-exploring-their-role-and-responsibilities

What is a technical product manager? This is the question that opens our discussion of technical product management.…

The post Technical Product Manager: Exploring Their Role and Responsibilities appeared first on ProdSens.live.

]]>
technical-product-manager:-exploring-their-role-and-responsibilities

What is a technical product manager?

This is the question that opens our discussion of technical product management.

We also look at:

  • The differences between a technical and regular product manager
  • Their responsibilities
  • The qualities and skills that you need to make it as a technical PM
  • How Userpilot can help technical product managers achieve their goals

Let’s get right into it!

TL;DR

  • Technical product managers work with engineering and development teams on the technical performance of software products.
  • While product managers are more customer and business-centric, technical PMs focus on the technical development and implementation of solutions.
  • TPMs are responsible for market and customer research, but their main focus is on satisfying market needs from a technical point of view.
  • Tech PMs work actively with product teams on the product vision and strategy.
  • A big part of their job is managing the roadmap and prioritizing technical initiatives in the product backlog.
  • Technical PMs play an important role in helping the development and product team gain a shared understanding of the product goals and technical requirements.
  • Their technical expertise allows them to identify risks and develop effective mitigation strategies.
  • Technical product managers are also responsible for running experiments and collecting customer feedback to inform future iterations.
  • To become a TPR you don’t need a degree in software engineering, but it will definitely help. However, you need the right mix of technical and leadership skills.
  • The technical skills include a solid understanding of software development and system architecture.
  • Other important skills and qualities of TPRs are business sense, strategic thinking, communication and negotiation, empathy, and charisma.
  • Userpilot is a digital adoption platform with analytics, feedback, and engagement features. Book the demo to see how it can help your technical product managers.

What is a technical product manager?

Technical product managers (TPMs) are professionals with advanced technical and design skills that enable them to lead engineering teams and collaborate with their cross-functional colleagues to ensure product success from the technical point of view.

They usually have a technical background, which gives them a more nuanced understanding of technical solutions and their feasibility. It also equips them with the skills necessary to deal with technical issues and problems.

Technical product managers vs. product managers

Regular and technical PMs usually work together at all stages of the product management process, but their roles focus on different aspects of product development.

Regular product managers are more customer-centric in their approach.

Their focus is on understanding customer needs, shaping product vision and product strategy, bringing the product to the market, and driving its business success.

A technical product manager is involved in what’s under the hood.

They deal with the technical nitty-gritty of product development, like technical specs. They work closely with the design and engineering team on how to best implement the ideas generated by the product team.

The responsibilities of the technical product manager role

So what do technical product managers actually do?

Let’s have a quick look at their main responsibilities.

Conduct market research to identify gaps

Market research is one of the key TPM responsibilities.

The goal is to assess the current situation in the market and competitive landscape focusing in particular on unmet customer needs.

However, in contrast to a regular product manager, technical product managers may spend less time directly interviewing customers and more time working out the technical feasibility and implications of customer requirements.

They use their technical expertise to translate market findings into actionable product specifications, ensuring that the product is both technically viable and meets the market’s demands.

Technical product managers can use in-app surveys for market and customer research
In-app survey created in Userpilot.

Develop and execute the product vision and strategy

Based on the market, customer, and competitor research, TPMs work with product managers to define a clear and compelling product vision.

This vision outlines what the product should achieve and its long-term goals. It serves as a guiding light for the entire development process.

Once the vision is established, tech product managers help formulate a product strategy that outlines how to develop, market, and position the market.

technical product manager responsibilities include developing Product vision and strategy
Product vision.

Create and manage the product roadmap

TPMs work with product managers to create and maintain a roadmap that aligns technical initiatives with product goals and market needs.

This means setting milestones, timelines, and deliverables for the technical components of the product and managing interdependencies to avoid bottlenecks and delays.

In particular, they play an important role in the prioritization of technical initiatives and backlog items that best support product strategy.

technical product manager responsibilities include developing Product roadmap
Product roadmap.

Align the development team with the product team

Technical product managers play a crucial role in aligning the development team with the product team to ensure a shared understanding of the product’s direction throughout the development lifecycle.

They act as intermediaries, translating the product vision and strategy set by the product team into actionable technical requirements that the development team can understand and execute.

This bridges the gap between the technical and non-technical aspects of the project, ensuring that everyone is working toward the same goals.

The communication works both ways.

Technical PMs help the product teams understand the technical challenges and constraints involved in the development of particular features.

Finally, TPMs monitor progress and serve as a point of contact for any technical questions or concerns from the development team.

Identify and mitigate risks in technical product management

As TPMs have a deep understanding of the technical aspects of the product, they can proactively identify potential risks.

By assessing the feasibility of technical solutions, evaluating technical debt, and anticipating challenges, they can help the product team prepare and address potential issues before they become critical roadblocks.

Having identified the risks, they work closely with cross-functional teams to develop risk mitigation strategies. They also help create contingency plans to address unforeseen technical challenges that may arise during development.

Finally, TPMs continuously track the implementation of risk mitigation strategies, analyze their effectiveness, and adapt as needed.

Iterate on the product’s technical aspects

TPMs work closely with engineering teams to introduce new technologies, tools, and best practices that can enhance the product’s performance, security, scalability, and user experience.

Once the changes are implemented, they monitor, analyze their performance, and conduct experiments. The insights enable them to identify areas for further technical improvements or optimizations. Rinse and repeat.

Through iterative testing and continuous improvement, they ensure the product architecture and design remain robust and technical debt-free and the product benefits from the latest technological development.

Ultimately, it enables it to retain its competitive advantage and keep meeting the constantly evolving user needs and market demands.

Heatmap
Heatmaps in Userpilot.

What do you need to become a technical product manager?

Technical product managers often come from an engineering or software development background, so a degree in computer science or a related field will definitely give you the edge.

However, a formal qualification is not necessary to become a TPM as long you have the right skills and drive for self-improvement.

Top skills successful technical product managers have

What skills do technical product managers need?

For starters, TPMs require technical proficiency. A strong understanding of software development, system architecture, data analysis, and product design principles is absolutely vital for their role.

In addition, they need more generic skills you’d expect from good product leaders. These include business acumen, strategic thinking, problem-solving, and project management.

To effectively work with teams from across the organization, they need excellent communication, negotiation skills, and empathy.

As they often have limited formal line authority compared to regular PMs, the ability to inspire, motivate, and influence people is even more vital to getting things done.

How does Userpilot make a technical product manager’s job easier?

Userpilot is a product growth platform that allows technical teams to analyze product performance, conduct experiments, and gather customer insights.

Let’s start with feedback collection.

As a TPM, you can easily create and launch surveys. All it takes is to select a template from the library, customize the design and questions, choose a user segment to target and hit publish. Userpilot also offers a feedback widget that you can use to collect passive feedback.

That’s how you collect and gain customer insights into the technical product performance.

Userpilot survey template library
Userpilot survey template library.

Next comes product analytics.

With Userpilot, you can track feature usage or events and visualize the data in graphs or heatmaps. Trends analytics enable you to track key performance metrics over time so that you can assess the impact of technical updates.

Userpilot also offers funnel and path analysis and cohort analysis.

Userpilot analytics
Userpilot analytics.

What if you need beta testers or experiment participants?

You can recruit them with in-app messages that are as easy to design and publish as the surveys. Thanks to behavioral segmentation features, you can trigger your invites for specific users, for example, the power users.

Modal recruiting beta testers
Modal recruiting beta testers.

Conclusion

Technical product managers collaborate with other product leaders and engineering and design teams to ensure that the product is technically sound, scalable, secure, and offers a great user experience.

This requires excellent technical knowledge and experience, as well as general leadership skills.

If you’d like to learn how Userpilot can help the TPM at your SaaS, book the demo!

The post Technical Product Manager: Exploring Their Role and Responsibilities appeared first on ProdSens.live.

]]>
https://prodsens.live/2023/11/20/technical-product-manager-exploring-their-role-and-responsibilities/feed/ 0
Advice to a New Engineer https://prodsens.live/2023/11/09/advice-to-a-new-engineer/?utm_source=rss&utm_medium=rss&utm_campaign=advice-to-a-new-engineer https://prodsens.live/2023/11/09/advice-to-a-new-engineer/#respond Thu, 09 Nov 2023 01:24:41 +0000 https://prodsens.live/2023/11/09/advice-to-a-new-engineer/ advice-to-a-new-engineer

Everyone who has started any new job (software or otherwise) can probably remember the first few days spent…

The post Advice to a New Engineer appeared first on ProdSens.live.

]]>
advice-to-a-new-engineer

Everyone who has started any new job (software or otherwise) can probably remember the first few days spent desperately trying to retain as much information as possible while drowning in the torrent of new tech, new processes, new company culture, etc. After that initial fire hose, if you’re like me, then you may find yourself feeling very proud that you remember some less important detail (e.g. that your boss’ birthday is coming up) only to realize that you already forgot something much more important (e.g. how to login to your new company email account).

As I thought through the experience of the first few weeks and months of my current job, I found that there are some key things I learned that helped me adjust and come up to speed. Every company has different ways they approach onboarding, and some may be more effective than others, but in the end, that’s probably not something you can control. What may be most valuable about these tips I learned is that they all are totally within your power to influence!

So with that being said, here are my 4 recommendations for starting a new tech job on the right foot

1. Ask questions

Don’t be afraid to come across as not knowing something
that’s totally fine!
As the new guy on the job it was really easy for me to catch myself feeling confused and alone simply because I didn’t want to come across as helpless or, even worse, technically ignorant. Luckily my coworkers were awesome and quickly taught me not to be afraid of asking questions.

The truth is, no one knows everything on day one, and you have to learn somehow. There is certainly a lot of value in figuring out something on your own, and I don’t want to discredit that approach at all. I only want to point out that banging your head against a wall for 2 days to learn something that you could have figured out in 5 minutes if you asked a question might not always be the best approach — for you or the business.

Image description

2. Don’t ask questions

Wait…what? Yes I realize this seems to contradict the last point, but I think there is an important balance to keep in mind. Asking another person to help you usually means a sacrifice of their time, energy, or valuable focus. So make sure to respect that sacrifice and avoid pestering the same person or people over and over again with small questions.

Generally it saved a lot of trouble if I made an attempt to figure something out myself before rushing to get someone else involved. Sometimes I was able to figure it out on my own, however even if I couldn’t, that extra solo effort made it easier for me to understand a coworker’s answer.

There is a balance between asking so many questions that you don’t learn anything vs quietly spending hours, days, or weeks trying to “do it yourself” instead of asking for help. I never found a magic formula to perfectly determine when to ask someone else vs dig in on my own, rather to just be conscious of other people’s time and energy.

I suppose if there is one concrete rule I found, it’s to avoid asking the same question twice. If someone took the time to help me find the answer, it was the least I could do to write that down so I didn’t have to waste their time later.

Image description

3. Write down/track what you learned/did each day

For whatever reason, starting on my first day I began taking short notes on what I accomplished each day. It wasn’t an exhaustive, page long journal entry or anything. Rather it was a few lines each day about the main tasks and any tips or important things I might want to remember. As time went on I began to realize some benefits of doing this that I hadn’t originally considered.

The first was in regards to repetitive tasks. Chances are when you are new, you might be assigned to do similar tasks often since there isn’t a wide breadth of things you know how to do yet. So having some notes you can reference might be helpful. And if it prevents you from having to bother someone else again, even better!

The other benefit of writing down my daily accomplishments was more subtle. Imposter syndrome is real
even after you’ve been at the job for years. Having something tangible you can look at to show yourself everything you’ve learned can be helpful in convincing yourself that although you may feel less capable than others (for now!), you really aren’t helpless. Maybe you are more confident in your skills than I am, and if so, this may not be necessary. But I found many times in the early weeks and months that I would turn back through the pages of that notebook and feel a slight boost of confidence as I realized everything I had learned. I suppose your mileage may vary.

4. Raise your hand

Often there is a set process for how you are assigned work. That’s great, and make sure to kill it at those tasks. But, in my experience, occasionally there will be times when your manager or other department leaders may ask for a volunteer to . Even if you don’t know how to do it, raise your hand! It’s a great way to learn something new, while also building trust with those around you. Bonus points if it’s something that most people don’t like doing (or don’t know how to do). It was through these volunteer opportunities that I learned how the puzzle pieces of the business fit together while also expanding my understanding of the system.

Conclusion

That’s basically it. Starting a new position is overwhelming for so many reasons, and this isn’t meant to be more urgent things to stress you out. In the end, the main goal is just to make a new job more comfortable, help you come up to speed faster, and perhaps to feel more confident in yourself too. I’m sure there are many ways to do that, and these are just a few that I found worked for me.

The post Advice to a New Engineer appeared first on ProdSens.live.

]]>
https://prodsens.live/2023/11/09/advice-to-a-new-engineer/feed/ 0
Project Design in Project Management: A Quick Guide https://prodsens.live/2023/06/15/project-design-in-project-management-a-quick-guide/?utm_source=rss&utm_medium=rss&utm_campaign=project-design-in-project-management-a-quick-guide https://prodsens.live/2023/06/15/project-design-in-project-management-a-quick-guide/#respond Thu, 15 Jun 2023 20:25:35 +0000 https://prodsens.live/2023/06/15/project-design-in-project-management-a-quick-guide/ project-design-in-project-management:-a-quick-guide

The project design phase is the first step when planning a project. It sets the stage for the…

The post Project Design in Project Management: A Quick Guide appeared first on ProdSens.live.

]]>
project-design-in-project-management:-a-quick-guide

The project design phase is the first step when planning a project. It sets the stage for the project initiation and project planning phase and important documents like the project charter and project plan.

What Is Project Design?

Project design is a brainstorming process where the project management team starts thinking about the project from a high-level perspective, outlining goals, methodologies, resources and success criteria to establish a project approach that’ll be presented to stakeholders to then begin with the project initiation and project planning phases. In this project stage, the decisions about how to manage and govern are made.

After the project design phase, a project proposal, project charter and a project plan can be created. These project documents will then be used to manage the execution phase of the project life cycle.

The thinking that goes on during the project design, however, doesn’t focus on details as much as it works on a higher level in terms of managing the project. Project planning software can help organize both the high-level strategy and the specific details of a project design.

ProjectManager, for instance, has Gantt charts for making detailed schedules, but also kanban boards for easy collaboration for the strategic aspect of project design. Manage your strategy, plan, schedule, execution and reporting in one easy-to-use project management software. Try it for free today.

Get access to kanban boards, Gantt charts, task lists, sheets and calendars with ProjectManager. Learn more

What Is the Purpose of the Project Design Process?

The project design defines the overall project methodology that’ll be used and an overview of the project. It describes the major deliverables, products or features that will be completed. The project design also roughly estimates the budget and outlines how to monitor and evaluate progress. There can be more than one design presented to stakeholders, who can then choose which they think best suits their needs.

Why Is the Project Design Phase Important?

Project design is a major first step toward a successful project. A project design is a strategic organization of ideas, materials and processes for the purpose of achieving a goal. Project managers rely on a good design to avoid pitfalls and provide parameters to maintain crucial aspects of the project, like the schedule and the budget.

Project Design Process: How to Design a Project Step-By-Step

There are steps to take for defining project designs and developing an implementation strategy, and they’re the most important steps in a project. Therefore, you want to involve your team and stakeholders in the process to ensure you’re covering all the bases. Take the time to complete this stage thoroughly.

1. Define Your Project Vision

What’s your vision for the project? This isn’t some far-fetched hope, but a vision statement, which envisions a problem that needs resolution. That means clarifying the reason for the project. The vision statement is a formal document that states the project’s potential. It’s presented to stakeholders to show the viability of the project and its benefits.

It isn’t a long, detailed document. You can have a short, idealistic vision in terms of the outcome of the project; after all, this is how you sell the project. So, paint a picture of the project’s success, and place it in a larger context.

2. State the Problem Your Project Will Solve

To support that vision document, you need to identify a problem that needs solving. A needs assessment is often required, so you can see the obstacles the business is encountering. This aligns the problem you’re addressing with the organization and its strategy. It’ll also provide you with the necessary data to design an optimal solution for the problem.

To begin, what information are you gathering? What sources are there for that information, and how will you then gather the information? Next, analyze and determine the problems that your project is being created to resolve. Collect those results in a document.

3. Estimate the Project Resources That’ll Be Needed

Next, you need to recognize the necessary resources to get the project done. Resources are anything from people to equipment to the facilities necessary to complete the project successfully.

A good way to determine the resources is the same way journalists approach a news story, with the five W’s: who, what, where, when and why. Who do you need to execute the project, what resource management tools are required, where will the work be done, when will the project start and end and why are these resources needed?

4. Outline Your Project Goals

You can’t achieve your goals if you haven’t identified them first. A goal is something at the end of the project that’s both observable and measurable and it coincides with the resolution of a problem.

Create a goal statement that explains how the goals are addressed in the project. To do this well, apply the SMART method, which stands for specific, measurable, achievable, realistic and time-relevant. Each goal should be defined by these terms.

5. Structure Your Project Strategy

To achieve the project goals there must be a strategy in place. A strategy is a process to reach the goals of the project within the project constraints, such as its resources, schedule, budget, etc. How can a strategy be created to achieve the project goals?

Consider precedent and look back on similar projects from the past and what they might have shown in terms of the pros and cons of their applied strategies. Best practices for project management are always a good foundation and then building a strategy incrementally, creating a pathway to success.

6. Prepare a Contingency Plan

Any project manager knows that very few things proceed as planned. There needs to be a backup plan to respond quickly and rightly to issues as they arise in a project. Therefore, this must be included in your project design.

Look for the negative risks inherent in the project. They are embedded in various places, such as teams, which might lack skills, have unavoidable absences, turnover, etc. Schedules can be plagued with delays. The scope might have been poorly defined. Costs are underestimated, or funds dry up. Have a plan to address these risks.

ProjectManager's Gantt chart
Have a contingency plan built out on a Gantt chart just in case with ProjectManager. Learn more

7. Establish an Evaluation Plan

A project must always be under evaluation. An evaluation plan will help you monitor the project, and maybe even alert you when it starts to veer off track. Use this plan to analyze the components of the project, the outcomes and the impacts.

Outcomes are measurable changes, while impacts are how well the project goals are being achieved. Therefore, the evaluation plan is a detailed document that defines criteria to determine the project’s effectiveness and efficiency by tracking progress on all aspects of the project.

8. Estimate Costs and Create a Project Budget

The budget outlines the financial resources that drive the project. A budget will assign a cost to each of the project’s requirements. Creating a project budget means formalizing financial resources that’ll be allocated to the project. This begins with choosing a way to estimate costs, identify impacts and report on the evaluation.

9. Create a Project Proposal

All of this leads to a project proposal to explain why the project should be executed and what its benefits are. The previous steps are summarized, writing out the vision of the project and a brief description of the problem that it speaks to. Then state the goals of the project and outline the strategy that will be used to achieve those goals.

Project Design Example

Project managers use project management tools such as Gantt charts to structure their project designs. Here’s a simple project design example that shows how the project design ideas are added to this project planning tool.

For this project design example, let’s take a look at a construction project. As you can see in the image below, during the project design phase, project managers can use Gantt charts to add the major tasks and deliverables as well as build the work breakdown structure of a project to outline the phases of the project execution.

ProjectManager’s Gantt charts have two major parts. On the left side there’s a spreadsheet that allows project managers to enter information that will be used to automatically generate a project timeline on the right side. This timeline will not only show the project tasks but also milestones, task dependencies and due dates for project deliverables.

What ProjectManager Can Do to Help Your Project Design

Designing a project takes a lot of work, but using project management tools facilitates the process of creating an outline that details these various parts of the project. Besides using Gantt charts to organize your project design ideas into a project timeline, you can also use kanban boards to manage workflow using ProjectManager.

Plan Workflows With Kanban Boards

ProjectManager has a kanban feature that was created to visualize workflows. The project design phase involves collaboration among members of the project management team who will need to share files and communicate in real-time, which can be achieved with ProjectManager’s kanban boards that let project teams better communicate and structure the project design.

 ProjectManager's kanban board with kanban card popupIt’s easy to see how this process can serve you throughout the project design, as you collect more documents to define your project. Then, once you execute the proper, you can use ProjectManager’s real-time dashboards to keep track of the project’s progress.

Track Projects With Real-Time Dashboards

ProjectManager’s real-time dashboards help project managers keep track of project costs, timelines and progress once the project design becomes a reality. These powerful dashboards can be used to track multiple projects in a portfolio.

Only robust project management software can handle all the data needed for a good project design. ProjectManager is a cloud-based tool that has features, such as the online Gantt chart, to help schedule, as well as others, to assist with budget and resource allocation. See how it can help you by taking this free 30-day trial.

The post Project Design in Project Management: A Quick Guide appeared first on ProjectManager.

The post Project Design in Project Management: A Quick Guide appeared first on ProdSens.live.

]]>
https://prodsens.live/2023/06/15/project-design-in-project-management-a-quick-guide/feed/ 0