Introduction - Learning notes of Clean Code (1)

Some insightful thoughts

  1. Small things matter. God is in the details.
  • It is through practice in the small that professionals gain proficiency and trust for practice in the large.
  • The smallest bit of sloppy construction, of the door that does not close tightly, or slightly crooked tiles on the floor, or even the messy desk dispel the charm of the larger whole.
  1. In software, 80% or more of what we do is quaintly called “maintenance”: the act of repair. Good software practice requires such discipline: focus, present of mind and thinking. The 5S philosophy comprises these concepts:
  • Sort. Knowing where things are.
  • Systematize. A place for everything, and everything is in its place.
  • Shine. Keep the workplace free of hanging wires, grease, scraps, and waste.
  • Standardization. Agree about how to keep the workplace clean.
  • Self-discipline. That means having the discipline to follow the practice and to frequently reflect on one’s work and be willing to change.
  1. Making your code readable is as important as making it executable.

  2. Cleanliness is next to godliness.

  • He who is faithful in little is faithful in much.
  • An ounce of preventions is worth a pound of cure.
  1. Pay attention to small things, but also be honest in small things.
  • Do our best to leave campground cleaner than we found it.
  • To err is human, to forgive, divine.
  1. A clean shop floor reduces accidents and well-organized shop tools increase productivity.

Introduction

Writing clean code requires craftsmanship. Craftsmanship is acquired through knowledge and work. You must gain the knowledge of principles, patterns, practices and heuristics that a craftsman knows and you must also grind that knowledge into your fingers, eyes and gut by working hard and practicing.

Clean Code

Cost of bad code.

  1. Dad code slows down productivity over time. It’s unprofessional for programmer to bend to the will of managers who don’t understand the risks of making messes. You will not make the deadline by making the mess. The only way to go fast is to keep the code as clean as possible all the time.
  2. One broken window starts the process of decay. A building with broken windows looks like nobody cares about it. So other people stop caring. They allow more windows to become broken. Eventually they actively break them. They allow facade with graffiti and allow garbage to collect.

What is clean code?

  1. I like my code to be elegant and clean. The logic should be straightforward to make it hard for bugs to hide, the dependencies minimal to ease maintenance, error handling complete according to an articulated strategy, performance close to optimal so as not to tempt people to make the code messy with unprincipled optimizations. Clean code does one thing well. - Bjarne Stroustrup, inventor of C++.

  2. Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscure the designer’s intent but rather is full of crisp abstraction and straightforward line of controls. - Grady Booch, author of Object Oriented Analysis and Design with Application.

  3. I could list all of the qualities that I notice in clean code, but there is one overarching quality that leads to all of them. Clean code always looks like it was written by someone who cares. There is nothing obvious that you can do to make it better. All of those things were thought about by the code’s author, and if you try to imagine improvements, you’re led back to where you are, sitting in appreciation of the code someone left for you—code left by someone who cares deeply about the craft. - Micheal Feathers.

Books on art don’t promise to make you an artist. All they can do is to give you some of the tools, techniques and thought process that other artists have used. “Code-sense” can only be gained through practice.

Abstract: Gas metal arc welding (GMAW) is a widely used welding process in various industries. One of the significant challenges in GMAW is to achieve optimal welding parameters and minimize defects such as spatter and porosity. In this paper, we propose a deep-learning-based approach to analyze metal-transfer images in GMAW processes. Our approach can automatically detect and classify the different types of metal-transfer modes and provide insights for process optimization. Introduction: Gas metal arc welding (GMAW) is a welding process that uses a consumable electrode and an external shielding gas to protect the weld pool from atmospheric contamination. During the GMAW process, the metal transfer mode affects the weld quality and productivity. Three types of metal transfer modes are commonly observed in GMAW: short-circuiting transfer (SCT), globular transfer (GT), and spray transfer (ST). The selection of the transfer mode depends on the welding parameters, such as the welding current, voltage, and wire feed speed. The metal transfer mode can be observed using high-speed imaging techniques, which capture the dynamic behavior of the molten metal during welding. The interpretation of these images requires expertise and is time-consuming. To address these issues, we propose a deep-learning-based approach to analyze metal-transfer images in GMAW processes. Methodology: We collected a dataset of metal-transfer images using a high-speed camera during the GMAW process. The images were captured at a rate of 5000 frames per second, and the dataset includes 1000 images for each transfer mode. We split the dataset into training, validation, and testing sets, with a ratio of 70:15:15. We trained a convolutional neural network (CNN) to classify the metal-transfer mode from the images. We used the ResNet50 architecture with transfer learning, which is a widely used and effective approach for image classification tasks. The model was trained using the categorical cross-entropy loss function and the Adam optimizer. Results: We achieved an accuracy of 96.7% on the testing set using our deep-learning-based approach. Our approach can accurately detect and classify the different types of metal-transfer modes in GMAW processes. Furthermore, we used the Grad-CAM technique to visualize the important regions of the images that contributed to the classification decision. Conclusion: In this paper, we proposed a deep-learning-based approach to analyze metal-transfer images in GMAW processes. Our approach can automatically detect and classify the different types of metal-transfer modes with high accuracy. The proposed approach can provide insights for process optimization and reduce the need for human expertise in interpreting high-speed images. Future work includes investigating the use of our approach in real-time monitoring of the GMAW process and exploring the application of our approach in other welding processes.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值