<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jai Stellmacher</title>
    <description>The latest articles on DEV Community by Jai Stellmacher (@jstellmacher).</description>
    <link>https://dev.to/jstellmacher</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1049008%2F81bb671d-1f48-407c-983b-bac4e3a6dc38.png</url>
      <title>DEV Community: Jai Stellmacher</title>
      <link>https://dev.to/jstellmacher</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jstellmacher"/>
    <language>en</language>
    <item>
      <title>Effective Strategies for Error Handling and Debugging in React Web Development and Backend Python Development</title>
      <dc:creator>Jai Stellmacher</dc:creator>
      <pubDate>Sat, 01 Jul 2023 20:50:50 +0000</pubDate>
      <link>https://dev.to/jstellmacher/effective-strategies-for-error-handling-and-debugging-in-react-web-development-and-backend-python-development-20ca</link>
      <guid>https://dev.to/jstellmacher/effective-strategies-for-error-handling-and-debugging-in-react-web-development-and-backend-python-development-20ca</guid>
      <description>&lt;p&gt;Photo above from &lt;a href="https://pixabay.com/" rel="noopener noreferrer"&gt;Pixabay&lt;/a&gt; by the creator &lt;a href="https://pixabay.com/users/mohamed_hassan-5229782/" rel="noopener noreferrer"&gt;mohamed_hassan&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;As a developer, encountering errors and bugs in your code is inevitable. However, the way you handle these errors and go about debugging can make a significant difference in the efficiency and quality of your work. In this article, I will go over basic strategies for handling errors and debugging in two popular domains: React web development and backend Python development. By following these best practices, you can streamline your development process and create more robust applications. (I chose these two places because I have been creating projects in this realm for a while. I have struggled a bit myself, so why not write about it?)&lt;/p&gt;

&lt;h2&gt;
  
  
  Error Handling in React Web Development:
&lt;/h2&gt;

&lt;p&gt;React is a widely used JavaScript library for constructing user interfaces. When it comes to handling errors in React web development, the following techniques can be super helpful!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Utilize Error Boundaries:
React provides Error Boundaries, a built-in feature that traps JavaScript errors within a component's tree and prevents the entire application from crashing. By defining Error Boundary components at strategic points in your application, you can gracefully manage and display error messages to users while maintaining application stability.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';

class ErrorBoundary extends React.Component {
  constructor(props) {
    super(props);
    this.state = { hasError: false };
  }

  static getDerivedStateFromError(error) {
    // Update state to display fallback UI
    return { hasError: true };
  }

  componentDidCatch(error, errorInfo) {
    // Log the error to an error reporting service
    console.error(error);
    // You can also log the errorInfo, which contains component stack trace
    console.error(errorInfo);
  }

  render() {
    if (this.state.hasError) {
      // Render fallback UI when an error occurs
      return &amp;lt;div&amp;gt;Oops! Something went wrong.&amp;lt;/div&amp;gt;;
    }

    // Render the component tree when no error occurred
    return this.props.children;
  }
}

export default ErrorBoundary;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above is how to implement it with notes. Below is how to make sure it is affecting your code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import ErrorBoundary from './ErrorBoundary';
import MyComponent from './MyComponent';

function App() {
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;h1&amp;gt;Welcome to My App&amp;lt;/h1&amp;gt;
      &amp;lt;ErrorBoundary&amp;gt;
        &amp;lt;MyComponent /&amp;gt;
      &amp;lt;/ErrorBoundary&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

export default App;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2. Implement Proper Logging:&lt;br&gt;
Logging plays a vital role in identifying and diagnosing errors. Employ logging libraries like console.log, console.error, or more advanced tools like logrocket to log relevant information about the error, including stack traces, component hierarchies, and state snapshots. These logs can assist in reproducing and comprehending the context in which the error occurred.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react';

function Form() {
  const [name, setName] = useState('');
  const [email, setEmail] = useState('');
  const [error, setError] = useState('');

  const handleSubmit = (e) =&amp;gt; {
    e.preventDefault();

    if (!name || !email) {
      setError('Please fill in all fields');
      return;
    }

    // Perform form submission logic here...

    // If an error occurs during submission, log the error
    try {
      // Code for form submission...
    } catch (error) {
      console.error('Form submission error:', error);
      setError('An error occurred during form submission');
    }
  };

  return (
    &amp;lt;form onSubmit={handleSubmit}&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;label&amp;gt;Name:&amp;lt;/label&amp;gt;
        &amp;lt;input
          type="text"
          value={name}
          onChange={(e) =&amp;gt; setName(e.target.value)}
        /&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div&amp;gt;
        &amp;lt;label&amp;gt;Email:&amp;lt;/label&amp;gt;
        &amp;lt;input
          type="email"
          value={email}
          onChange={(e) =&amp;gt; setEmail(e.target.value)}
        /&amp;gt;
      &amp;lt;/div&amp;gt;
      {error &amp;amp;&amp;amp; &amp;lt;div className="error"&amp;gt;{error}&amp;lt;/div&amp;gt;}
      &amp;lt;button type="submit"&amp;gt;Submit&amp;lt;/button&amp;gt;
    &amp;lt;/form&amp;gt;
  );
}

export default Form;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above example, I am logging errors in a form. &lt;/p&gt;

&lt;p&gt;3. Using Chrome DevTools to Catch Bugs - Step by Step:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open your website or web application in Google Chrome.&lt;/li&gt;
&lt;li&gt;Right-click on the page and select "Inspect" from the context menu.&lt;/li&gt;
&lt;li&gt;This will open the Chrome DevTools panel. Navigate to the "Console" tab.&lt;/li&gt;
&lt;li&gt;Look for any red error messages or warning messages in the console. These indicate bugs or issues in your code.&lt;/li&gt;
&lt;li&gt;Click on the error message to see the details and the line of code where the error occurred.&lt;/li&gt;
&lt;li&gt;Use the "Elements" tab to inspect and modify the HTML structure and CSS styles of your page. This can help identify layout issues and incorrect styling.
Utilize the "Sources" tab to debug JavaScript code. &lt;/li&gt;
&lt;li&gt;Set breakpoints by clicking on the line numbers, which will pause the execution of your code at that point.&lt;/li&gt;
&lt;li&gt;Use the controls (step into, step over, step out) to navigate through your code line by line and observe variable values, function calls, and control flow.&lt;/li&gt;
&lt;li&gt;Examine network requests, performance metrics, and resource usage in the "Network" and "Performance" tabs to identify potential bottlenecks or issues with API calls.&lt;/li&gt;
&lt;li&gt;Leverage other features in Chrome DevTools, such as the "Application" tab for inspecting local storage, cookies, and service workers, to further analyze and debug your application.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Python Degugging! Backend Development:
&lt;/h2&gt;

&lt;p&gt;Python is a versatile programming language commonly employed for backend development. When it comes to debugging Python applications, the following strategies can prove beneficial:&lt;/p&gt;

&lt;p&gt;1.\ Utilize Exception Handling:&lt;br&gt;
Python's exception handling mechanism allows you to catch and handle errors gracefully. Use try-except blocks to encapsulate code segments that might generate exceptions. By catching specific exceptions and providing meaningful error messages, you can guide users and swiftly identify potential issues.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Example of exception handling in Python
try:
    # Code that may raise an exception
    result = divide(dividend, divisor)
except ZeroDivisionError:
    # Handle a specific exception
    print("Cannot divide by zero.")
except Exception as e:
    # Handle other exceptions
    print(f"An error occurred: {str(e)}")

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2. Python's IPDB - a wonderful and easy debugging tool (I used it a lot in my most recent fullstack application. I had a slightly complex backend schema and needed a lot of debugging):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import ipdb

def divide(a, b):
    result = a / b
    return result

def main():
    ipdb.set_trace()  # Set a breakpoint

    dividend = 10
    divisor = 0

    try:
        result = divide(dividend, divisor)
        print("Result:", result)
    except ZeroDivisionError:
        print("Cannot divide by zero.")
    except Exception as e:
        print(f"An error occurred: {str(e)}")

if __name__ == '__main__':
    main()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code snippet above, you need to import the dependency. &lt;code&gt;import ipdb&lt;/code&gt; then also figure out where to put the debugger. Use the &lt;code&gt;ipdb.set_trace()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Luckily, Python is pretty linear. Trying to figure out where it can go is pretty easy, just try putting it in many places at first until you notice the patterns. (I look for where logic might start and put it there at first.) In the snippet above, I threw it in the center and explain more below.&lt;/p&gt;

&lt;p&gt;In this example above, we have a function divide() that performs division between two numbers. The ipdb.set_trace() statement sets a breakpoint, allowing you to pause the execution of the program at that point and enter the debugger mode.&lt;/p&gt;

&lt;p&gt;When you run the script and reach the breakpoint, the ipdb debugger will be activated. You can then interactively debug your code by executing various commands such as inspecting variables, stepping through code execution, and evaluating expressions. Some commonly used commands in ipdb include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;n (next): Execute the next line of code.&lt;/li&gt;
&lt;li&gt;s (step): Step into a function call.&lt;/li&gt;
&lt;li&gt;c (continue): Resume execution until the next breakpoint or program completion.&lt;/li&gt;
&lt;li&gt;l (list): Show the code around the current line.&lt;/li&gt;
&lt;li&gt;p (print): Print the value of a variable or expression.&lt;/li&gt;
&lt;li&gt;q (quit): Exit the debugger and stop the program.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;3. Another way to debug Python is by using print statements that may be similar to React's console.logs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def divide(a, b):
    print(f"Dividing {a} by {b}")
    result = a / b
    print(f"Result: {result}")
    return result

def main():
    dividend = 10
    divisor = 0

    try:
        result = divide(dividend, divisor)
        print("Result:", result)
    except ZeroDivisionError:
        print("Cannot divide by zero.")
    except Exception as e:
        print(f"An error occurred: {str(e)}")

if __name__ == '__main__':
    main()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Within the divide() function, I use print statements to display the values being divided (a and b) before the division occurs and also print the result afterward.&lt;/p&gt;

&lt;p&gt;In the main() function, I catch potential exceptions and use print statements to display error messages when a ZeroDivisionError occurs or when any other exception is raised.&lt;/p&gt;

&lt;p&gt;By strategically placing print statements at various points in your code, you can track the flow, variable values, and observe the execution process to identify potential issues and debug your Python applications effectively.&lt;/p&gt;

&lt;p&gt;4. Lastly, there are many other specific and more complex ways to track your bugs in Python such as a tool like logging. It can help track the flow of data and user interaction.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import logging

logging.basicConfig(filename='login.log', level=logging.INFO)

def login(username, password):
    # Authenticating logic
    if username == 'admin' and password == 'password':
        logging.info(f"Successful login for user: {username}")
        return True
    else:
        logging.warning(f"Failed login attempt for user: {username}")
        return False

def main():
    username = input("Enter username: ")
    password = input("Enter password: ")

    if login(username, password):
        print("Login successful")
    else:
        print("Login failed")

if __name__ == '__main__':
    main()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above is an altered (and incredibly simplified) version of my Login code (if I were to do it in the backend). The login() function performs the authentication logic. If the provided username and password match the expected values, a successful login message is logged. Otherwise, a warning message is logged.&lt;/p&gt;

&lt;p&gt;In the main() function, I prompt the user for their credentials and pass them to the login() function. If the login is successful, I print a corresponding message. Otherwise, I print a failure message.&lt;/p&gt;

&lt;p&gt;By using logging, you can monitor successful logins and failed login attempts, allowing you to investigate any suspicious activities or issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion:
&lt;/h2&gt;

&lt;p&gt;Effectively handling errors and debugging code is crucial for maintaining the quality and reliability of your React web applications and Python backend systems. By following the strategies outlined in this article, including utilizing error boundaries, proper logging, and integrating debugging tools, you can streamline the development process, identify and resolve issues efficiently, and deliver robust and stable software solutions to your users. Remember, error handling and debugging are continuous processes that require constant attention and improvement to ensure the smooth functioning of your applications.&lt;/p&gt;

&lt;p&gt;I too am in a continuous learning process and will continue to find better ways to get through my code and work backwards or logic through! Please feel free to leave feedback!&lt;/p&gt;

</description>
      <category>errors</category>
      <category>debug</category>
      <category>react</category>
      <category>python</category>
    </item>
    <item>
      <title>Quick Summary: Building a Robust Backend with Flask, SQLAlchemy, and Sessions</title>
      <dc:creator>Jai Stellmacher</dc:creator>
      <pubDate>Thu, 15 Jun 2023 04:54:38 +0000</pubDate>
      <link>https://dev.to/jstellmacher/quick-summary-building-a-robust-backend-with-flask-sqlalchemy-and-sessions-5ag8</link>
      <guid>https://dev.to/jstellmacher/quick-summary-building-a-robust-backend-with-flask-sqlalchemy-and-sessions-5ag8</guid>
      <description>&lt;h2&gt;
  
  
  Why You Should Be Here:
&lt;/h2&gt;

&lt;p&gt;In today's digital age, building a robust and efficient backend is crucial for the success of web applications. Flask, SQLAlchemy, and sessions are powerful tools that enable developers to create dynamic and secure backends. In this blog, I will explore the process of building a backend using Flask, SQLAlchemy, and sessions, and how these technologies can work together to create a seamless user experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Flask
&lt;/h2&gt;

&lt;p&gt;Flask is a lightweight and versatile web framework written in Python. It provides a solid foundation for building web applications by offering a simple yet powerful set of tools. Flask allows developers to create routes, handle HTTP requests, and render dynamic templates. Its modular nature enables easy integration with various extensions, making it highly customizable for different project requirements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Leveraging SQLAlchemy
&lt;/h2&gt;

&lt;p&gt;SQLAlchemy is an Object-Relational Mapping (ORM) library that simplifies database operations in Python. It provides a high-level, Pythonic interface to interact with databases, abstracting away the complexities of SQL queries. SQLAlchemy enables developers to define database models as Python classes, allowing seamless integration of database operations within the Flask application. This powerful combination enhances productivity and code readability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Managing Sessions
&lt;/h2&gt;

&lt;p&gt;Sessions play a crucial role in web application development, as they enable the storage of user-specific data across multiple requests. Flask provides a secure and straightforward session management mechanism through the Flask-Session extension. By leveraging session objects, developers can store and retrieve user-specific data, such as login credentials or user preferences, ensuring a personalized experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Up the Backend
&lt;/h2&gt;

&lt;p&gt;To start building the backend, we first need to set up a Flask application and define the required routes. Flask's routing mechanism allows us to map URLs to specific functions, enabling the handling of different HTTP methods (GET, POST, etc.) and rendering appropriate templates or JSON responses.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;render_template&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;home&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;render_template&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Creating Database Models
&lt;/h2&gt;

&lt;p&gt;With SQLAlchemy, we can define the database models as Python classes, representing the tables and relationships in our application's database schema. These models provide an abstraction layer for database operations, allowing easy querying, insertion, and updating of data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

class User(Base):
    __tablename__ = 'users'

    id = Column(Integer, primary_key=True)
    name = Column(String(50))
    email = Column(String(100))

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Integrating SQLAlchemy with Flask
&lt;/h2&gt;

&lt;p&gt;To integrate SQLAlchemy with Flask, we need to configure the database connection settings and initialize a SQLAlchemy object within our Flask application. This connection enables seamless interaction with the database using SQLAlchemy's query API, reducing the effort required for manual SQL queries.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from flask import Flask
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db'
db = SQLAlchemy(app)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Implementing Sessions
&lt;/h2&gt;

&lt;p&gt;Flask-Session simplifies session management by providing a Flask extension that seamlessly integrates with the Flask application. By configuring the session settings, such as the secret key and storage type, we can enable session functionality. With session objects, we can store and retrieve user-specific data across requests, enhancing the user experience.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from flask import Flask, session

app = Flask(__name__)
app.secret_key = 'your_secret_key'

@app.route('/')
def home():
    session['username'] = 'John'
    return 'Session is set'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Ensuring Security
&lt;/h2&gt;

&lt;p&gt;Building a secure backend is paramount to protect sensitive user information. We should implement measures like secure session storage, strong password hashing, and input validation to mitigate common security vulnerabilities. Flask extensions like Flask-Login and Flask-WTF provide additional functionality to enhance security and protect against attacks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from flask_bcrypt import Bcrypt

bcrypt = Bcrypt()

password = 'my_password'
hashed_password = bcrypt.generate_password_hash(password)
if bcrypt.check_password_hash(hashed_password, password):
    print('Password is correct')
else:
    print('Password is incorrect')

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Link between app.py and models.py
&lt;/h2&gt;

&lt;p&gt;In a typical Flask application, app.py serves as the entry point of the application where the Flask instance is created, routes are defined, and other application-level configurations are set. On the other hand, models.py is a separate module that contains the SQLAlchemy model definitions, representing the database schema and providing an abstraction layer for database operations. app.py and models.py are usually imported and utilized together in app.py to integrate the database models with the Flask application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;example of bridge between app.py and models.py (will build one)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Alembic and SQLite3 in SQLAlchemy
&lt;/h2&gt;

&lt;p&gt;Alembic is a database migration tool provided by SQLAlchemy. It allows developers to manage database schema changes over time, such as creating new tables, modifying existing tables, or adding new columns. Alembic generates migration scripts based on the changes made to the SQLAlchemy models, making it easier to keep the database schema in sync with the application's codebase.&lt;/p&gt;

&lt;p&gt;SQLite3 is a lightweight and serverless relational database engine often used during development or for smaller-scale applications. SQLAlchemy supports SQLite3 as one of its supported database backends, allowing developers to work with SQLite3 databases using the same SQLAlchemy API and ORM features available for other database engines.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;code about these 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Strengths of Using Flask Libraries (Pallet Project)
&lt;/h2&gt;

&lt;p&gt;The Flask libraries, collectively known as the Pallet Project, provide numerous advantages for web application development:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Flexibility: Flask offers a minimalistic and unopinionated approach, allowing developers to structure their applications according to their specific needs and preferences.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Modularity: Flask is designed to be highly modular, allowing easy integration of various extensions and libraries to add specific functionalities like database interaction, authentication, and form validation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Extensibility: The Flask ecosystem offers a wide range of extensions and plugins that extend Flask's capabilities, allowing developers to add features seamlessly without reinventing the wheel.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Simplicity: Flask has a straightforward and intuitive API, making it easy for developers to get started and build web applications quickly. The simplicity of Flask also contributes to easier debugging and maintenance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scalability: Flask's lightweight nature makes it suitable for both small-scale applications and larger projects. With proper design patterns and architecture, Flask can scale effectively to handle increased traffic and complexity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Active Community: Flask has a vibrant and active community of developers who contribute to its continuous improvement. The community provides extensive documentation, tutorials, and support, making it easier for developers to learn, troubleshoot, and share their knowledge.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Final Thoughts:
&lt;/h2&gt;

&lt;p&gt;By leveraging these strengths, developers can create efficient, maintainable, and scalable web applications using Flask and its associated libraries.&lt;/p&gt;

&lt;p&gt;I know this was brief and not very in-depth, but you can use these resources to build a very standard backend. &lt;/p&gt;

&lt;p&gt;Below is a Glossary of terms that I thought were good to know.&lt;/p&gt;

&lt;h2&gt;
  
  
  Glossary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Term&lt;/th&gt;
&lt;th&gt;Definition&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Flask&lt;/td&gt;
&lt;td&gt;A lightweight and versatile web framework written in Python that provides a solid foundation for building web applications.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SQLAlchemy&lt;/td&gt;
&lt;td&gt;An Object-Relational Mapping (ORM) library that simplifies database operations in Python, providing a high-level interface.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sessions&lt;/td&gt;
&lt;td&gt;A mechanism that enables the storage of user-specific data across multiple requests in a web application.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flask-Session&lt;/td&gt;
&lt;td&gt;A Flask extension that provides a secure and straightforward session management mechanism.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Routes&lt;/td&gt;
&lt;td&gt;URLs mapped to specific functions in Flask that handle HTTP requests and render templates or JSON responses.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Database Models&lt;/td&gt;
&lt;td&gt;Python classes in SQLAlchemy that represent the tables and relationships in a database schema.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flask-Login&lt;/td&gt;
&lt;td&gt;A Flask extension that provides user session management, authentication, and authorization functionality.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flask-WTF&lt;/td&gt;
&lt;td&gt;A Flask extension that provides integration with WTForms, allowing easy creation and validation of web forms.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alembic&lt;/td&gt;
&lt;td&gt;A database migration tool provided by SQLAlchemy that manages database schema changes over time.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SQLite3&lt;/td&gt;
&lt;td&gt;A lightweight and serverless relational database engine often used during development or for smaller-scale applications.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pallet Project&lt;/td&gt;
&lt;td&gt;The collection of Flask libraries and extensions that provide advantages for web application development.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flask-Security&lt;/td&gt;
&lt;td&gt;A Flask extension that adds security features like authentication, role management, and password hashing to Flask applications.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jinja2&lt;/td&gt;
&lt;td&gt;A powerful and popular templating engine used in Flask for rendering dynamic HTML templates.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flask-Migrate&lt;/td&gt;
&lt;td&gt;A Flask extension that integrates SQLAlchemy and Alembic to provide database migration capabilities.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;WTForms&lt;/td&gt;
&lt;td&gt;A flexible forms validation and rendering library for Python web development, commonly used with Flask.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flask-Cache-Control&lt;/td&gt;
&lt;td&gt;A Flask extension that provides control over HTTP caching by setting appropriate Cache-Control headers.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flask-Mail&lt;/td&gt;
&lt;td&gt;A Flask extension for sending email messages from Flask applications.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flask-RESTful&lt;/td&gt;
&lt;td&gt;A Flask extension that simplifies the creation of RESTful APIs by providing tools and decorators for resource routing.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
    </item>
    <item>
      <title>Python Basics: A General Guide for Beginners</title>
      <dc:creator>Jai Stellmacher</dc:creator>
      <pubDate>Mon, 22 May 2023 06:00:15 +0000</pubDate>
      <link>https://dev.to/jstellmacher/python-basics-a-general-guide-for-beginners-1ii9</link>
      <guid>https://dev.to/jstellmacher/python-basics-a-general-guide-for-beginners-1ii9</guid>
      <description>&lt;p&gt;Photo by &lt;a href="https://pixabay.com/users/shimibee-25934992/" rel="noopener noreferrer"&gt;shimibee&lt;/a&gt; on &lt;a href="https://pixabay.com/illustrations/snake-cartoon-cute-reptile-nature-7709588/" rel="noopener noreferrer"&gt;Pixabay&lt;/a&gt; Resized in Canva to Fit!&lt;/p&gt;




&lt;p&gt;Python IDE:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Hello, World!")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt;&amp;gt; Hello, World!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  README.md
&lt;/h2&gt;

&lt;p&gt;Welcome Python Newcomers, beginners, or Re-learners (learned a legacy Python?). This article will outline basics of Python such as vocabulary, basic examples, and a learning path that you can follow to build your skills! [Vocabulary is at the Bottom]&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Learn Python?
&lt;/h2&gt;

&lt;p&gt;Python is one of the leading coding languages to learn at the moment of writing. It is useful for many different reasons due to the freedom of what you can do with the language. A few examples are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Write scripts that automate daily processes&lt;/li&gt;
&lt;li&gt;Create wonderful &lt;strong&gt;backend&lt;/strong&gt; databases due to its server-side logic &amp;lt;2 popular frameworks are: Flask &amp;amp; Django&amp;gt;&lt;/li&gt;
&lt;li&gt;Build &lt;strong&gt;frontend&lt;/strong&gt; which is unpopular because Javascript is a wonderful and an easier way of building frontend.
---(Python Frameworks for this: &lt;a href="https://pywebview.flowrl.com/examples/" rel="noopener noreferrer"&gt;Pywebview&lt;/a&gt;, &lt;a href="https://github.com/python-eel/Eel" rel="noopener noreferrer"&gt;Eel&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Situate Data Analysis's and Visualizations (My personal favorite use!)(My favorite libraries: Pandas, Numpy, Matplotlib, Seaborn, Scikit-Learn, 3D data analysis: Open3D)&lt;/li&gt;
&lt;li&gt;Craft Machine Learning and Artificial Intelligence (ML-Libraries I used in college: LightGBM, Statsmodels) &amp;amp; (AutoML-Libraries I also used: PyCaret) &amp;amp; (DeepLearning-Librarie that I used: PyTorch)&lt;/li&gt;
&lt;li&gt;Engineer Desktop Application Development (These create GUI(graphical user interfaces) that allow for building tools and productivity apps (Frameworks: Tkinter))&lt;/li&gt;
&lt;li&gt;Pioneer Game Development using libraries like Pygame for 2D games.&lt;/li&gt;
&lt;li&gt;Initiate web scraping (I used Beautiful soup, but the other popular one is Scrapy)&lt;/li&gt;
&lt;li&gt;IoT (Internet of Things) This helps communicate with devices like your Roomba (robot vacuum)&lt;/li&gt;
&lt;li&gt;Network Programming (Library: Socket) This helps you incorporate or work with network protocols&lt;/li&gt;
&lt;li&gt;DevOps &amp;amp; System Admin (Due to its efficiency to automate)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Python is such a vast language. The list above is just scraping the surface of python. When you start with Python in one of these fields definitely check out the popular frameworks above!&lt;/p&gt;

&lt;h2&gt;
  
  
  What to download first?
&lt;/h2&gt;

&lt;p&gt;In Python, it is good to know that you can code just "out-of-the-box", but libraries are powerful because it helps with efficiency. I will show an example further down.&lt;/p&gt;

&lt;p&gt;Steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First download VSCode. (An IDE (Integrated Development Environment - It is a place to code that has tools to use) that is currently the most popular to use to code. &lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;VsCode Link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Download &lt;a href="https://www.python.org/downloads/" rel="noopener noreferrer"&gt;Python&lt;/a&gt; onto your computer. Follow the steps in the popup window after it downloads. &lt;/li&gt;
&lt;li&gt;Next Open up VSCode and on the left side bar, click 'extension' or click on an icon that looks like a square of squares with the top left square rotated slightly.&lt;/li&gt;
&lt;li&gt;Once there, type in 'Python' and download the top of the list. (There is better documentation on the official vscode site linked &lt;a href="https://code.visualstudio.com/docs/python/python-tutorial" rel="noopener noreferrer"&gt;here&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;On your keyboard press the buttons, "ctrl + n" (mac: cmd + n) This will create a new file. In the little word snippet at the top it will say "Select a language, or fill with template, or open a different editor to get started. Start typing to dismiss or don't show this again." In this snippet, click the "select a language". A dropdown menu will open and type in 'python'. Press enter if it is selected.&lt;/li&gt;
&lt;li&gt;Now, your file will be a python file. Here, we can code in python.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Wow time for your first project just to prove you can do it!
&lt;/h2&gt;

&lt;p&gt;You should have your python file open in your vscode if you followed the steps above!&lt;/p&gt;

&lt;p&gt;Here, we will type in the following on line 1.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Hello, World!")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It should look like the image below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl11wbck2rowo5i2edckm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl11wbck2rowo5i2edckm.png" alt="Image description" width="800" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next hit "ctrl + s" (mac: cmd + s) It will look like the below picture. In the space where it says, "name", change that to 'hello.py'. Go ahead and click 'enter' on your keyboard.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh94oxkkry9ezh5byrvx6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh94oxkkry9ezh5byrvx6.png" alt="Image description" width="800" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wow! You created and saved your first python file! (They should end in a '.py'. There are other variations but we will talk about those in a different blog)&lt;/p&gt;

&lt;h2&gt;
  
  
  So what do we do now?
&lt;/h2&gt;

&lt;p&gt;Well, nothing happens right? How do we actually make it do something? Do we just yell at it, "Do the roar" "Do the roar"?&lt;/p&gt;

&lt;p&gt;The answer is, no, we do not just tell it to do the roar. What we do is run the script (what you just made) in the terminal!&lt;/p&gt;

&lt;p&gt;On your keyboard, hit the buttons "ctrl + j" (mac: cmd + j). A terminal will magically pop up in the lower half of your VSCode!&lt;/p&gt;

&lt;p&gt;In the terminal type what is shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python hello.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the next line after you click 'Enter' on your keyboard should be the same as shown in the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hello, World!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Congratulations! You just wrote and ran your first Python program! Easy, Right?&lt;/strong&gt;   &lt;/p&gt;



&lt;h2&gt;
  
  
  Now What?
&lt;/h2&gt;

&lt;p&gt;Well, we need to learn the fundamentals!&lt;br&gt;
There are many basics to Python that should be known to understand the language as a whole. Once these fundamentals are learned, you can start specializing in one of the fields that were mentioned above in the section labeled "Why Learn Python?".&lt;/p&gt;
&lt;h2&gt;
  
  
  Outline of Fundamentals
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Syntax &amp;amp; Indentation: Python uses indentation for the compiler to know what the code is trying to do. It is necessary to pay attention to it. Learning code is learning a new language, so it will take time to learn the syntax as well! Do not be too hard on yourself! We all have struggled and confused the coding languages. (Even if you have not learned a different language, all coding language's syntax is hard to keep straight unless you specialize in only one!) Below is an example of indentation and using the correct syntax!(The &amp;gt;&amp;gt; means it is the outcome if it were to be run through the terminal. Which you can do if you type "python filename.py" in the terminal):
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for i in range(1, 5):
    print(i)
&amp;gt;&amp;gt; 1, 2, 3, 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: To comment code out in Python use the # symbol! You can comment out a lot of code by highlighting a piece of code and pressing on your keyboard, "crtl + /"(mac: cmd + /)&lt;/p&gt;

&lt;p&gt;2. Variables and data types: Variables store data of different types, such as numbers, strings, and booleans. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name = "Max" #quotation's content in python are called strings!
age = 25 # defining a number variable! (SEE NOTE BELOW)
is_student = True #boolen truth or false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Numbers in Python: In python there are 3 types of numbers - plain integers are just positive or negative whole numbers, floats represent real numbers: decimal points, complex numbers: IDK they are complex (lol) don't ask me! Here is a good article for it &lt;a href="https://www.geeksforgeeks.org/complex-numbers-in-python-set-1-introduction/" rel="noopener noreferrer"&gt;Geeksforgeeks Website&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;3. Operators and expressions: Operators perform actions on values and variables, and expressions combine variables, operators and values. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = 4
y = 5
result = x + y
print(result)  # Output: 9
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Above is an example of code. The operator here is the "+" plus sign. Below is an expression example. The expression is the "full sentence of the math being put together - here it is the z = 2 * (x + y) - 1 portion"&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = 6
y = 5
z = 2 * (x + y) - 1
print(z)  # Output: 21
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4. Control flow statements (loops &amp;amp; conditionals): A loop will repeat code until a condition is not true. A conditional is (if, elif, else). They dictate the flow of execution of the code based on conditions that you-the creator can place. Example of loop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;foods = ["Sushi", "Pizza", "Crepe"]

for food in foods:
    print(food)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Terminal Will Print&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sushi
Pizza
Crepe
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What is happening in the code above? We are defining foods with a data structure called a list. This is denoted by the square brackets []. &lt;strong&gt;Note&lt;/strong&gt;: If you are coming from a different language, make sure you do not mix up your curly brackets and your square brackets!&lt;/p&gt;

&lt;p&gt;After we define the list of foods (it contains sushi, pizza, and crepe), we loop through the list. In python, this means that it reads the first item in our list, "sushi" then prints it out, then it goes through again, reads the next and prints it, lastly it reads the "crepe" and prints it. It is good to understand what the sentence means. "for food in foods:" This means that each "food" item is being assigned and counted in the list of "foods"&lt;/p&gt;

&lt;p&gt;A separate example of this could be, "for i in range(1, 5):"&lt;br&gt;
What is happening here is that "i" defines the place holder and the range(1, 5) means that the loop will go through each number 1 by 1, starting at the number 1 and going to the number 4. (It is weird, I know. Why does it say 5, and the loop will only print 4?? If I remember from college correctly, its because it starts at 0) If you want to see this in action look at the gif below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F04hkgfsdxc7lcc7gf0wf.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F04hkgfsdxc7lcc7gf0wf.gif" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;br&gt;
Below is the terminal outcome:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv4b6jenx85z3g4k5ldgl.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv4b6jenx85z3g4k5ldgl.gif" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example of conditional:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;age = 16

if age &amp;gt;= 18:
    print("You are an adult.")
else:
    print("You are not yet an adult.")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above example, this is a conditional. The age defined in the program is 16. The "if" statement will print "You are an adult." if the age is above or equal to 18. If your age is less than 18 then the "else" portion of your code will occur.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk887sdfi972f15y5ydhj.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk887sdfi972f15y5ydhj.gif" alt="Image description" width="908" height="500"&gt;&lt;/a&gt;&lt;br&gt;
Below is how it executes in the terminal:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuapk6ubjeomhsisg1xge.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuapk6ubjeomhsisg1xge.gif" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5. Functions and modular programming: Functions are reusable blocks of code. They can perform tasks. Modular programming helps with organization and reusability. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def greet(name):
    print("Hello, " + name + "!")

greet("John Doe")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we wanted, we could greet someone other than John Doe if we do the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;greet("Max Smith")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The outcome of the first code block will be "Hello John Doe" and now with the change, the second code-block if ran will be "Hello Max Smith".&lt;/p&gt;

&lt;p&gt;The beauty of this type of coding is that it is less redundant and its easier and more "dynamic". (Which is part of python's current best practices)&lt;/p&gt;



&lt;h2&gt;
  
  
  Phew! That was a LOT!
&lt;/h2&gt;

&lt;p&gt;I suggest that you get up and go take a break! Let that information sink in, and try doing some other basic examples! I would start with assigning variables to numbers and doing math in order to get familiar with how Python can work. I suggest this site to try just seeing Python do stuff. Site: &lt;a href="https://codingexplained.com/coding/python/basic-math-operators-in-python" rel="noopener noreferrer"&gt;https://codingexplained.com/coding/python/basic-math-operators-in-python&lt;/a&gt;&lt;/p&gt;



&lt;h2&gt;
  
  
  If you have taken a break and are ready to learn on, Lets Go!
&lt;/h2&gt;

&lt;p&gt;What do we learn now? Well, there are other aspects of Python such as Data structures and Algorithms. If you want a job at the big MAANG(Meta, Apple, Amazon, Netflix, and Alphabet[Google]) companies, then knowing these will help a lot!&lt;/p&gt;
&lt;h2&gt;
  
  
  So what are they?
&lt;/h2&gt;

&lt;p&gt;Data structures: Special boxes that hold different kinds of data. Each data structure has its own unique way of storing and accessing data. Types: lists, tuples, dictionaries, and sets. &lt;strong&gt;Note&lt;/strong&gt;: data structures start at 0! So if you are looking for something in "first place" it usually is the zeroth place! Below you will see examples such as [0]. This will look at the place you think is "1st place"! Also, notice the difference in syntax! ie. curly brackets or square brackets and the content within them!&lt;/p&gt;

&lt;p&gt;List Example:&lt;br&gt;
When to use? : Use when you need to store and access an ordered collection of items.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Creating a list
foods = ["sushi", "pizza", "crepe"]

# Accessing elements in a list
print(foods[0])  # Output: "sushi"

# Modifying elements in a list
foods[1] = "pizza"
print(foods)  # Output: ["sushi", "pizza", "crepe"]

# Adding elements to the end of a list
foods.append("steak")
print(foods)  # Output: ["sushi", "pizza", "crepe", "steak"]

# Removing elements from a list
foods.remove("sushi")
print(foods)  # Output: ["sushi", "pizza", "crepe"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tuples Example:&lt;br&gt;
When to use? : Use when you want to store a collection of related values that will not change.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Creating a tuple
point = (1, 4)

# Accessing elements in a tuple
print(point[0])  # Output: 1

# Tuples cannot be altered, so modifying is not possible
# point[0] = 4  # This will result in an error

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dictionaries Example:&lt;br&gt;
When to use? : Use when you need to store data as key-value pairs. This helps with efficient lookup and retrieval. (Fun Fact: This is a good thing to remember for learning SQL!)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Creating a dictionary to represent a college student
student = {
    "name": "Max",
    "age": 22,
    "major": "Marketing",
    "year": 3
}

# Accessing values in the dictionary using keys
print("Name:", student["name"])  # Output: "Name: Max"
print("Age:", student["age"])  # Output: "Age: 22"
print("Major:", student["major"])  # Output: "Major: Marketing"
print("Year:", student["year"])  # Output: "Year: 3"

# Modifying values in the dictionary
student["age"] = 22
student["year"] = 4
print("Updated Age:", student["age"])  # Output: "Updated Age: 21"
print("Updated Year:", student["year"])  # Output: "Updated Year: 4"

# Adding new key-value pairs to the dictionary
student["university"] = "XYZ University"
print("University:", student["university"])  # Output: "University: XYZ University"

# Removing a key-value pair from the dictionary
del student["major"]
print(student)  # Output: {'name': 'Max', 'age': 23, 'year': 4, 'university': 'XYZ University'}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sets Example:&lt;br&gt;
When to use? : Use sets when you want to store a collection of unique elements. This will have no particular order.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Creating a set of food items
foods = {"sushi", "pizza", "crepe"}

# Adding elements to the set
foods.add("burger")
print(foods)  # Output: {"sushi", "pizza", "crepe", "burger"}

# Removing elements from the set
foods.remove("pizza")
print(foods)  # Output: {"sushi", "crepe", "burger"}

# Sets automatically remove duplicate elements
foods.add("sushi")
print(foods)  # Output: {"sushi", "crepe", "burger"}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simple right? Good job on learning the basics in data structures! Software Engineers should understand data structures because they dictate the speed of grabbing data! In the grand scheme of things, this is good to know if you are trying to build efficiency and speed in your apps. (Which is what you should strive to do!)&lt;/p&gt;

&lt;h2&gt;
  
  
  Algorithms!
&lt;/h2&gt;

&lt;p&gt;What are they? : They are step-by-step instructions that help you solve a puzzle or issue! Being someone in the field of coding should be able to logically go step by step in their processes! (Computers essentially progress from beginning to end) The most common example is instructions for building a peanut butter and jelly sandwich!&lt;/p&gt;

&lt;p&gt;There are special algorithms in code though! They help by breaking up your problems into smaller and more manageable steps!&lt;/p&gt;

&lt;p&gt;Knowing all of these algorithms is a bit intermediate so do not worry about committing all of these to memory! They are great to know though for any coding interviews you do!&lt;/p&gt;

&lt;p&gt;The types of Algorithms:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sorting Algorithms:
-- Merge Sort: Efficient for sorting large lists or arrays.
-- Quick Sort: Efficient for sorting large lists or arrays, widely used in practice.
-- Bubble Sort: Simple but inefficient for large lists.
-- Selection Sort: Efficient for small lists or partially sorted data.
-- Insertion Sort: Efficient for small or partially sorted lists.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;2. Searching Algorithms:&lt;br&gt;
-- Binary Search: Efficient for sorted lists, dividing the search space in half at each step.&lt;br&gt;
-- Depth-First Search (DFS): Used for traversing or searching in tree or graph structures.&lt;br&gt;
-- Breadth-First Search (BFS): Used for traversing or searching in tree or graph structures, exploring neighbors first.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Linear Search: Simple but not efficient for large lists.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;3. Graph Algorithms:&lt;br&gt;
-- Prim's Algorithm: Finding the minimum spanning tree in a weighted graph.&lt;br&gt;
-- Kruskal's Algorithm: Finding the minimum spanning tree in a weighted graph.&lt;br&gt;
-- Dijkstra's Algorithm: Finding the shortest path in a graph with non-negative weights.&lt;/p&gt;

&lt;p&gt;4. Recursion:&lt;br&gt;
-- Tower of Hanoi: Solving the Tower of Hanoi puzzle using recursion.&lt;br&gt;
-- Factorial: Calculating the factorial of a number using recursion.&lt;/p&gt;

&lt;p&gt;5. Hashing:&lt;br&gt;
-- Hashing Algorithms: Understanding different hashing techniques like MD5, SHA-1, and SHA-256. This is for passwords!&lt;/p&gt;

&lt;p&gt;6. String Algorithms:&lt;br&gt;
-- String Matching Algorithms: Understanding algorithms like Brute Force, Knuth-Morris-Pratt (KMP), and Rabin-Karp for pattern matching.&lt;/p&gt;

&lt;p&gt;7. Tree Traversal:&lt;br&gt;
-- In-order, Pre-order, and Post-order Traversal: Visiting nodes in a tree in different orders.&lt;/p&gt;

&lt;p&gt;8. Dynamic Programming:&lt;br&gt;
-- Fibonacci Sequence: Solving the Fibonacci sequence efficiently using memoization or bottom-up approaches.&lt;br&gt;
-- Knapsack Problem: Solving the knapsack problem using dynamic programming.&lt;/p&gt;

&lt;h2&gt;
  
  
  So Much To Learn!!!
&lt;/h2&gt;

&lt;p&gt;I will not include these, but you should study up on the following as well!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Error Handling: This is a way to debug or find where your coding logic does not make sense. It helps break apart your code and makes it "easier" (not many things are easy in coding) to find the issues.&lt;/li&gt;
&lt;li&gt;Input/Output and File Handling: A way to let users or testers input information into your code (interact with it) and the outputs of that. This is most commonly seen in command-line-interface apps as well as backend database manipulation. The File handling is just ways to "read" and "write" files!&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Moving Forward - What should I do?
&lt;/h2&gt;

&lt;p&gt;Continue to practice, practice, and practice! The best way to learn any language is to move to a country that speaks it majorly and be immersed. (People trying to learn Spanish, may live in Spain and become more in touch with it! In our case, just start coding. I know it may be scary, but there are so many examples and resources out on the internet to help! (Youtube is amazing for coders!)&lt;/p&gt;

&lt;p&gt;Below are some resources I use for learning more:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/@freecodecamp" rel="noopener noreferrer"&gt;Youtube&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/32409802/basic-explanation-of-python-functions" rel="noopener noreferrer"&gt;Stackoverflow&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.google.com/search?q=python&amp;amp;source=hp&amp;amp;ei=5QFrZMW_Jv-G0PEPg5WCSA&amp;amp;iflsig=AOEireoAAAAAZGsP9Yk_z5-t8dBY9APQI-yKOmF6e-2T&amp;amp;ved=0ahUKEwiFxsjtnIj_AhV_AzQIHYOKAAkQ4dUDCAw&amp;amp;uact=5&amp;amp;oq=python&amp;amp;gs_lcp=Cgdnd3Mtd2l6EAMyCAgAEIAEELEDMggIABCABBCxAzILCC4QgAQQsQMQ1AIyCAgAEIAEELEDMggIABCABBCxAzIICAAQgAQQsQMyCAgAEIAEELEDMggIABCABBCxAzILCAAQigUQsQMQgwEyCAgAEIAEELEDOg4IABDqAhC0AhDZAhDlAjoQCAAQAxCPARDqAhCMAxDlAjoFCC4QgAQ6DgguEIMBENQCELEDEIoFOg4ILhCDARDUAhCxAxCABDoRCC4QgAQQsQMQgwEQxwEQ0QM6CwgAEIAEELEDEIMBOhEILhCKBRCxAxCDARDHARCvAToFCAAQgARQsgVY0Qxg5A1oAXAAeACAAWqIAbMEkgEDNC4ymAEAoAEBsAEK&amp;amp;sclient=gws-wiz" rel="noopener noreferrer"&gt;Google&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/jstellmacher"&gt;Dev blogs and articles&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;(&lt;a href="https://www.w3schools.com/python/" rel="noopener noreferrer"&gt;https://www.w3schools.com/python/&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;(&lt;a href="https://www.freecodecamp.org/news/search?query=python" rel="noopener noreferrer"&gt;https://www.freecodecamp.org/news/search?query=python&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;I suggest you try this to start! (&lt;a href="https://www.learnpython.org/" rel="noopener noreferrer"&gt;https://www.learnpython.org/&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Glossary &amp;amp; Terms
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Word&lt;/th&gt;
&lt;th&gt;Definition&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Python&lt;/td&gt;
&lt;td&gt;A high-level, interpreted programming language.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Script&lt;/td&gt;
&lt;td&gt;A set of instructions or commands written in Python.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Backend&lt;/td&gt;
&lt;td&gt;The server-side of a web application or software system.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Frontend&lt;/td&gt;
&lt;td&gt;The client-side of a web application or software system.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Framework&lt;/td&gt;
&lt;td&gt;A reusable set of libraries or tools for developing software.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Database&lt;/td&gt;
&lt;td&gt;A structured collection of data stored and accessed electronically.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flask&lt;/td&gt;
&lt;td&gt;A popular Python web framework for building web applications.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Django&lt;/td&gt;
&lt;td&gt;A high-level Python web framework for rapid development and clean design.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pywebview&lt;/td&gt;
&lt;td&gt;A Python library for creating web-based desktop applications.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Eel&lt;/td&gt;
&lt;td&gt;A Python library for creating desktop applications with HTML, CSS, and JavaScript.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data Analysis&lt;/td&gt;
&lt;td&gt;The process of inspecting, cleaning, transforming, and modeling data to discover useful information.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Visualization&lt;/td&gt;
&lt;td&gt;The representation of data or information in graphical or visual format.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pandas&lt;/td&gt;
&lt;td&gt;A Python library for data manipulation and analysis.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Numpy&lt;/td&gt;
&lt;td&gt;A powerful library for scientific computing with Python.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Matplotlib&lt;/td&gt;
&lt;td&gt;A plotting library for creating static, animated, and interactive visualizations.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Seaborn&lt;/td&gt;
&lt;td&gt;A data visualization library based on Matplotlib.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scikit-Learn&lt;/td&gt;
&lt;td&gt;A machine learning library for Python.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Open3D&lt;/td&gt;
&lt;td&gt;A library for 3D data processing and visualization.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Machine Learning&lt;/td&gt;
&lt;td&gt;A subset of artificial intelligence that enables systems to learn from data and make predictions or decisions.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Artificial Intelligence&lt;/td&gt;
&lt;td&gt;The simulation of human intelligence in machines that are programmed to think and learn.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LightGBM&lt;/td&gt;
&lt;td&gt;A gradient boosting framework for machine learning tasks.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Statsmodels&lt;/td&gt;
&lt;td&gt;A library for statistical modeling and analysis.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PyCaret&lt;/td&gt;
&lt;td&gt;An open-source library for automated machine learning.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PyTorch&lt;/td&gt;
&lt;td&gt;A deep learning library for Python.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tkinter&lt;/td&gt;
&lt;td&gt;A standard Python interface to the Tk GUI toolkit.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pygame&lt;/td&gt;
&lt;td&gt;A set of Python modules for game development.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Web scraping&lt;/td&gt;
&lt;td&gt;The extraction of data from websites.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Beautiful Soup&lt;/td&gt;
&lt;td&gt;A Python library for web scraping and parsing HTML and XML.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scrapy&lt;/td&gt;
&lt;td&gt;A Python framework for web scraping.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IoT&lt;/td&gt;
&lt;td&gt;Internet of Things - The interconnection of everyday objects via the internet.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Socket&lt;/td&gt;
&lt;td&gt;A low-level network programming interface in Python.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DevOps&lt;/td&gt;
&lt;td&gt;A set of practices combining software development (Dev) and IT operations (Ops).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;System Admin&lt;/td&gt;
&lt;td&gt;A person responsible for the upkeep, configuration, and reliable operation of computer systems.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Where to now?
&lt;/h2&gt;

&lt;p&gt;Check out this great Roadmap for becoming a Python Developer!(&lt;a href="https://roadmap.sh/python" rel="noopener noreferrer"&gt;https://roadmap.sh/python&lt;/a&gt;)&lt;br&gt;
I suggest that you start building basic apps. Then once you are comfortable with everything mentioned in this article, move onto finding what specialty of Python you want to learn!&lt;/p&gt;

&lt;p&gt;If you have any questions or need help on your journey, post a comment!&lt;/p&gt;

&lt;p&gt;Good luck and have fun!&lt;br&gt;
-Jai&lt;/p&gt;

</description>
      <category>python</category>
      <category>fundamentals</category>
      <category>beginners</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>Decisions, Decisions which Route(r) Should I Take?</title>
      <dc:creator>Jai Stellmacher</dc:creator>
      <pubDate>Mon, 01 May 2023 09:28:22 +0000</pubDate>
      <link>https://dev.to/jstellmacher/decisions-decisions-which-router-should-i-take-1had</link>
      <guid>https://dev.to/jstellmacher/decisions-decisions-which-router-should-i-take-1had</guid>
      <description>&lt;p&gt;There are so many frameworks for most languages especially Javascript and React. Which one do you use? In this case specifically, I will be talking about &lt;strong&gt;React Routers&lt;/strong&gt; and &lt;strong&gt;Next.js Routers&lt;/strong&gt;!&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are They?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Routes In React:&lt;/strong&gt; Routers in their most simple sense help to manage your site's URL's (URL = Uniform Resource Locator - web address). When a user clicks on a link, they are directed to the correct page of your web app. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;React Routers:&lt;/strong&gt; &lt;a href="https://reactrouter.com/en/main/start/concepts" rel="noopener noreferrer"&gt;A Good Place To Start React Router Website&lt;/a&gt; React Router helps to make specific components of your app connect to each other via links. These routes can have parameters placed on them and be nested. The potential for single page sites when implementing routes can have complex functionality. React Router can do both client side and server side routing. In client side routing, the routing happens in the browser whereas server side, the server is responsible for rendering the components. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next.js Router:&lt;/strong&gt; &lt;a href="https://nextjs.org/docs/api-reference/next/router" rel="noopener noreferrer"&gt;Documentation&lt;/a&gt; Next.js can also handle both forms of routing. It has all of the same functionality of React Router, so what is the difference and why would you use one over the other?&lt;br&gt;
&lt;/p&gt;

&lt;br&gt;
&lt;strong&gt;Key Differences&lt;/strong&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Next.js Router&lt;/th&gt;
&lt;th&gt;React Router&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Framework for building server-rendered React Apps&lt;/td&gt;
&lt;td&gt;Standalone library&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Has a routing system built in&lt;/td&gt;
&lt;td&gt;Has set of components and APIs that help with navigations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Use them to define how the App should handle different URLs&lt;/td&gt;
&lt;td&gt;Client-side routing is prioritized and there is more setup involved&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Both types of routers can be used for your application. Choosing one or the other depends on your specific need and your understanding of web development. If you need an entire package of "out-of-the-box" features, then go with Next.js. If you want to have very specific ways of routing, then use React Router.&lt;/p&gt;

&lt;p&gt;A few idea generators that may help you figure out if you want client side or server side routing are displayed in the following list:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.alexdevero.com/build-website-react-pt2/" rel="noopener noreferrer"&gt;"How to Build a Website with React, React Router &amp;amp; Styled-Components Pt.2"&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://betterprogramming.pub/create-your-portfolio-using-next-js-tailwind-css-stripe-and-paypal-80c723bb3fef" rel="noopener noreferrer"&gt;"Create Your Portfolio Using Next.js, Tailwind CSS, Stripe, and PayPal
"&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://reactjsexample.com/20-best-nextjs-portfolio-templates/" rel="noopener noreferrer"&gt;"20 Best Next.js Portfolio Templates
"&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://stackoverflow.com/questions/23975199/when-to-use-client-side-routing-or-server-side-routing" rel="noopener noreferrer"&gt;Stackoverflow Answer "When to use "client-side routing" or "server-side routing"?"&lt;/a&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Server side is better for content-heavy websites where the content does not change frequently. It provides better SEO and faster initial page loading times. &lt;/p&gt;

&lt;p&gt;Client side is better for interactive applications where content is dynamically loaded and user interactions are frequent. This approach allows for faster page rendering and a smoother user experience.&lt;br&gt;
&lt;/p&gt;


&lt;p&gt;&lt;a href="https://info340.github.io/client-side-routing.html" rel="noopener noreferrer"&gt;This Documentation is amazing&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.solidjs.com/" rel="noopener noreferrer"&gt;This framework is cool&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One example of a project that uses client side routing is a single-page application (SPA) built with React. Here, we do not need to constantly go back and forth to render data.&lt;/p&gt;

&lt;p&gt;It is interesting though, currently many apps can implement both types of routing so truly choose one or the other is up to you!&lt;br&gt;
&lt;/p&gt;


&lt;p&gt;I hope this helped define each tool and that you may feel inclined try both!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>nextjs</category>
      <category>beginners</category>
    </item>
    <item>
      <title>"That Is So Fetch": Weather API Webapp</title>
      <dc:creator>Jai Stellmacher</dc:creator>
      <pubDate>Fri, 07 Apr 2023 08:11:35 +0000</pubDate>
      <link>https://dev.to/jstellmacher/that-is-so-fetch-weather-api-webapp-1fo5</link>
      <guid>https://dev.to/jstellmacher/that-is-so-fetch-weather-api-webapp-1fo5</guid>
      <description>&lt;p&gt;![Map of the world from Pixabay]&lt;a&gt;Photo by Pixabay&lt;/a&gt; [The fetch quote is a reference to the 90s movie "Mean Girls" said by the Gretchen Wieners character]&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;Hello, internet. This article will detail my process through building a "simple" API fetch web app for the first time. I struggled through not only the CSS not centering due to parent issues, but also JavaScript fetch issues. As I go through my process, I will try to provide ways I could have done this in a more efficient way. I had a project partner but will be talking in the first person the entire article. (Assume "I" and "We" is interchangeable. Both of us take credit equally and could explain it) (TLDR: Here is a weather app built using vanilla js, html, css (&lt;a href="https://jstellmacher.github.io/Weatherboys/)" rel="noopener noreferrer"&gt;https://jstellmacher.github.io/Weatherboys/)&lt;/a&gt;)&lt;br&gt;
&lt;strong&gt;FORWARNING&lt;/strong&gt;&lt;br&gt;
I am new to javascript as of a month ago so please do not use this as a reference for your code. It may not work for you due to my lack of experience. I will strive to learn and grow though! (I changed some of the variable names just so it cannot be copied and pasted)&lt;/p&gt;

&lt;p&gt;To begin, we created the repository as seen below. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0lcx9nb2ve8fp09009w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0lcx9nb2ve8fp09009w.png" alt="Github new repo in top right" width="226" height="183"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From there, we named it "Weatherboys". We added an automatic ReadMe just incase we wanted to add specific instructions on the app or things that we learned during the process. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnie6ea9nwv6n821u3qru.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnie6ea9nwv6n821u3qru.png" alt="Image description" width="603" height="681"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After setting up the repository, we cloned the actual repository so we would both have it on our Githubs. (This was an issue) Below are two diagrams created in Draw.io that displays the current progression (top) and the second is best practices.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvqwe7lkj5i15z6j6y6he.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvqwe7lkj5i15z6j6y6he.png" alt="Image description" width="643" height="764"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The second diagram is the correct way to do it because it makes less merge conflicts as well as cuts down the need to continuously git push to two different repositories.&lt;/p&gt;


&lt;h2&gt;
  
  
  Choose an API
&lt;/h2&gt;

&lt;p&gt;Finding an API was easy. Pick an idea of what you want to do, and you will most likely find an API for it. We found a compilation of APIs on a GitHub repository linked &lt;a href="https://github.com/toddmotto/public-apis" rel="noopener noreferrer"&gt;HERE&lt;/a&gt; Shout out to Todd, Thanks! All of these are public APIs. If you cannot find what you are looking for here, just Google it.&lt;/p&gt;

&lt;p&gt;For my first project, I wanted to have an intermediate challenge. (That is definitely what I got) Weather Apps may not seem difficult, but this one has been a struggle. Our criteria for the class was have 3 or more js event listeners, fetch from an API, and incorporate current best practices. &lt;/p&gt;

&lt;p&gt;The very abbreviated steps are outlined below:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Boiler plate (normie jargon: boiler plate = template) HTML, CSS Here is a link to FreeCodeCamp (&lt;a href="https://www.freecodecamp.org/news/whats-boilerplate-and-why-do-we-use-it-let-s-check-out-the-coding-style-guide-ac2b6c814ee7/" rel="noopener noreferrer"&gt;https://www.freecodecamp.org/news/whats-boilerplate-and-why-do-we-use-it-let-s-check-out-the-coding-style-guide-ac2b6c814ee7/&lt;/a&gt;) (Which is an amazing resource btw)&lt;/li&gt;
&lt;li&gt;Make nav, body, footer and start building out buttons, forms, and div boxes to interact with using your js later&lt;/li&gt;
&lt;li&gt;Git add . , git commit -m "updates css", git push (Just do it often. You do not want to lose your code)&lt;/li&gt;
&lt;li&gt;Wireframe / Outline how your app will function (Ours is ^ right before this list)&lt;/li&gt;
&lt;li&gt;Build out the js: Fetch - Is your data console logging?
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   const fetchWeather = (lat, long) =&amp;gt; {
     fetch(
       `https://api.open-meteo.com/v1/forecast? 
latitude=${lat}&amp;amp;longitude=${long}&amp;amp;daily=temperature_2m_max,temperature_2m_min,sunrise,sunset,precipitation_sum,windspeed_10m_max&amp;amp;temperature_unit=fahrenheit&amp;amp;windspeed_unit=mph&amp;amp;precipitation_unit=inch&amp;amp;forecast_days=1&amp;amp;timezone=America%2FDenver`
     )
       .then((r) =&amp;gt; r.json())
       .then(displayData);
     // .then(console.log("hello"));
   };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;6. Take a break from your struggles with js and make your app look pretty using CSS (Below is code that will help you have overall conformity in your app. Shove this in your style.css)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;*{
margin:0;
padding:0;
font-family;
}
/* This is how you comment out a line also below is a good way to build a normal div box that centers the text */
div{
margin: auto;
width: 2vw;
border: 2px solid black;
padding: 10px;
}
/* The div above will center things vertically and horizontally but sometimes it will get messed up due to a parent div so watch out for that! The width has a vw. This means view width, it is a measurement that I like because it uses your screen's size to determine its size. The number before it is 2 which means 2% of the view width! */
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;7. Back to js: Now that you can fetch data, and your app looks prettier, lets make event listeners!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const variable = document.addEventListener("click", () =&amp;gt; {
  const submitClick = document.querySelector("submitBtn");
});
//You need to communicate with the DOM in order to create events in the variable above, we are telling it to listen for clicks to the submitBtn. Next we are going to make it do something after you click it
const variable2 = document.addEventListener("submit", (e) =&amp;gt; {
e.preventDefault();
  const submitForm = document.querySelector("submit");
});
//This variable2 will submit a form. It is passing "e" as a parameter. After that we are preventing the default of the browser from occurring. This will prevent the page from reloading and losing the End User's data in the form. 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;8. Now, we need an event listener that tracks your mouse hovering over a div. The goal is to show extra fun weather detail.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const variable3 = document.addEventListener("onmouseenter", () =&amp;gt; {
  const hover = document.querySelector("moreData");
hover.nextThing.otherThing = hover.
});
const variable4 = document.addEventListener("onmouseleave", () =&amp;gt; {
  const disappear = document.querySelector("moreData");
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;9. Now that I have 3 events and my data loads, I need to tackle the zip code and convert it to latitude and longitude. The API I am using requires latitude and longitude to find the weather data so I want to be able to allow the End User to simply put in a zip code and get the weather data from that location they put in. If I wanted it to be simple, I would make the user search their own latitude and longitude to input. Some ways to make this work is by using Google geolocation API and fetch from it anytime someone puts it in my form. Then I would have it linked to my getlocation function which in turn triggers the correct data to show up. &lt;/p&gt;

&lt;h2&gt;
  
  
  10. Lastly, make sure that your app loads and looks pretty.
&lt;/h2&gt;

&lt;p&gt;Below is a picture of the process of the app.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwhz02d3ql4pr7i5jer4u.png" alt="barebones app many hues of blue" width="800" height="979"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Updates
&lt;/h2&gt;

&lt;p&gt;I have now completed the app according to the rules of my assignment. In order for end users to find the weather they want, I needed to figure out how to convert zip code to latitude and longitude. What I ended up doing was using Google's location API. It is pretty useful. Here is the link &lt;a href="https://developers.google.com/maps/documentation/geocoding/get-api-key" rel="noopener noreferrer"&gt;Google API Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The code to do this was not too complicated but it felt like many steps. What I started with was an eventlistener for a "submit". When someone put their zipcode or city in the input area, I wanted something to happen. Next, I used &lt;code&gt;search.addEventListener("submit", (e) =&amp;gt; {&lt;br&gt;
  e.preventDefault();&lt;br&gt;
  console.log(e.target[0].value);&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fetch(
    "https://maps.googleapis.com/maps/api/geocode/json?address=" +
      e.target[0].value +
      "&amp;amp;key=" +
      "INSERT YOUR API KEY HERE"
  )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code above, I am using a fetch within my event listener. It grabs any value inputted from the user. In my case in accordance with my code, it is the "e.target[0].value" that allowed me to "pinpoint" the information I needed to fetch from the API. &lt;/p&gt;

&lt;p&gt;I followed that with an If Else statement because if someone misspelled an address or the database did not have the information, I wanted them to get an error. This can be seen by the code below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.then((response) =&amp;gt; response.json())
    .then((data) =&amp;gt; {
      // debugger;
      if (data.results.length === 0){
        alert("Please Use Different Location")
      } else {
        const latitude = data.results[0].geometry.location.lat;
        const longitude = data.results[0].geometry.location.lng;
        // console.log({ latitude, longitude });
        error.textContent = `Latitude:  
        ${latitude}

        Longitude:  
        ${longitude}`;
}
e.target[0].value = "";
    })
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At the beginning, my API was not working. The reason for that was because I did not read Google's documentation well enough and also did not look at their DOM elements closely. For example, in the code above, I created a variable of latitude and what it equals is "data.results[0].geometry.location.lat" This was messed up because I was not specifying where in their array the code was. ie.) "results[0]" It was in the zeroth place in the array.&lt;/p&gt;

&lt;p&gt;I ran into other issues such as making the app responsive because I did not format the CSS correctly. The best way to do that is make most of your sizing units the same. I will use 'vh' and 'vw'. These stand for view height and view width, respectively. Not only using those, but also using the following code, it will help the app be more responsive. Just make sure that you further customize it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[class*="col-"] {
  width: 100%;
}

@media only screen and (min-width: 600px) {
  /* For tablets: */
  .col-s-1 {width: 8.33%;}
  .col-s-2 {width: 16.66%;}
  .col-s-3 {width: 25%;}
  .col-s-4 {width: 33.33%;}
  .col-s-5 {width: 41.66%;}
  .col-s-6 {width: 50%;}
  .col-s-7 {width: 58.33%;}
  .col-s-8 {width: 66.66%;}
  .col-s-9 {width: 75%;}
  .col-s-10 {width: 83.33%;}
  .col-s-11 {width: 91.66%;}
  .col-s-12 {width: 100%;}
}
@media only screen and (min-width: 768px) {
  /* For desktop: */
  .col-1 {width: 8.33%;}
  .col-2 {width: 16.66%;}
  .col-3 {width: 25%;}
  .col-4 {width: 33.33%;}
  .col-5 {width: 41.66%;}
  .col-6 {width: 50%;}
  .col-7 {width: 58.33%;}
  .col-8 {width: 66.66%;}
  .col-9 {width: 75%;}
  .col-10 {width: 83.33%;}
  .col-11 {width: 91.66%;}
  .col-12 {width: 100%;}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;[Thank you &lt;a href="https://www.w3schools.com/" rel="noopener noreferrer"&gt;https://www.w3schools.com/&lt;/a&gt; for allowing me to use this for educational purposes]&lt;/p&gt;

&lt;p&gt;In our current society, mobile design first and pc design second is a current trend. Many users will open sites on their mobile before even thinking about opening it on a larger computer. In my project, I do not use all of the columns like the example above. I also do not use percentages. I think I as I continue to learn software development, I will update all of the weather app. I may re-create it using React. [TBD]&lt;/p&gt;



&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;For a first project, I am proud of myself. I am very thankful for my instructor for guiding me through a few of the rough parts. This app looks incredibly choppy right now and functions that way but I will add to it a lot. I am learning now that the documentation needs a lot of work (this article included) but the whole point of this is to have a good starting base to compare to as I grow!&lt;/p&gt;

&lt;p&gt;I will go more in-depth on the event listeners and converting the zip code to longitude and latitude as I update the app.  Thank you for reading! Hope to see you again. - J  &lt;/p&gt;

</description>
      <category>api</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>learning</category>
    </item>
    <item>
      <title>The Beginning Of A Journey</title>
      <dc:creator>Jai Stellmacher</dc:creator>
      <pubDate>Sun, 02 Apr 2023 23:47:53 +0000</pubDate>
      <link>https://dev.to/jstellmacher/the-beginning-of-a-journey-2ake</link>
      <guid>https://dev.to/jstellmacher/the-beginning-of-a-journey-2ake</guid>
      <description>&lt;p&gt;Good day internet. I have decided to join a full-stack software engineering bootcamp to three-way handshake with my BSBA in Marketing and Management Information Systems. (I realize that the three-way handshake does not actually happen with 3 parties but only a server and client — thought it was funny)&lt;/p&gt;

&lt;p&gt;This journey I will be embarking on will be documented here among other places such as my GitHub and Portfolio. I think it is crucial to share your learning voyage because when you get stuck, someone else might as well. Being able to post about it and find solutions or help someone find solutions is something a good collaborative society would do. (Or in this case, a software engineering team.) As I have grown older, I have learned that succeeding with others is the greatest way of relishing in joy. When you are watching a sport with friends and your team scores, you high-five your friends not yourself, right?&lt;/p&gt;

&lt;p&gt;I plan to post my thought-process, struggles, hacks, and outcomes here. I hope to help someone else out and maybe we can all defeat the imposter syndrome that any-year old's experience in this field.&lt;/p&gt;

&lt;p&gt;Well, come along now, I do not want to get too far ahead of you. Thanks for joining me!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
