AI 资讯
The Dependency Injection Quest: How I Turned Spaghetti Code Into a Lightsaber 🚀
The Quest Begins (The “Why”) Picture this: I’m knee‑deep in a legacy codebase that feels like the Death Star’s trash compactor—every time I try to add a feature, the walls close in and I’m squashed by tight coupling. I’d just spent three hours tracking down a bug that only showed up when the payment gateway was mocked in a test. The culprit? A new PaymentGateway() buried deep inside an OrderService class. It was like trying to defeat Darth Vader with a butter knife—no matter how hard I swung, the Dark Force (aka hidden dependencies) kept pulling me back. I realized I was instantiating collaborators inside the very classes that should be oblivious to their implementation details . The result? Tests that needed a real database, a real Stripe account, and a sacrificial goat to run. Any change to a third‑party API meant hunting down every new scattered across the project. Onboarding a new teammate felt like handing them a map written in ancient Sumerian. Honestly, I was ready to quit coding and become a professional napper. Then, during a late‑night coffee‑fueled refactor session, I stumbled upon a tiny line of documentation that whispered: “Depend on abstractions, not concretions.” It sounded like Yoda giving me a pep talk. The Revelation (The Insight) The magic spell I uncovered is Dependency Injection (DI) —specifically, constructor injection . Instead of a class creating its own collaborators, we hand them in from the outside. Think of it as giving a Jedi their lightsaber rather than making them forge one in the middle of a battle. Why does this feel like discovering the Force? Testability explodes – you can swap in fakes, mocks, or stubs without touching production code. Flexibility skyrockets – swapping a payment provider becomes a one‑line config change, not a scavenger hunt. Clarity reigns – the constructor becomes an honest inventory of what a class needs to do its job. The moment I applied it, the codebase felt lighter, like Luke finally trusting the Force ins
AI 资讯
(Alert!)5 Things Even AI Can't Do, GraphQL
GraphQL: A Complete Guide for Developers in 2026 NEWS: MY GAME JUST LAUNCHED Flip Duel Card Battle - Apps on Google Play Outsmart rivals in 1v1 card duels. Joker, bluff, ranked PvP. 5 rounds. play.google.com If you have built more than a couple of APIs, you have probably felt the friction of REST at scale. You ship an endpoint, the frontend team asks for one more field, you version the route, the mobile team needs a different shape of the same data, and six months later you are maintaining /v3/users/:id/full next to /v2/users/:id/summary and nobody remembers which one the Android app actually calls. GraphQL was built to kill that exact pain. It is a query language and runtime that lets clients ask for precisely the data they need — no more, no less — from a single endpoint, against a strongly typed schema that doubles as living documentation. This guide walks through GraphQL from first principles to production concerns. It is aimed at working developers, so expect schema definitions, resolvers, real queries, the N+1 problem, federation, security, and the parts of the ecosystem that actually matter in 2026. By the end you should be able to decide whether GraphQL belongs in your stack and how to build it without shooting yourself in the foot. What GraphQL Actually Is GraphQL is a specification, not a library or a framework. It was created at Facebook in 2012 to power their mobile apps, open-sourced in 2015, and is now governed by the GraphQL Foundation under the Linux Foundation. The spec defines a query language, a type system, and an execution model — but it deliberately says nothing about which database you use, which programming language you implement it in, or how you transport requests over the wire. That last point trips people up, so let it sink in: GraphQL is transport-agnostic and storage-agnostic. Most implementations run over HTTP with JSON, but that is a convention, not a requirement. Your resolvers can pull data from PostgreSQL, a REST microservice, a gR
AI 资讯
OpenAI joins The Rust Foundation as a Platinun member and donates funds to support Rust maintenance
submitted by /u/JuanAG [link] [留言]
AI 资讯
Design Principles of Software: A Real-World Notification System in Go
By Sergio Colque Ponce — Software Engineering, Universidad Privada de Tacna. Full source code: github.com/srg-cp/design-principles-go When people say "this code is well designed" , they rarely mean it has clever tricks. They usually mean it is easy to change . New requirements arrive every week, and good design is what lets you absorb them without rewriting half the project. In this article I take a small, very common requirement — "send a reminder to the user" — and I show how four classic design principles turn a fragile module into one that is open to change and easy to test. Everything is written in Go , and you can run it yourself from the repository linked above. The requirement We are building the backend of a bank appointment system. When an appointment is created, the user should get a reminder. Today it goes by email . Next month, product wants SMS too. After that, WhatsApp . The pattern is obvious: the list of channels will keep growing. A first (bad) attempt The fastest thing to write is one function that does everything: func SendReminder ( channel , recipient , body string ) error { if channel == "email" { // ... open SMTP, format the email, send it } else if channel == "sms" { // ... call the SMS provider } else if channel == "whatsapp" { // ... call the WhatsApp API } return nil } It works on Monday. But look at what it costs us: Every new channel means editing this function and risking the ones that already work. The function knows about SMTP, SMS providers and HTTP clients all at once: it has many reasons to change . To test the email path you need a real (or faked) SMTP server, because the logic is glued to the transport. This is the design we want to avoid. Let's fix it one principle at a time. 1. Single Responsibility Principle (SRP) A piece of code should have one reason to change . Instead of one function that knows every channel, we give each channel its own type that only knows how to deliver through that channel. Here is the email one: // E
创业投融资
Forest for the trees: An adventure in structured data
submitted by /u/Xadartt [link] [留言]
开发者
Hinton's Forward Forward Algorithm in Python
submitted by /u/DataBaeBee [link] [留言]
开源项目
What kind of dev are you? fun quiz
This was a random weekend idea/project and turned out to be fun to work on and also fun to see my friends enjoying it. submitted by /u/lfgcampos [link] [留言]
开发者
A library for pathfinding, traversal, and transformation of graph structures
submitted by /u/High-Impact-2025 [link] [留言]
AI 资讯
Podcast
Must Listen! She believes the engineering bottleneck is removed with AI. submitted by /u/ShivamOujlayan [link] [留言]
AI 资讯
75,000 Fortinet firewalls credentials to major organizations are exposed in a massive leak (free domain search + ethical disclosures)
submitted by /u/Malwarebeasts [link] [留言]
AI 资讯
Why Your Search Bar Understands You
Hello, I'm Maneshwar. I'm building git-lrc, a Micro AI code reviewer that runs on every commit. It is...
开发者
RFC 10008: The HTTP QUERY Method
submitted by /u/Nimelrian [link] [留言]
AI 资讯
LLMs เข้าใจและเขียนโค้ดได้อย่างไร?
มีคำถามที่น่าสนใจเกิดขึ้นระหว่างใช้งาน AI — "มันรู้ได้อย่างไรว่าต้อง return อะไร?" คำอธิบายที่ AI ให้มักฟังดูซับซ้อนและน่าประทับใจ แต่คำตอบที่ตรงไปตรงมากว่านั้นคือ: มันเห็น pattern นี้มาหลายล้านครั้งแล้ว LLM คิดแบบมนุษย์จริง ๆ หรือไม่? คำตอบคือไม่ — แต่มันทำบางอย่างที่ให้ผลลัพธ์คล้ายกับการคิดได้อย่างน่าทึ่ง ลองนึกภาพคนที่ได้อ่านโค้ดทุกบรรทัดที่เคยถูกเขียนบน GitHub, Stack Overflow, เอกสาร library ทุกตัว รวมถึงบทความด้าน programming จากทั่วโลก แล้วจดจำ pattern ทั้งหมดนั้นไว้ LLM คือสิ่งนั้น เพียงแต่ทำในระดับที่มนุษย์ไม่สามารถทำได้ Tokenization: AI มองโค้ดอย่างไร? เมื่อส่งโค้ดให้ AI ประมวลผล มันไม่ได้อ่านทีละตัวอักษร แต่แบ่งข้อความออกเป็น token ซึ่งเป็นชิ้นส่วนที่มีความหมาย pythondef greet(name): return f"Hello, {name}!" โค้ดนี้อาจถูกแบ่งเป็น token ประมาณนี้: def / greet / (name / ): / \n return / f"Hello / , / {name} / !" แต่ละ token ถูกแปลงเป็นตัวเลข (vector) แล้ว model จึงประมวลผลตัวเลขเหล่านั้น Attention Mechanism: ทำไม AI ถึง "เข้าใจ" Context ได้ ส่วนที่น่าสนใจที่สุดของ LLM คือ attention mechanism — กลไกที่ทำให้ model รู้ว่าเมื่อจะ predict token ถัดไป ควรให้ความสำคัญกับส่วนไหนของ input ที่ผ่านมา ตัวอย่างเช่น เมื่อ model กำลังจะเขียน error handling ใน function มันจะวิเคราะห์: ชนิด exception ที่ function อาจ throw pattern ของ error handling ที่ปรากฏในโค้ดใกล้เคียง library ที่ใช้อยู่และวิธีที่มักจัดการ error ทำไม AI จึง Hallucinate บางครั้ง? เพราะ LLM ไม่ได้ "รัน" โค้ดในกระบวนการคิดจริง ๆ มันแค่ทำนาย token ถัดไปจาก pattern ที่เคยเห็น เปรียบได้กับคนที่ศึกษาโจทย์คณิตศาสตร์มาอย่างมากมาย พอเห็นโจทย์ใหม่ก็เขียนวิธีแก้ออกมาดูสมเหตุสมผล แต่ถ้าโจทย์นั้น novel และไม่เคยเห็น pattern ที่คล้ายกันมาก่อน ก็อาจให้คำตอบที่ผิดได้ นั่นจึงเป็นเหตุผลสำคัญว่าทำไมต้อง test โค้ดที่ AI เขียนทุกครั้ง สรุป LLM เขียนโค้ดได้ดีเพราะสามเหตุผลหลัก: เห็น pattern มาในปริมาณมหาศาล, มี attention mechanism ที่ช่วยเชื่อมโยง context, และถูก fine-tune ให้ output มีประโยชน์จริง การเข้าใจกลไกเหล่านี้ช่วยให้ใช้งาน AI ได้ฉลาดขึ้น — รู้ว่าเมื่อไหรควรเชื่อผลลัพธ์ และเมื่อไหรควรตรวจสอบเพิ่มเติม ด้วยความสามารถของ
AI 资讯
Overcoming Architectural Dogma: Why Infrastructure is a Business Stage Decision
One of the most persistent traps in modern software development is the tendency to turn architectural styles into absolute dogmas. We see it constantly on social media and inside engineering rooms: teams arguing over cloud native versus cloud agnostic as if they are choosing a lifelong political alignment. A recent perspective from the engineering team at GeekyAnts titled "Cloud-Native and Cloud-Agnostic Are Not Ideologies; They Are Business-Stage Decisions" cuts through this industry noise. Looking critically at their argument, it becomes clear that many organizations are suffering from premature architectural complexity. Engineering leaders frequently romanticize absolute portability long before their business has the operational maturity or the market validation to justify it. The core takeaway is simple yet profound: your architectural choice should be a reflection of your business stage, not a philosophical stance. The Go To Market Trap In the earliest stages of a business, the primary goal is not infinite scalability. The primary goal is survival. A startup needs to discover product market fit before running out of capital. This requires maximum release velocity, rapid experimentation, and minimum operational overhead. For an early stage company, leveraging a cloud native approach is entirely rational. Relying on managed databases, serverless functions, provider native identity management, and integrated monitoring allows a tiny engineering team to focus entirely on product features. The critical flaw in many early architecture reviews is treating this cloud dependency as a failure. It is actually a deliberate speed asset. At this stage, worrying about vendor lock in is a distraction because if you do not find customers quickly, there will be no vendor left to be locked into. Changing Priorities as the Business Matures The architecture that helps a company launch is rarely the one that sustains its long term growth. As a software product gains traction, the op
AI 资讯
The Data Refinery: How JSON Quietly Became the Language AI Agents Speak
Every tool call, every structured output, every agent decision travels as JSON. Here is the serialization knowledge that separates the amateur from the architect — now that the stakes have never been higher. A developer ships an AI agent on a Friday. In the demo it's flawless: the model reads a request, calls a tool, returns a clean answer the app renders perfectly. A week later, production dashboards are full of garbage. A date is showing up as raw text. A field that was definitely there is silently gone. Under one big payload, the whole server froze for two seconds. And here's the maddening part — nothing threw an error. The model returned JSON. The code parsed it. Everything "worked." The bug wasn't in the model, and it wasn't in the parser. It lived in the narrow gap between text and data — the place every JSON value has to cross twice. That gap is serialization , and in 2026 it has quietly become one of the most important things a JavaScript engineer can actually understand. Why now? Because the most important conversations in modern software aren't between humans anymore. They're between models and machines — an LLM deciding which tool to call, a server answering, an agent chaining ten steps together. And every one of those conversations happens in the same format: JSON. So let's open up the refinery and see how raw structure becomes a clean stream of bytes — and back again — without losing anything precious on the way. JSON is not a JavaScript object This is the misunderstanding that creates most JSON bugs, so it's worth saying plainly: JSON only looks like a JavaScript object. It isn't one. JSON is a transport format — flat, inert text meant to travel across a network or sit on a disk. A JavaScript object is a live structure in memory that your application can read, mutate, and call methods on. They resemble each other the way a flat-packed cardboard box resembles assembled furniture: same thing in spirit, completely different states. const user = { name : "
AI 资讯
How I Cut Costs 65% Migrating LangChain to DeepSeek
How I Cut Costs 65% Migrating LangChain to DeepSeek I want to tell you about a switch I made recently that genuinely surprised me. If you're running LangChain in production and haven't explored the DeepSeek models yet, this one's for you. Let me show you what I learned, what broke, and what I'll never go back to. The short version? I was burning cash on a generic LLM setup. I migrated to DeepSeek through Global API's unified interface, and my monthly inference bill dropped by over 60%. Setup took me less time than brewing coffee. Let me walk you through it. Why I Even Looked at This in the First Place Here's the thing about working in AI engineering: the model landscape moves so fast that whatever you chose six months ago is probably overpriced now. That's been my experience, anyway. When I first built my LangChain pipeline, I defaulted to a popular name-brand model because, well, that's what everyone was using. It worked. It was fine. Then I looked at my AWS bill. That's when I started digging into alternatives. And let me tell you, the rabbit hole is deep. Global API alone exposes 184 AI models at prices ranging from $0.01 to $3.50 per million tokens. That's a wild spread. The trick is finding the sweet spot where cost meets quality, and for migration workloads (think: code translation, schema conversion, content rewrites), I found it with DeepSeek. Let me show you the numbers that actually mattered to me. The Pricing Reality Nobody Talks About I built a comparison table when I was making this decision, and I want to share it because staring at these numbers side by side is what convinced me. Here's the lineup I evaluated through Global API: DeepSeek V4 Flash sits at $0.27 per million input tokens and $1.10 per million output tokens, with a 128K context window. That's my default for most production traffic now. Fast, cheap, and smart enough for almost everything. DeepSeek V4 Pro comes in at $0.55 input and $2.20 output with a beefier 200K context. I use this when
AI 资讯
Distributing a Python desktop app on Windows and Mac — the full release pipeline
WP Maintenance Manager ships from a single Python codebase to both Windows and macOS. "Python is cross-platform — write once, run anywhere," the saying goes. The reality is that the distribution pipeline is completely separate per OS , each with its own pitfalls. PyInstaller / Inno Setup / Apple Notarization / eSigner — the release cycle is a combination of OS-specific toolchains. Here's the full picture, plus what to watch out for at each step. (The choice of internal architecture, Flask + browser UI, is covered separately in why we built a desktop app on local Flask + browser UI ; this post is about distributing that architecture across two operating systems.) The per-OS pipeline at a glance Step Mac Windows Build PyInstaller ( --target-arch x86_64 ) PyInstaller Distribution format .app bundle → .dmg folder → .exe installer Installer creation hdiutil / create_dmg.sh Inno Setup ( .iss script) Code signing codesign + Developer ID certificate eSigner CSC (cloud signing) Pre-distribution validation Apple Notarization SmartScreen reputation buildup Final artifact WP_Maintenance_Pro_X.X.X.dmg WP_Maintenance_Pro_Setup_X.X.X.exe Both OSes share PyInstaller, but the path diverges from there. Mac sits inside Apple's review process; Windows runs through Microsoft's reputation system. They're fundamentally different ecosystems. Mac — PyInstaller → sign → Notarization → DMG The Intel / Apple Silicon trap The first trap in Mac PyInstaller builds is architecture . Running pip install + python build_app.py on an Apple Silicon Mac without thinking produces native binaries (like cffi ) for arm64 only — which then don't run on Intel Macs at all. The fix is to run the entire build through arch -x86_64 : arch -x86_64 pip3 install -r requirements.txt arch -x86_64 python3 build_app.py That produces an .app containing only x86_64 binaries, which runs natively on Intel Macs and through Rosetta 2 on Apple Silicon — a unified distribution. Sign inside-out The .app PyInstaller produces conta
AI 资讯
AI Research Engineer Open-Sources His Entire Workflow and Prompts
Fable 5 came and went. And because it was taken away so quickly, developers wanted it back even more. Scarcity has a way of making things feel more valuable. Reviews during its short tenure described a model that was very capable and great at churning on long-running, ambiguous tasks. But it was too expensive. The model was also intelligent enough that, on large work and overhauls, it tended to overthink. Most likely because of its size. For iterative work like implementing a feature or change, Fable 5 was comparable head-to-head with GPT 5.5, except Fable 5 would run for 10x as long: a larger model, more overthinking, and more time. The other issue was fallback behavior. If you hit a case where the model needed to call the fallback Opus model, you would not necessarily know it happened, and you would be billed at the higher charge. Nonetheless, it was a noticeable change compared to existing models. It was good at churning on a specific, goal-oriented problem. For example, optimizing a slow path by repeatedly profiling, tracing call sites, tightening hot loops, and validating the regression budget. For architecture design, it was still not remarkable. So it was good at that goal-oriented push, but even within that you needed to run it in sessions, review its code, and steer or compact to get the results you wanted. It is a good model to use for planning, research, and review, which is where I had adopted it. I saw real benefits. However, when it came to orchestration or running workflows, I still believe GPT 5.5 is better and more cost-effective on both tokens and time. Personally, I care about token spend, but I care immensely more about my time. The bigger problem Fable 5 exposed Model capability aside, I still think we are missing a bigger problem, and Fable 5 put a magnifying lens on it because of the nature of its capabilities. AI adoption in organizations is still a challenge for many developers because there are not enough good examples of how power users of
AI 资讯
Mistakes I Made as a New Coder- Don't Repeat Them
When I started coding, I made so many silly mistakes 😅 Today I’m sharing 3 small mistakes that every beginner developer makes: 1. Trying to write "Perfect Code" on Day 1 Bro, your code will be messy at the start. Just make it work first. Perfect comes later. 2. Watching tutorials but not coding yourself Watching videos is easy. But you only learn when you type the code on your own laptop. 3. Getting scared of errors Red error ≠ Failure. Error = Teacher. Copy it to Google, you’ll find the fix. What mistake did YOU make when you started? Tell me in the comments 👇
AI 资讯
The Risk of Losing Your Know-how and Identity: Microsoft Satya Nadella's Warning on AI
There is a comparison that the artificial intelligence industry had kept out of the public conversation until now. Satya Nadella brought it up this Sunday in a post on X that garnered over a thousand responses in just a few hours. The metaphor he used is "industrial offshoring" . Just as the first wave of globalization hollowed out industrial economies, wiping out factory jobs and decades of competitive advantage with consequences we still feel today, artificial intelligence threatens to do the same to corporate knowledge. The Silent Drain of Expertise The mechanism Nadella describes is concrete. If an organization hands over its workflows, its domain knowledge, and the accumulated judgment of its teams to external AI models, those models absorb it. What was once a unique advantage, now could become a generic capability available to everyone. There are no layoffs or plant closures. The hollowing out happens silently, in every usage cycle, in every operation the model records and leverages. Where there was once exclusive know-how, there is now a standard resource. "You can outsource a task, or even a job. But you can never outsource the learning." Microsoft CEO Warns That AI Winners Could Hollow 'Entire Industries' - Business Insider AI models are hoovering up corporate knowledge, and that's leaving one big loser, says Satya Nadella. businessinsider.com The Invisible Asset / The Identity This warning is not directed at employees but at executives. The risk Nadella identifies is not the loss of an individual position, but the erosion of the organisation's collective intellectual property, its processes, and the judgment a team spends years building. To name this, he introduces a term that was not in the business management vocabulary until now: "Token Capital" . This represents the layer of agentic capability that a firm builds and owns when it connects its real workflows with the AI models it uses. It is not software or a database. It is a system that learns with eve