Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      CodeSOD: Functionally, a Date

      September 16, 2025

      Creating Elastic And Bounce Effects With Expressive Animator

      September 16, 2025

      Microsoft shares Insiders preview of Visual Studio 2026

      September 16, 2025

      From Data To Decisions: UX Strategies For Real-Time Dashboards

      September 13, 2025

      DistroWatch Weekly, Issue 1139

      September 14, 2025

      Building personal apps with open source and AI

      September 12, 2025

      What Can We Actually Do With corner-shape?

      September 12, 2025

      Craft, Clarity, and Care: The Story and Work of Mengchu Yao

      September 12, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Can I use React Server Components (RSCs) today?

      September 16, 2025
      Recent

      Can I use React Server Components (RSCs) today?

      September 16, 2025

      Perficient Named among Notable Providers in Forrester’s Q3 2025 Commerce Services Landscape

      September 16, 2025

      Sarah McDowell Helps Clients Build a Strong AI Foundation Through Salesforce

      September 16, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      I Ran Local LLMs on My Android Phone

      September 16, 2025
      Recent

      I Ran Local LLMs on My Android Phone

      September 16, 2025

      DistroWatch Weekly, Issue 1139

      September 14, 2025

      sudo vs sudo-rs: What You Need to Know About the Rust Takeover of Classic Sudo Command

      September 14, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: What a CAD

    CodeSOD: What a CAD

    July 31, 2025

    In my career, several times I’ve ended up being the pet programmer for a team of engineers and CNC operators, which frequently meant helping them do automation in their CAD tools. At its peak complexity, it resulted in a (mostly unsuccessful) attempt to build a lens/optics simulator in RhinoCAD.

    Which brings us to the code Nick L sends us. It sounds like Nick’s in a similar position: engineers write VB.Net code to control their CAD tool, and then Nick tries desperately to get them to follow some sort of decent coding practice. The result is code like:

    <span class="hljs-comment">'Looping Through S_Parts that have to be inital created</span>
    <span class="hljs-keyword">For</span> <span class="hljs-keyword">Each</span> Item As Object <span class="hljs-keyword">In</span> RootPart.S_PartsToCreate
    	<span class="hljs-keyword">If</span> Item.objNamDe IsNot String.<span class="hljs-literal">Empty</span> <span class="hljs-keyword">Then</span>
    		<span class="hljs-keyword">If</span> Item.objNamEn IsNot String.<span class="hljs-literal">Empty</span> <span class="hljs-keyword">Then</span>
    			<span class="hljs-keyword">If</span> Item.artCat IsNot String.<span class="hljs-literal">Empty</span> <span class="hljs-keyword">Then</span>
    				<span class="hljs-keyword">If</span> Item.prodFam IsNot String.<span class="hljs-literal">Empty</span> <span class="hljs-keyword">Then</span>
    					<span class="hljs-keyword">If</span> Item.prodGrp IsNot String.<span class="hljs-literal">Empty</span> <span class="hljs-keyword">Then</span>
    						<span class="hljs-comment">'Checking if the Mandatory Properties are in the partfamilies and not empty</span>
    						<span class="hljs-keyword">If</span> Item.Properties.ContainsKey(<span class="hljs-string">"From_sDesign"</span>) <span class="hljs-keyword">Then</span>
    							<span class="hljs-comment">' I omitted 134 lines of logic that really should be their own function</span>
    						<span class="hljs-keyword">Else</span>
    							<span class="hljs-built_in">MsgBox</span>(<span class="hljs-string">"Property From_SDesign is missing or empty."</span>, MsgBoxStyle.DefaultButton2, <span class="hljs-string">"Information RS2TC"</span>)
    							<span class="hljs-keyword">Exit</span> <span class="hljs-keyword">Sub</span>
    						<span class="hljs-keyword">End</span> <span class="hljs-keyword">If</span>
    					<span class="hljs-keyword">Else</span>
    						<span class="hljs-built_in">MsgBox</span>(<span class="hljs-string">"Property prodGrp is missing or empty."</span>, MsgBoxStyle.DefaultButton2, <span class="hljs-string">"Information RS2TC"</span>)
    						<span class="hljs-keyword">Exit</span> <span class="hljs-keyword">Sub</span>
    					<span class="hljs-keyword">End</span> <span class="hljs-keyword">If</span>
    				<span class="hljs-keyword">Else</span>
    					<span class="hljs-built_in">MsgBox</span>(<span class="hljs-string">"Property prodFam is missing or empty."</span>, MsgBoxStyle.DefaultButton2, <span class="hljs-string">"Information RS2TC"</span>)
    					<span class="hljs-keyword">Exit</span> <span class="hljs-keyword">Sub</span>
    				<span class="hljs-keyword">End</span> <span class="hljs-keyword">If</span>
    			<span class="hljs-keyword">Else</span>
    				<span class="hljs-built_in">MsgBox</span>(<span class="hljs-string">"Property artCat is missing or empty."</span>, MsgBoxStyle.DefaultButton2, <span class="hljs-string">"Information RS2TC"</span>)
    				<span class="hljs-keyword">Exit</span> <span class="hljs-keyword">Sub</span>
    			<span class="hljs-keyword">End</span> <span class="hljs-keyword">If</span>
    		<span class="hljs-keyword">Else</span>
    			<span class="hljs-built_in">MsgBox</span>(<span class="hljs-string">"objNamEn is missing or empty."</span>, MsgBoxStyle.DefaultButton2, <span class="hljs-string">"Information RS2TC"</span>)
    			<span class="hljs-keyword">Exit</span> <span class="hljs-keyword">Sub</span>
    		<span class="hljs-keyword">End</span> <span class="hljs-keyword">If</span>
    
    	<span class="hljs-keyword">Else</span>
    		<span class="hljs-built_in">MsgBox</span>(<span class="hljs-string">"objNamDe is missing or empty."</span>, MsgBoxStyle.DefaultButton2, <span class="hljs-string">"Information RS2TC"</span>)
    		<span class="hljs-keyword">Exit</span> <span class="hljs-keyword">Sub</span>
    	<span class="hljs-keyword">End</span> <span class="hljs-keyword">If</span>
    <span class="hljs-keyword">Next</span>
    

    All of their code is stored in a single file called Custom.vb, and it is not stored in source control. Yes, people overwrite each other’s code all the time, and it causes endless problems.

    Nick writes:

    I really wish we’d stop letting engineers code without supervision. Someone should at least tell them about early returns.

    [Advertisement] Picking up NuGet is easy. Getting good at it takes time. Download our guide to learn the best practice of NuGet for the Enterprise.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleTime-Controlled Data Processing with Laravel LazyCollection Methods
    Next Article GitHub chiede un Fondo Sovrano Europeo per l’Open Source: ecco perché è (finalmente) una buona idea

    Related Posts

    News & Updates

    DistroWatch Weekly, Issue 1139

    September 14, 2025
    News & Updates

    Building personal apps with open source and AI

    September 12, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    Sophos Intercept X for Windows Vulnerabilities Enable Arbitrary Code Execution

    Security

    CVE-2025-7134 – Campcodes Online Recruitment Management System SQL Injection Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Claude can now save you more time by automatically referencing past chats

    News & Updates

    Microsoft Teams Is Getting Stronger Protection Against Malicious URLs

    Operating Systems

    Highlights

    Development

    Translate Your App to Other Languages With Laravel Gemini Translator

    June 26, 2025

    The Gemini AI translator package for Laravel extracts translation keys in your Laravel project and…

    CVE-2024-41797 – Siemens SCALANCE and RUGGEDCOM Authentication Bypass Vulnerability

    June 10, 2025

    CVE-2025-50740 – AutoConnect Arduino Library XSS Vulnerability

    August 6, 2025

    CVE-2024-42209 – HCL Connections Information Disclosure Vulnerability

    July 17, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.