Striver Technosoft http://www.strivertech.com Agile Organization | Top Web and Mobile Development Solution Thu, 18 Apr 2024 05:29:23 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.1 http://www.strivertech.com/wp-content/uploads/2022/04/cropped-cropped-Striver-Technology-2-32x32.png Striver Technosoft http://www.strivertech.com 32 32 React keys fully explained! http://www.strivertech.com/react-keys-fully-explained/?utm_source=rss&utm_medium=rss&utm_campaign=react-keys-fully-explained Thu, 18 Apr 2024 05:22:29 +0000 https://www.strivertech.com/?p=7005 React keys fully explained! Discover the power of React keys with our detailed explanation. Learn how to effectively use keys to optimize performance and manage component state. Keys in React When mapping over an array of elements in React, you need to provide a key prop to each element. If you don’t, React will throw […]

The post React keys fully explained! first appeared on Striver Technosoft.

]]>

React keys fully explained!

Discover the power of React keys with our detailed explanation. Learn how to effectively use keys to optimize performance and manage component state.

Keys in React

When mapping over an array of elements in React, you need to provide a key prop to each element. If you don’t, React will throw a warning in the console.

  • What should we use as a key?

  • What happens if we don’t provide a key?

  • So why do we need to provide a key prop?

Problematic code

Let’s look at some code where React throws a warning because we didn’t provide a key prop:

function App() {
  const items = ["apple", "banana", "cherry"];

  return (
    <ul>
      {items.map((item) => (
        <li>{item}</li>
      ))}
    </ul>
  );
}

This code will throw a warning in the console:

Warning: Each child in a list should have a unique "key" prop.

What’s the problem?

When you map over an array of elements, React needs a way to identify each element uniquely.

Imagine the files on your computer didn’t have a name. They were identified only by their order. If you moved a file to a different position or deleted a file, you wouldn’t know which file you were referring to. This is an analogy coming from React’s own documentation.

React needs a way to always know which element is which. That’s why you need to provide a key prop.

Rules

Two rules to follow when choosing a key:

  1. Stable: The key should be stable. It shouldn’t change between renders.

  2. Unique: The key should be unique among siblings.

It’s also why you shouldn’t use the index as a key. If the order of the elements changes, React won’t be able to identify which element is which.

Solution

Let’s fix the warning by providing a key prop:

function App() {
  const items = ["apple", "banana", "cherry"];

  return (
    <ul>
      {items.map((item) => (
        <li key={item}>{item}</li>
      ))}
    </ul>
  );
}

In this case, it’s ok to use the item itself as a key because the items are unique.

In other cases where you get data from backend, you’ll likely want to use id or some other unique identifier instead of the item itself.

Surprise, it’s not a prop

The key prop is not an actual prop that gets passed to the component. It’s a special attribute that React uses internally to keep track of elements. That’s why you can’t access the key prop inside the component.

If we look at the JSX from the previous example again:

function App() {
  const items = ["apple", "banana", "cherry"];

  return (
    <ul>
      {items.map((item) => (
        <li key={item}>{item}</li>
      ))}
    </ul>
  );
}

When this JSX is transpiled, it will look something like this:

const element = {
  type: "ul",
  props: {
    children: [
      {
        type: "li",
        key: "apple",
        props: {
          children: "apple",
        },
      },
      {
        type: "li",
        key: "banana",
        props: {
          children: "banana",
        },
      },
      {
        type: "li",
        key: "cherry",
        props: {
          children: "cherry",
        },
      },
    ],
  },
};

As you can see, the key is a top-level property of the element, not a prop that gets passed to the component. React uses this key to identify the element internally and keep track of it across re-renders.

So remember, when mapping over an array of elements in React, always provide a unique and stable key to each element. It’s not a prop, but a special attribute that React uses under the hood to efficiently update the DOM.

The post React keys fully explained! first appeared on Striver Technosoft.

]]>
Hard and soft skills for developers coding in the age of AI http://www.strivertech.com/hard-and-soft-skills-for-developers-coding-in-the-age-of-ai/?utm_source=rss&utm_medium=rss&utm_campaign=hard-and-soft-skills-for-developers-coding-in-the-age-of-ai Mon, 18 Mar 2024 06:59:46 +0000 https://www.strivertech.com/?p=6999 Hard and soft skills for developers coding in the age of AI While AI revolutionizes software development, it still relies on developers to pilot its use. In this blog, we’ll cover the skills that developers need to have for navigating this new AI-powered coding frontier.   As AI continues to shape the development landscape, developers […]

The post Hard and soft skills for developers coding in the age of AI first appeared on Striver Technosoft.

]]>

Hard and soft skills for developers coding in the age of AI

While AI revolutionizes software development, it still relies on developers to pilot its use. In this blog, we’ll cover the skills that developers need to have for navigating this new AI-powered coding frontier.

 

As AI continues to shape the development landscape, developers are navigating a new frontier—not one that will make their careers obsolete, but one that will require their skills and instincts more than ever.

Sure, AI is revolutionizing software development, but that revolution ultimately starts and stops with developers. That’s because these tools need to have a pilot in control. While they can improve the time to code and ship, they can’t serve as a replacement for human oversight and coding abilities.

In essence, AI can reduce mental strain so that developers can focus on anything from learning a new language to creating high-quality solutions for complex problems. So, if you’re sitting here wondering if you should learn how to code or how AI fits into your current coding career, we’re here to tell you what you need to know about your work in the age of AI.

Hard skills are the building blocks of software engineering, enabling developers to translate concepts into functional code.

To implement AI tools, developers need technical skills and soft skills

There are two different subsets of skills that can help developers as they begin to incorporate AI tools into their development workflows: technical skills and soft skills. Having both technical chops and people skills is super important for developers when they’re diving into AI projects—they need to know their technical skills to make those AI tools work to their advantage, but they also need to be able to work well with others, solve problems creatively, and understand the big picture to make sure the solutions they come up with actually hit the mark for the folks using them.

Let’s take a look at those technical skills first.

Getting Technical

Prompt engineering

Prompt engineering involves crafting well-designed prompts or instructions that guide the behavior of AI models to produce desired outputs or responses. It can be pretty frustrating when AI-powered coding assistants don’t generate a valuable output, but that can often be quickly remedied by adjusting how you communicate with the AI. Here are some things to keep in mind when crafting natural language prompts:

  • Be clear and specific. Craft direct and contextually relevant prompts to guide AI models more effectively.
  • Experiment and iterate. Try out various prompt variations and iterate based on the outputs you receive.
  • Validate, validate, validate. Similar to how you would inspect code written by a colleague, it’s crucial to consistently evaluate, analyze, and verify code generated by AI algorithms.

And now, the soft skills

As developers leverage AI to build what’s next, having soft skills—like the ability to communicate and collaborate well with colleagues—is becoming more important than ever.

Let’s take a more in-depth look at some soft skills that developers can focus on as they continue to adopt AI tools:

  • Communication. Communication skills are paramount to collaborating with team members and stakeholders to define project requirements, share insights, and address challenges. They’re also important as developers navigate prompt engineering. The best AI prompts are clear, direct, and well thought out—and communicating with fellow humans in the workplace isn’t much different.
  • Problem solving. Developers may encounter complex challenges or unexpected issues when working with AI tools, and the ability to think creatively and adapt to changing circumstances is crucial for finding innovative solutions.
  • Adaptability. The rapid advancement of AI technology requires developers to be adaptable and willing to embrace new tools, methodologies, and frameworks. Plus, cultivating soft skills that promote a growth mindset allows individuals to consistently learn and stay updated as AI tools continue to evolve.
  • Ethical thinking. Ethical considerations are important in AI development, particularly regarding issues such as bias, fairness, transparency, and privacy. Integrity and ethical reasoning are essential for making responsible decisions that prioritize the well-being of users and society at large.
  • Empathy. Developers are often creating solutions and products for end users, and to create valuable user experiences, developers need to be able to really understand the user’s needs and preferences. While AI can help developers create these solutions faster, through things like code generation or suggestions, developers still need to be able to QA the code and ensure that these solutions still prioritize the well-being of diverse user groups.

Sharpening these soft skills can ultimately augment a developer’s technical expertise, as well as enable them to work more effectively with both their colleagues and AI tools.

 

Take this with you

As AI continues to evolve, it’s not just changing the landscape of software development; it’s also poised to revolutionize how developers learn and write code. AI isn’t replacing developers—it’s complementing their work, all while providing them with the opportunity to focus more on coding and building their skill sets, both technical and interpersonal.

The post Hard and soft skills for developers coding in the age of AI first appeared on Striver Technosoft.

]]>
Quickstart: Get started with Gemini using the REST API http://www.strivertech.com/rest_quickstart/?utm_source=rss&utm_medium=rss&utm_campaign=rest_quickstart Tue, 27 Feb 2024 05:55:15 +0000 https://www.strivertech.com/?p=6982 Quickstart: Get started with Gemini using the REST API with React Native https://www.strivertech.com/wp-content/uploads/2024/02/gemin.mp4 Greetings, developers! Today, we embark on an exciting journey to seamlessly integrate Gemini with REST API in your React Native applications. Inspired by Google’s REST API Quickstart, this step-by-step guide aims to empower you with enhanced testing capabilities and a streamlined development […]

The post Quickstart: Get started with Gemini using the REST API first appeared on Striver Technosoft.

]]>

Quickstart: Get started with Gemini using the REST API with React Native

Greetings, developers! Today, we embark on an exciting journey to seamlessly integrate Gemini with REST API in your React Native applications. Inspired by Google’s REST API Quickstart, this step-by-step guide aims to empower you with enhanced testing capabilities and a streamlined development process.

If you want to quickly try out the Gemini API, you can use curl commands to call the methods in the REST API. The examples in this tutorial show calls for each API method.

The Colab uses Python code to set an environment variable and to display an image, but you don’t need Colab to work with the REST API. You should be able to run all of the curl examples outside of Colab, without modification, as long as you have API_KEY set as described in the next section.

For each curl command, you must specify the applicable model name and your API key.

Ensure you have the following prerequisites ready before diving into the integration:

  • A React Native project set up
  • Access to Gemini’s REST API (credentials and endpoint)

To use the Gemini API, you’ll need an API key. If you don’t already have one, create a key in Google AI Studio.

In Colab, add the key to the secrets manager under the “🔑” in the left panel. Give it the name API_KEY. You can then add it as an environment variable to pass the key in your curl call.

In a terminal, you can just run API_KEY="Your API Key".

 
import os
from google.colab import userdata

os
.environ['API_KEY'] = userdata.get('API_KEY')

Use the generateContent method to generate a response from the model given an input message. If the input contains only text, use the gemini-pro model.

 
curl https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=$API_KEY \
    -H 'Content-Type: application/json' \
    -X POST \
    -d '{
      "contents": [{
        "parts":[{
          "text": "Write a story about a magic backpack."}]}]}' 2> /dev/null
 
{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "text": "Once upon a time, in a small town nestled at the foot of towering mountains, there lived a young girl named Lily. Lily was an adventurous and imaginative child, always dreaming of exploring the world beyond her home. One day, while wandering through the attic of her grandmother's house, she stumbled upon a dusty old backpack tucked away in a forgotten corner. Intrigued, Lily opened the backpack and discovered that it was an enchanted one. Little did she know that this magical backpack would change her life forever.\n\nAs Lily touched the backpack, it shimmered with an otherworldly light. She reached inside and pulled out a map that seemed to shift and change before her eyes, revealing hidden paths and distant lands. Curiosity tugged at her heart, and without hesitation, Lily shouldered the backpack and embarked on her first adventure.\n\nWith each step she took, the backpack adjusted to her needs. When the path grew treacherous, the backpack transformed into sturdy hiking boots, providing her with the confidence to navigate rocky terrains. When a sudden rainstorm poured down, the backpack transformed into a cozy shelter, shielding her from the elements.\n\nAs days turned into weeks, Lily's journey took her through lush forests, across treacherous rivers, and to the summits of towering mountains. The backpack became her loyal companion, guiding her along the way, offering comfort, protection, and inspiration.\n\nAmong her many adventures, Lily encountered a lost fawn that she gently carried in the backpack's transformed cradle. She helped a friendly giant navigate a dense fog by using the backpack's built-in compass. And when faced with a raging river, the backpack magically transformed into a sturdy raft, transporting her safely to the other side.\n\nThrough her travels, Lily discovered the true power of the magic backpack. It wasn't just a magical object but a reflection of her own boundless imagination and tenacity. She realized that the world was hers to explore, and the backpack was a tool to help her reach her full potential.\n\nAs Lily returned home, enriched by her adventures and brimming with stories, she decided to share the magic of the backpack with others. She organized a special adventure club, where children could embark on their own extraordinary journeys using the backpack's transformative powers. Together, they explored hidden worlds, learned valuable lessons, and formed lifelong friendships.\n\nAnd so, the legend of the magic backpack lived on, passed down from generation to generation. It became a reminder that even the simplest objects can hold extraordinary power when combined with imagination, courage, and a sprinkle of magic."
          }
        ],
        "role": "model"
      },
      "finishReason": "STOP",
      "index": 0,
      "safetyRatings": [
        {
          "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
          "probability": "NEGLIGIBLE"
        },
        {
          "category": "HARM_CATEGORY_HATE_SPEECH",
          "probability": "NEGLIGIBLE"
        },
        {
          "category": "HARM_CATEGORY_HARASSMENT",
          "probability": "NEGLIGIBLE"
        },
        {
          "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
          "probability": "NEGLIGIBLE"
        }
      ]
    }
  ],
  "promptFeedback": {
    "safetyRatings": [
      {
        "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
        "probability": "NEGLIGIBLE"
      },
      {
        "category": "HARM_CATEGORY_HATE_SPEECH",
        "probability": "NEGLIGIBLE"
      },
      {
        "category": "HARM_CATEGORY_HARASSMENT",
        "probability": "NEGLIGIBLE"
      },
      {
        "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
        "probability": "NEGLIGIBLE"
      }
    ]
  }
}

If the input contains both text and image, use the gemini-pro-vision model. The following snippets help you build a request and send it to the REST API.

 
curl -o image.jpg https://storage.googleapis.com/generativeai-downloads/images/scones.jpg
 
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  385k  100  385k    0     0  2053k      0 --:--:-- --:--:-- --:--:-- 2050k
 
import PIL.Image

img
= PIL.Image.open("image.jpg")
img
.resize((512, int(img.height*512/img.width)))

png

 
echo '{
  "contents":[
    {
      "parts":[
        {"text": "What is this picture?"},
        {
          "inline_data": {
            "mime_type":"image/jpeg",
            "data": "'$(base64 -w0 image.jpg)'"
          }
        }
      ]
    }
  ]
}' > request.json
 
curl https://generativelanguage.googleapis.com/v1beta/models/gemini-pro-vision:generateContent?key=${API_KEY} \
        -H 'Content-Type: application/json' \
        -d @request.json 2> /dev/null | grep "text"
 
"text": " The picture shows a table with a white tablecloth. On the table are two cups of coffee, a bowl of blueberries, and a plate of scones. There are also some flowers on the table."

Using Gemini, you can build freeform conversations across multiple turns.

 
curl https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=$API_KEY \
    -H 'Content-Type: application/json' \
    -X POST \
    -d '{
      "contents": [
        {"role":"user",
         "parts":[{
           "text": "Write the first line of a story about a magic backpack."}]},
        {"role": "model",
         "parts":[{
           "text": "In the bustling city of Meadow brook, lived a young girl named Sophie. She was a bright and curious soul with an imaginative mind."}]},
        {"role": "user",
         "parts":[{
           "text": "Can you set it in a quiet village in 1600s France?"}]},
      ]
    }' 2> /dev/null | grep "text"
 
"text": "In the quaint village of Fleur-de-Lys, nestled amidst the rolling hills of 17th century France, lived a young maiden named Antoinette. She possessed a heart brimming with curiosity and a spirit as vibrant as the wildflowers that bloomed in the meadows.\n\nOne sunny morn, as Antoinette strolled through the cobblestone streets, her gaze fell upon a peculiar sight—a weathered leather backpack resting atop a mossy stone bench. Intrigued, she cautiously approached the bag, her fingers tracing the intricate carvings etched into its surface. As her fingertips grazed the worn leather, a surge of warmth coursed through her body, and the backpack began to emit a soft, ethereal glow."

Every prompt you send to the model includes parameter values that control how the model generates a response. The model can generate different results for different parameter values. Learn more about model parameters.

Also, you can use safety settings to adjust the likelihood of getting responses that may be considered harmful. By default, safety settings block content with medium and/or high probability of being unsafe content across all dimensions. Learn more about safety settings.

The following example specifies values for all the parameters of the generateContent method.

 
curl https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=$API_KEY \
    -H 'Content-Type: application/json' \
    -X POST \
    -d '{
        "contents": [{
            "parts":[
                {"text": "Write a story about a magic backpack."}
            ]
        }],
        "safetySettings": [
            {
                "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
                "threshold": "BLOCK_ONLY_HIGH"
            }
        ],
        "generationConfig": {
            "stopSequences": [
                "Title"
            ],
            "temperature": 1.0,
            "maxOutputTokens": 800,
            "topP": 0.8,
            "topK": 10
        }
    }'  2> /dev/null | grep "text"
 
"text": "Once upon a time, in a small town nestled at the foot of a majestic mountain range, lived a young girl named Lily. Lily was a bright and curious child who loved to explore the world around her. One day, while playing in the forest near her home, she stumbled upon a hidden cave. Intrigued, she stepped inside, and to her amazement, she discovered a dusty old backpack lying in a corner.\n\nCuriosity piqued, Lily reached out and picked up the backpack. As soon as her fingers brushed against the worn leather, she felt a strange tingling sensation coursing through her body. Suddenly, the backpack began to glow, emitting a soft, ethereal light that filled the cave.\n\nWith wide-eyed wonder, Lily opened the backpack to find it filled with an assortment of magical objects. There was a compass that always pointed to the nearest adventure, a magnifying glass that could reveal hidden secrets, a telescope that allowed her to see distant lands, and a book that contained the knowledge of the universe.\n\nOverjoyed with her discovery, Lily took the magic backpack home and began using its contents to explore the world in ways she had never imagined. She followed the compass to discover hidden treasures, used the magnifying glass to uncover the secrets of nature, gazed through the telescope to witness the wonders of the cosmos, and delved into the book to learn about the mysteries of the universe.\n\nAs Lily's adventures continued, she realized that the magic backpack was more than just a collection of enchanted items. It was a symbol of her own limitless potential and the power of her imagination. It taught her that with curiosity, courage, and a touch of magic, anything was possible.\n\nNews of Lily's magical backpack spread throughout the town, and soon, children from all around came to her, eager to learn about its wonders. Lily welcomed them with open arms, sharing her stories and inspiring them to embark on their own adventures.\n\nAnd so, the magic backpack became a beacon of hope and wonder, reminding everyone that the world is full of hidden treasures waiting to be discovered, if only one has the courage to step into the unknown."

By default, the model returns a response after completing the entire generation process. You can achieve faster interactions by not waiting for the entire result, and instead use streaming to handle partial results.

 
!curl https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:streamGenerateContent?key=${API_KEY} \
       
-H 'Content-Type: application/json' \
       
--no-buffer \
       
-d '{ "contents":[{"parts":[{"text": "Write long a story about a magic backpack."}]}]}' \
       
2> /dev/null | grep "text"
 
"text": "In the bustling city of Meadow brook, lived a young girl named Sophia with an"
            "text": " insatiable curiosity that knew no bounds. One sunny morning, as she walked to school, she came across a charming little shop tucked away on a side street. Int"
            "text": "rigued, she stepped inside and was immediately captivated by the mystical aura that enveloped the room. Amidst the shelves lined with ancient books and curious trinkets, she stumbled upon a peculiar backpack. Crafted from deep emerald leather and adorned with shimmering crystals, it seemed to pulse with a hidden energy. Unable to resist its allure"
            "text": ", Sophia reached out and touched the backpack, and in that moment, a powerful connection was forged. As if awakening from a long slumber, the backpack emitted a soft glow, revealing its extraordinary properties.\n\nSophia discovered that this was no ordinary backpack. It possessed the magical ability to grant her wishes, but only if they were made with a pure heart and genuine intentions. Overwhelmed with excitement and responsibility, Sophia pondered deeply about how she would use this extraordinary gift. She decided that her first wish would be to make her grandmother, who lived far away, feel close to her. With a heartfelt desire, she whispered her wish to the backpack"

When using long prompts, it might be useful to count tokens before sending any content to the model.

 
curl https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:countTokens?key=$API_KEY \
    -H 'Content-Type: application/json' \
    -X POST \
    -d '{
      "contents": [{
        "parts":[{
          "text": "Write a story about a magic backpack."}]}]}' > response.json
 
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   127    0    23  100   104    105    477 --:--:-- --:--:-- --:--:--   585
 
cat response.json
 
{
  "totalTokens": 8
}

Embedding is a technique used to represent information as a list of floating point numbers in an array. With Gemini, you can represent text (words, sentences, and blocks of text) in a vectorized form, making it easier to compare and contrast embeddings. For example, two texts that share a similar subject matter or sentiment should have similar embeddings, which can be identified through mathematical comparison techniques such as cosine similarity.

Use the embedding-001 model with either embedContents or batchEmbedContents:

 
curl https://generativelanguage.googleapis.com/v1beta/models/embedding-001:embedContent?key=$API_KEY \
    -H 'Content-Type: application/json' \
    -X POST \
    -d '{
        "model": "models/embedding-001",
        "content": {
        "parts":[{
          "text": "Write a story about a magic backpack."}]} }' 2> /dev/null | head
 
{
  "embedding": {
    "values": [
      0.008624583,
      -0.030451821,
      -0.042496547,
      -0.029230341,
      0.05486475,
      0.006694871,
      0.004025645,
 
curl https://generativelanguage.googleapis.com/v1beta/models/embedding-001:batchEmbedContents?key=$API_KEY \
    -H 'Content-Type: application/json' \
    -X POST \
    -d '{
      "requests": [{
        "model": "models/embedding-001",
        "content": {
        "parts":[{
          "text": "Write a story about a magic backpack."}]} }]}' 2> /dev/null | head
 
{
  "embeddings": [
    {
      "values": [
        0.008624583,
        -0.030451821,
        -0.042496547,
        -0.029230341,
        0.05486475,
        0.006694871,

If you GET a model’s URL, the API uses the get method to return information about that model such as version, display name, input token limit, etc.

 
curl https://generativelanguage.googleapis.com/v1beta/models/gemini-pro?key=$API_KEY
 
{
  "name": "models/gemini-pro",
  "version": "001",
  "displayName": "Gemini Pro",
  "description": "The best model for scaling across a wide range of tasks",
  "inputTokenLimit": 30720,
  "outputTokenLimit": 2048,
  "supportedGenerationMethods": [
    "generateContent",
    "countTokens"
  ],
  "temperature": 0.9,
  "topP": 1,
  "topK": 1
}

If you GET the models directory, it uses the list method to list all of the models available through the API, including both the Gemini and PaLM family models.

 
curl https://generativelanguage.googleapis.com/v1beta/models?key=$API_KEY
 
{
  "models": [
    {
      "name": "models/chat-bison-001",
      "version": "001",
      "displayName": "Chat Bison",
      "description": "Chat-optimized generative language model.",
      "inputTokenLimit": 4096,
      "outputTokenLimit": 1024,
      "supportedGenerationMethods": [
        "generateMessage",
        "countMessageTokens"
      ],
      "temperature": 0.25,
      "topP": 0.95,
      "topK": 40
    },
    {
      "name": "models/text-bison-001",
      "version": "001",
      "displayName": "Text Bison",
      "description": "Model targeted for text generation.",
      "inputTokenLimit": 8196,
      "outputTokenLimit": 1024,
      "supportedGenerationMethods": [
        "generateText",
        "countTextTokens",
        "createTunedTextModel"
      ],
      "temperature": 0.7,
      "topP": 0.95,
      "topK": 40
    },
    {
      "name": "models/embedding-gecko-001",
      "version": "001",
      "displayName": "Embedding Gecko",
      "description": "Obtain a distributed representation of a text.",
      "inputTokenLimit": 1024,
      "outputTokenLimit": 1,
      "supportedGenerationMethods": [
        "embedText",
        "countTextTokens"
      ]
    },
    {
      "name": "models/embedding-gecko-002",
      "version": "002",
      "displayName": "Embedding Gecko 002",
      "description": "Obtain a distributed representation of a text.",
      "inputTokenLimit": 2048,
      "outputTokenLimit": 1,
      "supportedGenerationMethods": [
        "embedText",
        "countTextTokens"
      ]
    },
    {
      "name": "models/gemini-pro",
      "version": "001",
      "displayName": "Gemini Pro",
      "description": "The best model for scaling across a wide range of tasks",
      "inputTokenLimit": 30720,
      "outputTokenLimit": 2048,
      "supportedGenerationMethods": [
        "generateContent",
        "countTokens"
      ],
      "temperature": 0.9,
      "topP": 1,
      "topK": 1
    },
    {
      "name": "models/gemini-pro-vision",
      "version": "001",
      "displayName": "Gemini Pro Vision",
      "description": "The best image understanding model to handle a broad range of applications",
      "inputTokenLimit": 12288,
      "outputTokenLimit": 4096,
      "supportedGenerationMethods": [
        "generateContent",
        "countTokens"
      ],
      "temperature": 0.4,
      "topP": 1,
      "topK": 32
    },
    {
      "name": "models/gemini-ultra",
      "version": "001",
      "displayName": "Gemini Ultra",
      "description": "The most capable model for highly complex tasks",
      "inputTokenLimit": 30720,
      "outputTokenLimit": 2048,
      "supportedGenerationMethods": [
        "generateContent",
        "countTokens"
      ],
      "temperature": 0.9,
      "topP": 1,
      "topK": 32
    },
    {
      "name": "models/embedding-001",
      "version": "001",
      "displayName": "Embedding 001",
      "description": "Obtain a distributed representation of a text.",
      "inputTokenLimit": 2048,
      "outputTokenLimit": 1,
      "supportedGenerationMethods": [
        "embedContent",
        "countTextTokens"
      ]
    },
    {
      "name": "models/aqa",
      "version": "001",
      "displayName": "Model that performs Attributed Question Answering.",
      "description": "Model trained to return answers to questions that are grounded in provided sources, along with estimating answerable probability.",
      "inputTokenLimit": 7168,
      "outputTokenLimit": 1024,
      "supportedGenerationMethods": [
        "generateAnswer"
      ],
      "temperature": 0.2,
      "topP": 1,
      "topK": 40
    }
  ]
}

The post Quickstart: Get started with Gemini using the REST API first appeared on Striver Technosoft.

]]>
Developers need this more http://www.strivertech.com/developers-need-this-more/?utm_source=rss&utm_medium=rss&utm_campaign=developers-need-this-more Thu, 15 Feb 2024 12:45:15 +0000 https://www.strivertech.com/?p=6961 Flutter Developers Should Care About Analytics Developers need this more This week We want to talk about why developers should start caring about product usage analytics. It gives you additional insights into how your code is being used, which can help you make decisions on the code to focus on vs remove. Code bases should […]

The post Developers need this more first appeared on Striver Technosoft.

]]>
Flutter Developers Should Care About Analytics

Developers need this more

This week We want to talk about why developers should start caring about product usage analytics.

It gives you additional insights into how your code is being used, which can help you make decisions on the code to focus on vs remove. Code bases should not grow forever, this is a quick path to maintenance hell.

You should have periods where you focus on removing code and reducing code complexity.

Less code = Less maintenance cost = Less cognitive load

“But all our code is required and useful”

 

That’s often the reasoning I hear when I bring this up with teams I consult with. But this is not true. There are abstractions you’ve made that were never used past the one instance, there are features you’ve built that aren’t used that often by users. These unused features often require other parts of your code to be more complicated to accommodate them.

By tracking analytics you have proof that the effort of maintaining that feature brings no value to your product, your code, your users or the business.

There are 3 main reasons that I like to look at analytics as a software developer:

  • Gives an indication of what code I can delete
  • An indicator of what code to focus on
  • An additional tool to help solve bugs

Can I delete this code?

To answer this question is one of the reasons that I look at analytics, even if it’s not a part of what my client wants me to do.

Deleting code has multiple positive benefits:

  • Decrease in cognitive load: there’s less you have to keep in mind when making changes in the code base. This has a great effect on developers that might not have been a part of the code base from the beginning of the project
  • Increase in delivery time: with fewer components to take into account when building new features, or improving old ones, this gives you less code to manage and test when it’s release time.
  • Increase in code quality: by removing dead code you are most likely removing code that wasn’t adding to the quality of your codebase.

It’s common that developers and teams won’t want to remove features or code because “a user might need it”. In this case, given that there are objective indicators that very few users are using the features, you should at least reduce the complexity of that feature into something easy to manage and update (if it’s not already)

What code should I make more robust?

If you see a part of your codebase being used the most, it’s a very clear sign that you should spend a lot of time on that code to make it more robust. The process of doing this is simple, you simply make your code testable.

The process of making your code testable creates a more robust piece of code. To achieve this what you’ll do is:

  • Ensure dependency inversion is applied
  • Ensure you have good layers of separation
  • Ensure you have single responsibility objects to concentrate potential failure points

The highest level of robustness you can have here is:

  • Unit testing all individual pieces of code involved in this process
  • Integration testing of all of the connections that make up this feature

The code with the most amount of usage should be where we focus our efforts. It should take priority over underutilized code.

Help me solve a bug

The more data we have the better chance we have of reproducing and fixing bugs.

When users experience bugs in production, we should be getting stability reports for them. These reports are often stack traces, call logs, and mostly confusing error messages that don’t really give us a clear idea of what happened.

With analytics events, you’ll be able to see exactly how the user used the app, what screen they were on, and which buttons they tapped. With all this data, reproducing a bug is much easier. You have an increased chance of finding and fixing a bug.

Getting more tools to solve bugs is always a good investment to make.

I have personally assigned weeks to remove dead code or improve highly utilized code. It’s worth the investment of spending a day or two convincing a client or your team that you should delete some code from the code base to reduce the burden of maintaining it for no benefit.

It’s a task you can do, as a developer, where you write little new code, but have a massive impact.

I hope you enjoyed this post.

The post Developers need this more first appeared on Striver Technosoft.

]]>
Are bugs and slow delivery ok? http://www.strivertech.com/are-bugs-and-slow-delivery-ok/?utm_source=rss&utm_medium=rss&utm_campaign=are-bugs-and-slow-delivery-ok Thu, 01 Feb 2024 06:52:32 +0000 https://www.strivertech.com/?p=6949 Are bugs and slow delivery ok? The majority of the IT industry operates with low-quality development and survives. However, there are companies where quality is not an option. High quality is NOT for everyone. Does it make sense for your company? We’ve compiled a checklist of questions to find out the answer. 95% of companies […]

The post Are bugs and slow delivery ok? first appeared on Striver Technosoft.

]]>

Are bugs and slow delivery ok?

The majority of the IT industry operates with low-quality development and survives. However, there are companies where quality is not an option.

High quality is NOT for everyone.

Does it make sense for your company?

We’ve compiled a checklist of questions to find out the answer.

Navigating the Quality Quandary: The Impact of Bugs and Slow Delivery

95% of companies can survive with low quality

Quality standards in the software development industry are generally quite low. Quality is a nice-to-have, something on the wishlist. But quality is not a must-have. The following are some symptoms that you don’t need high quality:

  • Bugs are ok. When a bug occurs, the impact is small. There isn’t any major financial loss no reputation loss no legal/regulatory risk.

  • Slow bug fix delivery is ok. If the bug fix gets delivered in a week or month, it doesn’t matter that much. It can wait. There isn’t much of a loss.

  • Slow feature delivery is ok. It doesn’t matter if new features are delivered rarely. Business complains and wants faster, but they accept the slowness.

  • Wasting time is ok. Developers spend most of their day manually debugging the code and fixing regression bugs – it’s ok.

  • Burnout is ok. The team is working overtime, facing stress and health problems. Delivery is unsustainable. More mistakes are made. But, it’s ok. When the team gets burned out, the developers can be replaced.

5% of companies can NOT compromise on quality

The following are some industries where high-quality standards are NOT optional. Quality is not a choice. Examples include:
 
  • Financial Services & Payments Processing

  • Manufacturing & Industrial Automation

  • Logistics, Warehouse & Retail

What’s the impact:

  • Bugs are NOT ok. Even one bug has a high cost. The cost may involve financial losses, and reputation losses – leading to loss of customers, hence revenue loss as well as lawsuits.

  • Slow bug fix delivery is NOT ok. In case a bug is discovered in production, the customer expects a fix ASAP. Every minute that passes by is costly.

  • Slow feature delivery is NOT ok. The market is competitive. When the business has high-priority features, they don’t want to wait for months to release.

  • Wasting time is NOT ok. The company does not want the team to do repetitive manual work. It is unacceptable to spend most of the day debugging and fixing regression bugs when that could be prevented through automated tests.

  • Burnout is NOT ok. The company’s product is so critical, that sustainable delivery must be ensured. Heroism and firefighting are not an option.

Should you invest in software quality?

For 95% of companies, the answer is: No.

These companies survive fine with low quality, there is NO business incentive to invest in quality at all. Quality will just remain a nice-to-have, but low on the priority list. Sometimes the company may invest in technical improvements – but they will remain as just wishlists and no actual change will occur.

For 5% of companies, the answer is: Yes.

These companies can NOT compromise on quality. Either the company will ensure high quality standards or the business will close down. There is no choice. Quality is a must-have. This means there is a business imperative for quality.

Unlocking Quality Software in 2024: A Striver Solution

Q: How can companies in the 5% bracket ensure top-notch software quality?

A: Striver offers a direct route! Skip the trial-and-error phase with our tailored Technical Coaching. Transform your real product in months, not years.

🚀 Connect with Striver for Quality Software Products! Launch your MVP and ensure a bug-free product.

✉ Contact us at info@strivertech.com.

Are bugs and slow delivery ok?

The post Are bugs and slow delivery ok? first appeared on Striver Technosoft.

]]>
Unlock Success with React Native: Best Practices by Striver http://www.strivertech.com/unlock-success-with-react-native-best-practices-by-striver/?utm_source=rss&utm_medium=rss&utm_campaign=unlock-success-with-react-native-best-practices-by-striver Wed, 31 Jan 2024 06:54:30 +0000 https://www.strivertech.com/?p=6942 React Native Best Practices Understanding Best Practices in Coding In the coding world, ‘best practices’ refer to guidelines rather than strict rules. While it may seem optional initially, adhering to these suggestions is crucial as your codebase expands. While your code might function adequately without them initially, maintaining its health and readability becomes increasingly challenging […]

The post Unlock Success with React Native: Best Practices by Striver first appeared on Striver Technosoft.

]]>

React Native Best Practices

Understanding Best Practices in Coding

In the coding world, ‘best practices’ refer to guidelines rather than strict rules. While it may seem optional initially, adhering to these suggestions is crucial as your codebase expands. While your code might function adequately without them initially, maintaining its health and readability becomes increasingly challenging as it grows.

 

Alright, let’s get down to the main point. What are the React Native best practices? Well, they’re a bunch of guidelines that you can follow to create a maintainable codebase. In this article, we’ll go into more detail about these practices.

Are you delving into React Native development and striving for excellence in your mobile app projects? Striver brings you valuable insights and best practices to guide you on your journey to success.

Top 6 React Native Best Practices for 2024

Top 6 React Native Best Practices for 2024
1. Use TypeScript with Your React Native App

TypeScript is a statically typed programming language which means it requires explicitly defining the data types for variables, functions, and other elements. This not only leads to more reliable code but also helps developers catch bugs during the compilation process.

Consider the following to calculate the order price

function calculatePrice(order) {
return order.price + 200;
}

The current code works fine, but it doesn’t tell us much about what properties the order object contains, which could lead further to a crash if we try to access a property that doesn’t exist.

To prevent the crash and enhance readability, we can use TypeScript. TypeScript is a programming language that adds types to JavaScript. This means that we can specify the type of each property in the object, which will help us avoid errors.

interface Order {
price: number;
name: string;
taxPercentage: number;
}
function calculatePrice(order: Order) {
const { price, taxPercentage } = order;
const taxValue = price * taxPercentage;
return price + taxValue;
}

Here is the same function, but now you and your editor are aware of the object properties and their types in code, which makes it easier to extend the functionality.

2. Functional Components over the Class Components

In React Native, you will have two main components: Functional and Class components. But functional components are the way to go in React Native. They’re simpler, more concise, and faster than class components. This makes them easier to read, write, and test. Plus, they can improve your app’s performance.

If you’re not sure what components are, they’re functions that return React elements. So if you’re looking for a way to improve your React Native code, use functional components over class components. They’re the future of React Native development.

Class Component Example

import React, { Component } from 'react';
class ClassComponent extends Component {
constructor(props) {
super(props);
this.state = {
count: 0,
};
}
incrementCount = () => {
this.setState({ count: this.state.count + 1 });
};
render() {
return (
<View>
<Text style={styles.h1}>Class Component</Text>
<Text>Count: {this.state.count}</Text>
<Button title='Increment' onPress={this.incrementCount}/>
</View>
);
}
}
export default ClassComponent;

In this class component example, we’re using the Component class from React to create a component. The state is managed within the component’s constructor, and the render method defines the component’s UI.

Functional Component Example

import React, { useState } from 'react';
const FunctionalComponent = () => {
const [count, setCount] = useState(0);
const incrementCount = () => {
setCount(count + 1);
};
return (
<View>
<Text style={styles.h1}>Functional Component</Text>
<Text>Count: {count}</Text>
<Button title='Increment' onPress={incrementCount}/>
</View>
);
};
export default FunctionalComponent;

In this functional component example, we’re using the useState hook from react to manage state. The component is defined as a simple JavaScript function that returns JSX to render the UI.

3. Import your dependencies in order

When you have a bunch of imports in one file, it could be a headache trying to find that one specific import you need if you have not organized your imports properly. Therefore it is essential to order imports invariably.

At the same time, you should also ensure that the dependencies have a proper sequence of imports. If the order is not correct, it can affect how components behave and lead to bugs that are hard to find.

Here’s an example of how you can organize your imports:

  1. External imports — react
  2. Internal imports, like relative paths — ../button
  3. In folder imports like ./styles.ts
  4. The imports may be sorted alphabetically in every group
  5. Every group must be divided by white space
import React from 'react';
import { TouchableOpacity, View } from 'react-native';
import { Button, Card } from '../components'
import { MainLayout } from '../layouts'
import { StyledCard } from './styles.ts'

You can use formatting tools like Eslint and Prettier to automate and enforce the correct import order to avoid such issues.

4. Use Path Alias to avoid long imports

Path aliases are a way to create shorter and more meaningful import paths in your code. This can be helpful when you have a deep or nested folder structure, and it can make your imports easier to read and understand.

For example, instead of writing a long import like this:

import { IconButton } from '../../components/buttons';
import { CircleButton } from 'components/buttons';
OR
import { CircleButton } from 'buttons';

Here’s how to use path aliases in both TypeScript and React Native to create shorter and more meaningful import paths in your code.

Here’s how to use path aliases in both TypeScript and React Native to create shorter and more meaningful import paths in your code.

  1. Path Alias in TypeScript
  • Create or update the tsconfig.json file in your project if it doesn’t exist already.
  • Set the baseUrl to . , which represents the root of the directory. This sets the starting point for all path aliases.
  • Add path aliases to the paths object. In this example, we have two path aliases defined:
// tsconfig.json
{
"extends": "expo/tsconfig.base",
"compilerOptions": {
"strict": true,
// Path alias config
"baseUrl": ".",
"paths": {
// This needs to be mirrored in babel.config.js
// Components is a directory with sub directories
"components/*": ["src/components/*"],
// We want to expose the exports of the buttons index file
"buttons": ["src/components/buttons/index"]
}
}
}

Now, TypeScript will be able to understand and parse the following imports:

import { CircleButton } from "components/buttons"
import { CircleButton } from "buttons"

2. React Native Path Alias

First, install the babel-plugin-module-resolver as a developer dependency

yarn add - dev babel-plugin-module-resolver
npm install babel-plugin-module-resolver - save-dev

Now we can update the babel.config.js file to use the **module-resolver**plugin and point to our directories.

**// babel.config.js**
module.exports = function (api) {
api.cache(true)
return {
presets: ["babel-preset-expo"],
plugins: [
[
"module-resolver",
{
alias: {
// This needs to be mirrored in tsconfig.json
components: "./src/components",
buttons: "./src/components/buttons",
},
},
],
],
}
}
5. Create Responsive Layout in Your React Native App

Responsive style properties in React refer to the use of functions to create an adaptive user interface or a layout that adjusts to various screen sizes and orientations. Developing a responsive React Native app can be done in multiple ways, and one of them is by using react-native-normalize. This handy library offers functions that help you create responsive layouts effortlessly.

6. Implement Crash Analytics Tools

Crash analytics tools are like your magic tools that keep an eye on your app 24/7. They do real-time monitoring to help you identify crashes and errors. These tools analyze the crash data and give you the lowdown on what’s causing the chaos.

So, if you’re in the development process, and suddenly, the app crashes out of the blue. With the implementation of crash analytics, you can easily find the root causes of these crashes.

There are a bunch of awesome crash analytics tools out there, like Sentry, Firebase, Crashlytics, and more. They’re like your trusty companions, helping you debug and rescue your app from potential crashes.

Dive Deeper with Striver

For an in-depth exploration of these React Native best practices and more, read our featured blog on Medium: React Native Best Practices by Striver.

At Striver, we are committed to empowering developers and businesses with the knowledge and expertise needed to excel in the dynamic world of React Native development. Stay tuned for more insightful content, and let’s shape the future of mobile app development together.

Ready to elevate your React Native projects? Connect with Striver, your trusted partner in innovative software solutions.

 

🚀💻 #ReactNative #MobileAppDevelopment #BestPractices #StriverTech #SoftwareDevelopment #TechInnovation

The post Unlock Success with React Native: Best Practices by Striver first appeared on Striver Technosoft.

]]>
Flutter Version Management with FVM: Your New Favorite Tool http://www.strivertech.com/flutter-version-management-with-fvm-your-new-favorite-tool/?utm_source=rss&utm_medium=rss&utm_campaign=flutter-version-management-with-fvm-your-new-favorite-tool Tue, 19 Dec 2023 07:44:15 +0000 https://www.strivertech.com/?p=6927 Flutter Version Management with FVM: Your New Favorite Tool Explore how Flutter Version Manager (FVM) simplifies managing multiple Flutter versions, from setup to use. Understanding FVM Have you ever faced a situation when you just upgraded your version of Flutter, but the project you were working on is not yet ready to migrate to the […]

The post Flutter Version Management with FVM: Your New Favorite Tool first appeared on Striver Technosoft.

]]>

Flutter Version Management with FVM: Your New Favorite Tool

Explore how Flutter Version Manager (FVM) simplifies managing multiple Flutter versions, from setup to use.

Understanding FVM

Have you ever faced a situation when you just upgraded your version of Flutter, but the project you were working on is not yet ready to migrate to the new version? Now you have to think about how to downgrade your Flutter SDK. Or a situation when you are working on multiple projects at the same time, and each one uses a different Flutter version? And you have to constantly switch between them, which can be very long and tiring.

If you’ve encountered these or other problems with Flutter versions, then you might be thinking, “Hmm, there must be an easier way to deal with this.” And there is. Here is where FVM comes into play.

💡
Flutter Version Manager (FVM) – a simple CLI to manage Flutter SDK versions. It allows you to have multiple versions of Flutter and easily switch between them.

Installation

You have a few options to install FVM:

  • Install it as pub package:
    dart pub global activate fvm
    
  • Install it by running the following command from Homebrew package manager (for MacOS and Linux):
    brew tap leoafarias/fvm
    brew install fvm
    
  • Install it by running the following command from your command line or PowerShell (for Windows):
    choco install fvm
    

Configuration

You can set you cache path (location where the Flutter SDK versions will be stored) running the following command:

fvm config --cache-path <CACHE_PATH>

To list your configurations:

fvm config

You can also configure your IDE for better FVM experience. More info you can find in the documentation.

Basic Commands

Here is a list of basic FVM commands:

  • To set Flutter SDK version to your project you can use the following command:

    fvm use {version}
    

    If you don’t have specified version in your cache directory, FVM will ask if you want to install it.

  • To list all installed Flutter SDK versions:

    fvm list
    
  • To install the desired Flutter SDK version:

    fvm install {version}
    

    If you don’t specify version here, the version found in project config will be installed.

    Sometimes Flutter release can be displayed on multiple channels. FVM will sort them by stability and use the most stable one. FVM uses the following priority: Stable → Beta → Dev.

    You can force FVM to install Flutter SDK version from a specific channel:

    fvm use {version@channel}
    

    for example:

    fvm use 2.2.2@beta
    
  • To list all Flutter SDK releases available to install:

    fvm releases
    
  • To remove Flutter SDK version:

    fvm remove {version}
    

    Will impact any project that depend on that version!

  • To show information about environment and project configuration:

    fvm doctor
    
  • To spawn a command on any installed Flutter SDK:

    fvm spawn
    

    for example:

    fvm spawn master analyze
    

    Will run Flutter analyze on the master channel.

.fvm folder

After running fvm use command .fvm directory will be created in your project.

  • .fvm/flutter_sdk – a relative symlink in your project to the cache of the selected version. It is recommended to add it to your .gitignore file. Just copy and paste the following line:

    .fvm/flutter_sdk
    
  • .fvm/fvm_config.json defines what version of Flutter and flavors (more on that later) you are using in this project.

Running Flutter App

Normally if you want to run your project you will use flutter run command. If you want to use FVM you should run fvm flutter run instead. You can do the same with other commands – just add fvm prefix:

fvm flutter {command}
# instead of
flutter {command}

Same with dart commands:

fvm dart {command}
# instead of 
dart {command}

You can call desired installed SDK directly using the symlink:

.fvm/flutter_sdk/bin/flutter {command}

Project Flavors

You can also set Flutter SDK versions for your project flavors.

💡
Flavors are build configurations that allow you to create separate environments for your application using the same code base.

To specify a Flutter SDK version for a flavor you can use the following command:

fvm use {version} --flavor {flavor_name}

To list all of your flavors:

fvm flavor

To choose which flavor to use:

fvm flavor {flavor_name}

Examples:

fvm use 3.10.4 --flavor dev
fvm use 3.7.0 --flavor prod
fvm flavor dev

It will create the following configuration in fvm_config.json file for your project:

{
    "flutterSdkVersion": "3.10.4",
    "flavors": {
        "dev": "3.10.4",
        "prod": "3.7.0"
    }
}

When we run the project Flutter SDK version 3.10.4 will be used.

Advanced

  • You can use your custom Flutter versions (forks). For this, the folder with this version should be inside FVM cache directory. You can set your version by running fvm use command:

    fvm use {custom_name}
    
  • You are able to install and bind a specific framework revision by providing the git commit or short hash:

    fvm use striver
    

Conclusion

In conclusion, Flutter Version Management with FVM is a game-changer for Flutter developers. Whether you’re working on multiple projects with different Flutter dependencies or simply want more control over your development environment, FVM has you covered.

Integrate FVM into your workflow today and experience the freedom to explore new Flutter releases without compromising your existing projects. Stay ahead in the Flutterverse with FVM!

Flutter Version Management with FVM: Striver

The post Flutter Version Management with FVM: Your New Favorite Tool first appeared on Striver Technosoft.

]]>
Fixed Price vs. Hourly Projects http://www.strivertech.com/fixed-price-vs-hourly-projects/?utm_source=rss&utm_medium=rss&utm_campaign=fixed-price-vs-hourly-projects Mon, 04 Dec 2023 05:17:00 +0000 https://www.strivertech.com/?p=6919 Fixed Price vs. Hourly Projects Decoding Freelance Rates: Fixed vs. Hourly Projects Unravel the complexities of freelance project pricing with Upwork’s latest infographic, comparing Fixed Price and Hourly Projects. In this concise guide, we break down the nuances of each pricing model, empowering freelancers to make strategic decisions tailored to their projects. The type of […]

The post Fixed Price vs. Hourly Projects first appeared on Striver Technosoft.

]]>

Fixed Price vs. Hourly Projects

Decoding Freelance Rates: Fixed vs. Hourly Projects

Unravel the complexities of freelance project pricing with Upwork’s latest infographic, comparing Fixed Price and Hourly Projects. In this concise guide, we break down the nuances of each pricing model, empowering freelancers to make strategic decisions tailored to their projects.

The type of contract you initially propose can depend on some considerations, such as the timeline, budget, and complexity. With these factors in mind, let’s take a look at both types of projects and how each can be used by your team.

Fixed price vs. Hourly Project on Upwork: Striver

Navigating Stability with Fixed Price:

Fixed-price projects offer stability and budget predictability. Ideal for well-defined tasks, this model sets a predetermined cost for the entire project. Clients benefit from upfront budget clarity, while freelancers thrive in an environment with clear, stable requirements.

Pros:

  • Budget Assurance: Clients know costs upfront.
  • Scope Precision: Suited for projects with clear, stable requirements.

Cons:

  • Limited Flexibility: Adjustments may incur additional costs.
  • Timeline Rigidity: Delays can disrupt the agreed-upon schedule.

Embracing Flexibility through Hourly Rates: 

Hourly Rate projects introduce flexibility, allowing clients to pay for actual hours worked. Suited for dynamic projects, this model fosters adaptability and continuous collaboration. However, budget variability and diligent scope management are key considerations.

Pros:

  • Adaptability: Ideal for projects with evolving requirements.
  • Communication Flow: Frequent updates and collaboration.

Cons:

  • Budget Variability: Total costs may fluctuate.
  • Scope Management: Requires diligent monitoring to prevent scope creep.

Making Strategic Decisions:

Choosing between Fixed Price and Hourly Rate projects hinges on understanding your project’s nature. Fixed Price provides stability, while Hourly Rate offers adaptability. Assess your project’s scope, potential changes, and your comfort with flexibility before deciding.

Collaboration Opportunities:

If you’re seeking collaborative opportunities or have questions about project pricing, our skilled team is ready to assist. Explore collaboration possibilities with us!

The post Fixed Price vs. Hourly Projects first appeared on Striver Technosoft.

]]>
A Guide to Open Source OpenAPI Comment Parser http://www.strivertech.com/a-guide-to-open-source-openapi-comment-parser/?utm_source=rss&utm_medium=rss&utm_campaign=a-guide-to-open-source-openapi-comment-parser Fri, 01 Dec 2023 04:04:57 +0000 https://www.strivertech.com/?p=6907 Document APIs with open source OpenAPI Comment Parser Generate the OpenAPI spec from the comments line with your code Whether you’re building an application or website, great documentation is crucial to the success of your service. Developers need instructions on how to use your API, and they need a way to try it out. Good […]

The post A Guide to Open Source OpenAPI Comment Parser first appeared on Striver Technosoft.

]]>

Document APIs with open source OpenAPI Comment Parser

Generate the OpenAPI spec from the comments line with your code

Whether you’re building an application or website, great documentation is crucial to the success of your service. Developers need instructions on how to use your API, and they need a way to try it out. Good documentation handles both.

The OpenAPI Specification is an open standard for defining and documenting your API. The OpenAPI Specification enables the generation of great documentation, but creating an OpenAPI spec takes a lot of time and effort to create and keep up-to-date. Often, the OpenAPI spec ends up a large, forgotten, thousand-line file.

To help make it as easy as possible to document an API, today we are launching the OpenAPI Comment Parser. The goal of OpenAPI Comment Parser is to give developers a way to generate this OpenAPI spec from comments inline with their code. When the OpenAPI spec lives inside the code, developers are much more likely to keep it up-to-date as their code changes.

This approach brings the OpenAPI spec to the code. It gets broken up into smaller, more manageable pieces. It lives next to the code that it’s describing. This enables developers to easily update the relevant spec when code changes and don’t have to go searching in the giant spec file. We are also introducing a new spec format that is tailor-made for being written in comments. On average, this new format has been shown to reduce the amount of spec needed to be written by 50 percent.

The library is built for Node.js, but the CLI can work with any language that uses this style of comments:

Whether you’re building an application or website, great documentation is crucial to the success of your service. Developers need instructions on how to use your API, and they need a way to try it out. Good documentation handles both.

The OpenAPI Specification is an open standard for defining and documenting your API. The OpenAPI Specification enables the generation of great documentation, but creating an OpenAPI spec takes a lot of time and effort to create and keep up-to-date. Often, the OpenAPI spec ends up a large, forgotten, thousand-line file.

To help make it as easy as possible to document an API, today we are launching the OpenAPI Comment Parser. The goal of OpenAPI Comment Parser is to give developers a way to generate this OpenAPI spec from comments in line with their code. When the OpenAPI spec lives inside the code, developers are much more likely to keep it up-to-date as their code changes.

This approach brings the OpenAPI spec to the code. It gets broken up into smaller, more manageable pieces. It lives next to the code that it’s describing. This enables developers to easily update the relevant spec when code changes and don’t have to go searching in the giant spec file. We are also introducing a new spec format that is tailor-made for being written in comments. On average, this new format has been shown to reduce the amount of spec needed to be written by 50 percent.

The library is built for Node.js, but the CLI can work with any language that uses this style of comments:

/**
 * GET /users/{userId}
 * @summary Returns a user by ID.
 * @pathParam {int64} userId - The user's ID.
 * @response 200 - OK
 */

We plan on expanding to the most popular languages.

See the OpenAPI Comment Parser in action

In the following video, I walk you through a sample scenario that shows how to use the OpenAPI Comment Parser to create documentation for a Node.js API.

How can this make a developer’s life easier?

The Comment Parser automatically creates better documentation with less code that is more manageable. On top of these improvements, developers writing the API can use the documentation generated from the Comment Parser to test their API. This means less time waiting for a frontend to be built or having to rely on other tools in order to test drive their API.

Try it today

We built this tool to solve some of the problems we face everyday developing services at Striver. Now, developers can try out the new tool on GitHub.

 

Get the code

The post A Guide to Open Source OpenAPI Comment Parser first appeared on Striver Technosoft.

]]>
Unlocking Efficiency: Best Practices for GraphQL Queries in React Native http://www.strivertech.com/unlocking-efficiency-best-practices-for-graphql-queries-in-react-native/?utm_source=rss&utm_medium=rss&utm_campaign=unlocking-efficiency-best-practices-for-graphql-queries-in-react-native Thu, 30 Nov 2023 05:43:00 +0000 https://www.strivertech.com/?p=6900 Unlocking Efficiency: Best Practices for GraphQL Queries in React Native Introduction:GraphQL has revolutionized the way we interact with APIs, providing flexibility and efficiency. In this blog, we’ll explore some best practices for crafting GraphQL queries in React Native, enhancing the performance and maintainability of your applications. Understanding GraphQL Queries: GraphQL allows you to request only […]

The post Unlocking Efficiency: Best Practices for GraphQL Queries in React Native first appeared on Striver Technosoft.

]]>

Unlocking Efficiency: Best Practices for GraphQL Queries in React Native

Introduction:
GraphQL has revolutionized the way we interact with APIs, providing flexibility and efficiency. In this blog, we’ll explore some best practices for crafting GraphQL queries in React Native, enhancing the performance and maintainability of your applications.

Understanding GraphQL Queries:
GraphQL allows you to request only the data you need, minimizing the payload size and speeding up data retrieval. Here are some best practices to make the most of your GraphQL queries:

1. Be Specific with Field Selection: Rather than requesting all fields, specify only the ones your component needs. This reduces unnecessary data transfer and improves response times.

Example:

query {
user(id: "123") {
name
email
}
}

2. Utilize Fragments for Reusability: Define fragments for commonly used fields to keep queries DRY (Don’t Repeat Yourself) and enhance code maintainability.

Example:

fragment UserInfo on User {
name
email
}

query {
user(id: "123") {
...UserInfo
}
allUsers {
...UserInfo
}
}

3. Pagination for Large Data Sets: Implement pagination when dealing with large datasets. Use first, last, before, and after arguments to request a specific subset of data.

Example:

query {
posts(first: 10, after: "cursor") {
pageInfo {
hasNextPage
}
edges {
node {
title
}
}
}
}

4. Avoid Deeply Nested Queries: Keep queries flat to prevent over-fetching. Nesting queries too deeply can lead to performance issues.

Example:

query {
user(id: "123") {
posts {
comments {
text
}
}
}
}

5. Use Aliases for Clarity: Aliases help in differentiating between multiple queries of the same type in a single request, enhancing code readability.

Example:

query {
userPosts: user(id: "123") {
posts {
title
}
}
allPosts: posts {
title
}
}
Unlock a wealth of resources with a single request from GraphQL! 🌐

Conclusion:

By following these best practices, you can optimize your GraphQL queries in React Native, resulting in faster data retrieval, improved app performance, and streamlined code. Experiment with these techniques in your projects and witness the efficiency GraphQL can bring to your React Native applications.

The post Unlocking Efficiency: Best Practices for GraphQL Queries in React Native first appeared on Striver Technosoft.

]]>