SShortSingh.
Back to feed

Hardcoded Thresholds Slowed App Updates; A Simple Data Class Fixed It

0
·48 views

A developer at a location-tracking platform found that storing 18 behavioural tuning parameters as hardcoded constants made adjustments costly, requiring a full code review, build, and app store rollout — taking up to a week to change a single number. The friction meant thresholds were rarely updated, turning informed guesses into unexamined assumptions defended by inertia. The fix was straightforward: moving all parameters into a serializable data class with defaults identical to the old constants, then injecting it as a constructor parameter into the location processor. This preserved existing behaviour entirely — all tests passed without modification — while enabling debug or server-driven overrides simply by changing where the object is constructed. The author argues that true constants belong only to fixed facts like unit conversions, while heuristic thresholds are hypotheses that must remain cheap to revise.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Borsa Veri Analizi İçin Serdar'ın Seçtiği 8 Kritik Python Kütüphanesi

Borsa verisiyle çalışırken dağınık kaynaklardan veri toplamanın zorluğu, bir yazarın kendi araç setini oluşturmasına yol açmış. Yazar, yfinance, requests ve pandas gibi kütüphaneleri farklı sorunları çözmek için kullandığını anlatıyor. Makalede her paketin kullanım amacı ve sürüm bilgisi ile birlikte, veri kaynağı değişiklikleri, bellek yönetimi ve istek limitleri gibi tipik tuzaklara dikkat çekiliyor. Yazar, iş akışını hızlandırmak için bu araçların önemini vurguluyor. Metin, teknik analiz göstergeleri hesaplayan ta kütüphanesi gibi diğer araçları da kapsıyor.

0
ProgrammingDEV Community ·

Connected components beat projection for estimating text height before OCR

A pre-OCR check that decides whether to upscale a screenshot needs an estimate of text height in pixels, and two simple OpenCV methods were compared. On clean Chinese text both stayed within about 2 px of the true height up to 30 px, but above that projection ran slightly high, while on English projection measured the full line, around 1.37 times the cap height. On a bordered table screenshot projection returned 559 px against 23 px for connected components. Accuracy of two OCR recognizers falls sharply below roughly 12 px, so an estimator a few pixels off near that threshold can misclassify an image. These results come from deliberately clean, single-font samples on one Mac and do not cover compression, noise, or complex layouts.

0
ProgrammingDEV Community ·

Claude से osFoundry knowledge base पर आधारित जवाब और citation कैसे पाएं

यह गाइड बताती है कि Claude, चाहे claude.ai connector के ज़रिए या Claude Code में, किसी osFoundry knowledge base से सवालों के जवाब कैसे दे सकता है। हर दावे के साथ उस article की ID और उसके आखिरी update का समय दिया जाता है, जिससे जवाब की जांच संभव होती है। Claude sequence-based events से बदलावों को भी ट्रैक कर सकता है और बताता है कि कौन से पुराने जवाब बदले हुए article पर निर्भर हैं। Article में सुधार केवल उसी version पर, और केवल उपयोगकर्ता की अनुमति से, किया जा सकता है। Setup में connection बनाना, server URL जोड़ना, project से knowledge base जोड़ना और article publish करना शामिल है, और draft articles Claude की पहुंच से बाहर रहते हैं।

0
ProgrammingDEV Community ·

Why ChatGPT Couldn't Read a Blog: A Server-Level 403 Block Hidden Behind robots.txt

A blogger tested whether ChatGPT could access their website after noticing it never cited their posts. When asked to open a page, ChatGPT reported a 403 Forbidden error, indicating the site was blocking it. Checking robots.txt revealed no restrictions, so the author used curl with different user agents to test the server directly. Results showed that Google and Bingbot were allowed while OpenAI's crawlers, Claude, and Perplexity, along with some SEO tools, received 403 responses. The author concluded that a server-level rule, rather than robots.txt, was responsible for turning these bots away.