In Elixir Meetup #12, Caleb Beers introduces Periscope, a powerful open-source tool designed to enhance debugging and introspection in Phoenix LiveView apps. It's essential for developers looking to improve their workflow and efficiency.

Table of contents

    About Caleb Beers

    Caleb Beers is an Elixir developer from Ohio, USA, with experience in both front-end and back-end development. He has contributed significantly to the Elixir community and is passionate about making development processes smoother and more efficient.

    The Problem with Traditional Debugging

    Traditional Debugging Challenges

    Caleb begins by discussing the inefficiencies in traditional debugging methods for LiveView applications. Developers often have to manually inspect large codebases, search for relevant modules, and insert debug statements, which can be time-consuming and error-prone.

    Key Issues:

    • Manual Inspection: Searching for relevant modules and code.
    • Inefficient Debugging: Inserting and removing debug statements repeatedly.
    • Complex Navigation: Navigating through large codebases to find specific issues.

    Introducing Periscope

    What is Periscope?

    Periscope is a debugging and introspection tool for Phoenix LiveView applications. It automates the process of finding and inspecting LiveView components, making it easier for developers to debug and understand their applications.

    Key Features of Periscope:

    • Automatic Socket Inspection: Instantly access the current LiveView socket.
    • Component State Inspection: View and inspect the state of individual LiveView components.
    • Real-Time Updates: Monitor changes in component states in real-time.
    • Ease of Use: Simplifies the debugging process with straightforward commands.

    Using Periscope

    Basic Setup and Usage

    Caleb demonstrates how to set up and use Periscope in a LiveView project. By adding Periscope as a dependency and importing it into the project, developers can quickly start leveraging its features.

    Key Commands:

    • periscope.socket: Access the current LiveView socket.
    • periscope.all_live_views: List all active LiveView processes.
    • periscope.component_names: Display names of active components.
    • periscope.assigns_for(component): Inspect the state of a specific component.

    Practical Applications

    Real-World Examples

    Caleb provides real-world examples of how Periscope can be used to streamline development. He shows how to inspect sockets and component states, reducing the need for manual debugging and making it easier to track down issues.

    Key Use Cases:

    • Inspecting Sockets: Quickly view and debug the state of LiveView sockets.
    • Component State Management: Monitor and inspect the state of individual components.
    • Efficient Debugging: Reduce time spent on manual debugging tasks.

    Advanced Features

    Socket and Component State Management

    Periscope offers advanced features for managing and inspecting socket and component states. Caleb explains how to use these features to gain deeper insights into LiveView applications and improve debugging efficiency.

    Advanced Commands:

    • periscope.socket.assigns: View socket assignments.
    • periscope.component_names: List all active components.
    • periscope.assigns_for(component): Inspect specific component states.

    Future Developments

    Upcoming Features

    Caleb discusses the future of Periscope, including planned features such as socket.watch for real-time monitoring of state changes and potential GUI integration with the Phoenix dashboard for easier visualization.

    Planned Features:

    • socket.watch: Real-time monitoring of state changes.
    • GUI Integration: Possible integration with the Phoenix dashboard for visual debugging.
    • Enhanced Schema Management: Tools for easier database schema inspection and querying.

    Q&A Session Highlights

    Community Feedback and Suggestions

    During the Q&A session, Caleb addresses questions and suggestions from the community. He emphasizes the importance of community feedback in shaping the future of Periscope and encourages developers to share their ideas.

    Key Takeaways:

    • Community Involvement: Importance of feedback for ongoing development.
    • Possible Extensions: Exploring additional features based on user needs.
    • Continuous Improvement: Commitment to enhancing Periscope for the Elixir community.

    Conclusion

    Caleb Beers' presentation at Elixir Meetup #12 provides valuable insights into how Periscope can transform the development workflow for Phoenix LiveView applications. By automating and simplifying debugging tasks, Periscope helps developers save time and focus on building better applications.

    Join the Community

    Ready to explore the reliability of Elixir and Erlang?

    Register for the next Elixir Meetup at Curiosum Meetups: Registration Join our community of Elixir enthusiasts at Elixir LinkedIn Group Prefer watching the presentation? Here’s the video

    Mikołaj Musioł Recruitment Specialist
    Mikołaj Musioł IT Recruitment & HR Specialist

    Read more
    on #curiosum blog

    Bringing SOLID to Elixir

    Bringing SOLID to Elixir

    The SOLID principles, originally designed for object-oriented programming, can also be adapted effectively to functional programming languages like Elixir. Read how to apply it to create more maintainable, scalable, and adaptable software systems.