Urgent.News

What's breaking now, across thousands of outlets.

Tech

How to Detect Circular Dependencies in Java, TypeScript, Python and Go

A circular dependency is rarely written on purpose. It shows up one reasonable import at a time — a service that needs a helper, a helper that needs a constant from the service — until three classes can no longer be changed without the other two. This guide covers how to find them in Java, TypeScript, Python and Go, how to break them, and how to stop new ones in code review. Why they matter…

Circular dependencies are a common issue that can arise in software development. They occur when two or more modules or classes depend on each other, either directly or through a chain of dependencies. This creates a cycle where none of the classes can be understood, tested, or modified independently. The problem becomes evident when changes in one module ripple through the entire cycle, causing issues with testing, runtime behavior, and making refactoring or splitting into separate services difficult.

To detect circular dependencies in Java, TypeScript, Python, and Go, developers can employ various tools and techniques. In Java, the ArchUnit library allows you to write a unit test that checks if packages are free of cycles. In Spring, the startup failure about circular references between beans serves as a runtime indication of the same issue.

TypeScript and JavaScript developers can use madge to build an import graph and list cycles during development. Eslint-plugin-import can catch these cycles while editing the code. Python developers can use Pylint to report import cycles as cyclic-import (R0401) and pydeps to draw the module graph with highlighted cycles. In Go, the compiler prevents import cycles between packages, while cycles between types inside a package are still permitted.

Breaking circular dependencies typically involves inverting one dependency through an interface, extracting the shared part into a module both can depend on, or replacing direct calls with events. Merging the two classes is the correct approach when they were never truly separate. Tools like Archynt can automate the detection of circular dependencies across multiple languages such as Java, TypeScript, Python, and Go.

This provides developers with a class-level graph, enabling them to identify and address cycles early in the development process.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Insufficient Funds Is a Calendar Problem

Most decline codes describe a state. insufficient_funds describes a schedule. The card is fine, the customer is real, the account is simply empty until it is not — and in a paycheck economy, "until it…

  • Stripe's "Swipe Again" approach treats insufficient funds as a scheduling issue.
  • Transactions are spread out over the customer's next pay cycle instead of immediate retries.
  • Patience and timing are key to resolving decline codes effectively.

First Touch, Last Click, and Why We Store Both

Ask a marketing tool where a customer came from and it will give you one answer, delivered with total confidence. The problem is that the honest answer is a journey: a directory listing read in…

  • Swipe Again captures both initial touch and complete touch trail for every merchant.
  • Data stored in first-party cookie for 90 days to preserve entire customer journey.
  • System uses stamp for last-click attribution while preserving data for analysis.

Cancel Deflection Without Dark Patterns

Every subscription business has a cancel button. What happens between the click and the cancellation decides whether that moment is a save opportunity or a trust bonfire.

  • Cancel buttons are standard in subscription businesses.
  • Dark patterns hide exit, shame users, create guilt.
  • Honest deflection respects customer choice, offers branded save.

Your Work Isn’t Boring. You’re Just Explaining It Like a Jira Ticket.

How to turn everyday fixes and difficult decisions into work you can explain with confidence. You can spend an entire week untangling a problem and then describe it in an interview as a small bug fix.

  • Engineer reproduced export bug, identifying repeated account metadata lookup
  • Team debated redesign vs. simple change to fix timeout issue
  • Engineer recommended bounded change, implemented, resolved timeout

à 720 or 600à 600: What Each Size Does in pack_product.py and Why

My first 40 uploads had no cover. I zipped the files, ran the batch, pushed them out. Every one of those packs looked like a folder someone forgot to finish. No preview grid image, no hero.

  • Packproduct.py creates two images per product: 1280×720 cover and 600×600 thumbnail
  • Cover maintains product's wide composition, thumbnail optimized for square cropping
  • 1280×720 resolution balances sharpness and file size, 600×600 ensures small, readable thumbnails

More from Thursday 29 October →