Top 20 Programming Lessons
Here are my most memorable lessons so far.
Set a duration of how long you think it should take to solve a problem - C'mon, admit it! I'm just as guilty as the next programmer. I've seen programmers sit in front of a monitor for eight hours at a time trying to solve a particular problem. Set a time table for yourself of 1 hour, 30 minutes, or even 15 minutes. If you can't figure out a solution to your problem within your time frame, ask for help or research your problem on the Internet instead of trying to be super-coder.
A language is a language is a language - Over time, once you understand how one language works, you'll notice similarities between other languages. The language you choose should provide you with a suitable "comfort" level, the ability to produce efficient (and clean) code, and, above all, allow the language to suit the project and vice-versa.
Don't over-"design pattern" applications - Sometimes it's just easier to write a simple algorithm than it is to incorporate a singleton or facade pattern. For the most part, it even allows for cleaner, understandable code. :-)
Always backup your code - I've experienced a complete hard drive failue and lost a lot of code when I was younger and felt horrible because of what had happened. The one time you don't back up your data may be the one time where you have a strict deadline with a client and they need it tomorrow. Source code/version control applies here as well.
You are not the best at programming. Live with it. - I always thought that I knew so much about programming, but there is always someone out there better than you. Always. Learn from them.
Learn to learn more - With number five explained, I've always had a magazine or book in my hand about computers or programming (ask my friends, they'll confirm). True, there is a lot of technology out there and keeping up with it is a fulltime job, but if you have a smart way of receiving your news, you'll learn about new technology every single day.
Change is constant - Your knowledge of technology and/or programming should be similar to how you treat stocks: Diversify. Don't get too comfortable with a particular technology. If there's not enough support for that language or technology, you might as well start updating your resume now and start your training period. My general rule of thumb that has kept me going? Know at least two or three languages, so if one dies off, you have another one to fall back on while you train for a new technology.
Support Junior - Assist and train the junior/entry-level developers on good programming guidelines and techniques. You never know...you may move up in rank and you'll feel more confident having personally trained and prepared them for their next position.
Simplify the algorithm - Code like a fiend, but once you're done, go back through your code and optimize it. A little code improvement here and there will make support happier in the long run.
Document your code - Whether its documenting a Web Service API or documenting a simple class, document as you go. I've been accused of over-commenting my code and that's something I'm proud of. It only takes a second to add an additional comment line for each 3 lines of code. If it's a harder technique to grasp, don't be afraid to over-comment. This is one problem most architects, backup coders, and support groups don't complain about if you've done your job right.
Test, Test, Test - I'm a fan of Black Box Testing. When your routine is finished, your "stamp of approval" period starts. If you have a Quality Assurance department, you may be talking more to them than your project manager regarding errors in your code. If you don't test your code thoroughly, you may develop more than code. Possibly a bad reputation.
Celebrate every success - I've met a lot of programmers who have conquered headache-style problems with a great programming technique and celebrated with a fellow programmer by doing the "shake", the high-five, or even a "happy dance." Everyone has enlightening periods in their life and even though that one happy coder asked you to come and see his extraordinary piece of code and you've seen that one piece of code over 100 times in your experiences, celebrate the success of a fellow developer for the 101-st time.
Have Code Reviews Frequently - On projects and personally. In the company, you will always have code reviews of how well you coded something. Don't look at it as people crucifying your coding style. Think of it as constructive criticism. On the personal front, review your code and always ask, "How could I have done it better?" This will accelerate your learning and make you a better programmer.
Reminisce about your code - There are two ways to looking at old code: "I can't believe I wrote this code" and "I can't believe I wrote this code." The first statement is often of disgust and wondering how you can improve it. You'd be surprised at how old code can be resurrected into a possible and better routine, or maybe even an entire product. The second statement is of amazement and achievement. Developers have their one or two project code achievements that they completed and had everyone standing up and taking notice. Again, based on your excellent coding ability, you could take those past routines or projects and update them into a better product or idea.
Humor is necessary - In my 20 years of development, I have never met a programmer who hasn't had a decent sense of humor. Actually, in this industry, it's a requirement.
Beware the know-it-all, possessive coder, and the inexperienced coder - Humble yourself when you meet these types of coders. The know-it-all tries to upstage you instead of working as a team player, the defensive coder created code that he doesn't want to share with anyone, and the inexperienced coder constantly asks for assistance every ten minutes where the finished code developed is yours, not theirs.
No project is ever simple - I've been asked by friends, family, and associates to just "whip something up for me." To "whip" up a program or web site, it takes planning from both parties to complete something that both sides can appreciate. If someone needs a 3-page web site with Microsoft Access from the start, it winds up becoming a 15-page web site with SQL Server, a forum, and a custom CMS (Content Management System).
Never take anything for granted - If you take on a simple project, you may think that a certain section will be easy to complete. Don't think that even for a moment. Unless you have a class, component, or piece of code already coded...and has been tested thoroughly...and is in production from an existing project, don't think it will be easy.
Software is never finished - A fellow programmer once told me that software is never finished, it's "temporarily completed." Sound advice. If the client is still using a program you wrote and has stood the test of time, chances are, you are still updating it, which isn't a bad thing. It keeps you working. :-)
Patience is definitely a virtue - When clients, friends, or family members use a PC, they get frustrated and proceed to hit a component of the PC or storm off. I keep telling everyone, "you are controlling the computer not the other way around." You need to have a certain level of patience for programming computers. As soon as programmers understand what they did wrong, they look at it from the computers point of view and say, "Oh, that's why it was doing that.
I'd add this: Don't make it more complicated than it needs to be. For example, to comment on this blog, one needs javascript to be running in the browser. Was that really needed? (I happen to have javascript turned off by default. There's a Firefox plug in. But I used to see sites that only worked with IE. It wasn't required.) This is more, 'simplify your requirements'.
Also. Listen to the teddy bear. The story goes that at a big shop (it might have been at IBM), there was a table in the corner with a big teddy bear on it. When you couldn't figure out what was wrong with your code, you could go explain it to the teddy bear. It really works. But, the story goes, management didn't understand this, and took it away.
And. In the argument over if computer programming is engineering, consider that it isn't. If you build a car, there are reused parts - screws, wheels, etc. In a program, any resused parts are put into a subroutine. So, almost nothing is reused. While engineering is difficult, computer programs take that to an exponential absurdity. Computer programming is engineering on steroids. Rocket scientists should have it so easy.
2. While a language is a language from the point of view of learning a new one, they aren't from the point of view of the application. A Turing machine can, in principal, be used to create a database backed web site - but that doesn't make it a practical tool for the job.
5. While there are other programmers or even lifeless books that are smarter than you, and you can learn from them, sometimes the best way to learn something is to do it yourself.
You can also learn something you already know better by teaching it to someone else. You can use this to learn something better - by pretending to teach it to yourself the first time.
7. Change is inevitable. Except from vending machines.
But you should also consider the evolution of computer languages. In Evolution, the new species isn't better, it's just different. The environment decides if it will live or go extinct. Consider the C family tree. Was C better than BCPL? Well, structures are handy. I mean, it's a real pain to create linked lists without them. People did that in BCPL, though. Was C++ better than C? Operator overloading may be handy, but it can also be misused to obfuscate the code. And, calling methods can be much higher overhead than C ever had. It isn't always worth it. And Java doesn't generally compile to the bare metal. Each variant has trade offs. So companies that say that they'll only use Java have chosen to hammer in nails with a lovely screwdriver. And not a loose screw in sight.
13. When you do a code review, review the code, not the coder. But it's up to the coder to not take it personally.
15. I don't use smileys to indicate humor ;-) Feel free to laugh at the jokes - or not. When the tree falls - or stands, in the woods, I don't hear it.
19: All code needs to be rewritten. But that doesn't mean it should be.
20: Take your time. I type at around 70 words a minute. I hand-write at about 7. But if i hand write out code, then type it in, more total time has been spent, and fewer bugs result. This takes less time than the resulting debugging. And yet, I can kick out another 800 lines a day this way. That's hardly slow.
Just as mathematics can not be closed, there are no absolute truths (not even this one). None of these rules are absolute. You need to weigh them. So, while the authority says "Go-to's are harmful", or even "BASIC causes brain damage", it can be demonstrated with clear examples that a go-to is the right tool for the job, and that BASIC was the right introductory language for many. Think about it. There is no excuse for prejudice. The word 'prejudice' means 'without thinking', and you can't afford that. So, while no program is bug free, I've written two that were bug free from the start.
---
Every program has at least one bug.
Every program can be reduced in size by at least on line.
Therefore, every program can be reduced to a single line - which is a bug.
---
Nothing is better than complete happiness.
A buggy program is better than nothing.
Therefore, a buggy program is better than complete happiness.
-----转
Set a duration of how long you think it should take to solve a problem - C'mon, admit it! I'm just as guilty as the next programmer. I've seen programmers sit in front of a monitor for eight hours at a time trying to solve a particular problem. Set a time table for yourself of 1 hour, 30 minutes, or even 15 minutes. If you can't figure out a solution to your problem within your time frame, ask for help or research your problem on the Internet instead of trying to be super-coder.
A language is a language is a language - Over time, once you understand how one language works, you'll notice similarities between other languages. The language you choose should provide you with a suitable "comfort" level, the ability to produce efficient (and clean) code, and, above all, allow the language to suit the project and vice-versa.
Don't over-"design pattern" applications - Sometimes it's just easier to write a simple algorithm than it is to incorporate a singleton or facade pattern. For the most part, it even allows for cleaner, understandable code. :-)
Always backup your code - I've experienced a complete hard drive failue and lost a lot of code when I was younger and felt horrible because of what had happened. The one time you don't back up your data may be the one time where you have a strict deadline with a client and they need it tomorrow. Source code/version control applies here as well.
You are not the best at programming. Live with it. - I always thought that I knew so much about programming, but there is always someone out there better than you. Always. Learn from them.
Learn to learn more - With number five explained, I've always had a magazine or book in my hand about computers or programming (ask my friends, they'll confirm). True, there is a lot of technology out there and keeping up with it is a fulltime job, but if you have a smart way of receiving your news, you'll learn about new technology every single day.
Change is constant - Your knowledge of technology and/or programming should be similar to how you treat stocks: Diversify. Don't get too comfortable with a particular technology. If there's not enough support for that language or technology, you might as well start updating your resume now and start your training period. My general rule of thumb that has kept me going? Know at least two or three languages, so if one dies off, you have another one to fall back on while you train for a new technology.
Support Junior - Assist and train the junior/entry-level developers on good programming guidelines and techniques. You never know...you may move up in rank and you'll feel more confident having personally trained and prepared them for their next position.
Simplify the algorithm - Code like a fiend, but once you're done, go back through your code and optimize it. A little code improvement here and there will make support happier in the long run.
Document your code - Whether its documenting a Web Service API or documenting a simple class, document as you go. I've been accused of over-commenting my code and that's something I'm proud of. It only takes a second to add an additional comment line for each 3 lines of code. If it's a harder technique to grasp, don't be afraid to over-comment. This is one problem most architects, backup coders, and support groups don't complain about if you've done your job right.
Test, Test, Test - I'm a fan of Black Box Testing. When your routine is finished, your "stamp of approval" period starts. If you have a Quality Assurance department, you may be talking more to them than your project manager regarding errors in your code. If you don't test your code thoroughly, you may develop more than code. Possibly a bad reputation.
Celebrate every success - I've met a lot of programmers who have conquered headache-style problems with a great programming technique and celebrated with a fellow programmer by doing the "shake", the high-five, or even a "happy dance." Everyone has enlightening periods in their life and even though that one happy coder asked you to come and see his extraordinary piece of code and you've seen that one piece of code over 100 times in your experiences, celebrate the success of a fellow developer for the 101-st time.
Have Code Reviews Frequently - On projects and personally. In the company, you will always have code reviews of how well you coded something. Don't look at it as people crucifying your coding style. Think of it as constructive criticism. On the personal front, review your code and always ask, "How could I have done it better?" This will accelerate your learning and make you a better programmer.
Reminisce about your code - There are two ways to looking at old code: "I can't believe I wrote this code" and "I can't believe I wrote this code." The first statement is often of disgust and wondering how you can improve it. You'd be surprised at how old code can be resurrected into a possible and better routine, or maybe even an entire product. The second statement is of amazement and achievement. Developers have their one or two project code achievements that they completed and had everyone standing up and taking notice. Again, based on your excellent coding ability, you could take those past routines or projects and update them into a better product or idea.
Humor is necessary - In my 20 years of development, I have never met a programmer who hasn't had a decent sense of humor. Actually, in this industry, it's a requirement.
Beware the know-it-all, possessive coder, and the inexperienced coder - Humble yourself when you meet these types of coders. The know-it-all tries to upstage you instead of working as a team player, the defensive coder created code that he doesn't want to share with anyone, and the inexperienced coder constantly asks for assistance every ten minutes where the finished code developed is yours, not theirs.
No project is ever simple - I've been asked by friends, family, and associates to just "whip something up for me." To "whip" up a program or web site, it takes planning from both parties to complete something that both sides can appreciate. If someone needs a 3-page web site with Microsoft Access from the start, it winds up becoming a 15-page web site with SQL Server, a forum, and a custom CMS (Content Management System).
Never take anything for granted - If you take on a simple project, you may think that a certain section will be easy to complete. Don't think that even for a moment. Unless you have a class, component, or piece of code already coded...and has been tested thoroughly...and is in production from an existing project, don't think it will be easy.
Software is never finished - A fellow programmer once told me that software is never finished, it's "temporarily completed." Sound advice. If the client is still using a program you wrote and has stood the test of time, chances are, you are still updating it, which isn't a bad thing. It keeps you working. :-)
Patience is definitely a virtue - When clients, friends, or family members use a PC, they get frustrated and proceed to hit a component of the PC or storm off. I keep telling everyone, "you are controlling the computer not the other way around." You need to have a certain level of patience for programming computers. As soon as programmers understand what they did wrong, they look at it from the computers point of view and say, "Oh, that's why it was doing that.
I'd add this: Don't make it more complicated than it needs to be. For example, to comment on this blog, one needs javascript to be running in the browser. Was that really needed? (I happen to have javascript turned off by default. There's a Firefox plug in. But I used to see sites that only worked with IE. It wasn't required.) This is more, 'simplify your requirements'.
Also. Listen to the teddy bear. The story goes that at a big shop (it might have been at IBM), there was a table in the corner with a big teddy bear on it. When you couldn't figure out what was wrong with your code, you could go explain it to the teddy bear. It really works. But, the story goes, management didn't understand this, and took it away.
And. In the argument over if computer programming is engineering, consider that it isn't. If you build a car, there are reused parts - screws, wheels, etc. In a program, any resused parts are put into a subroutine. So, almost nothing is reused. While engineering is difficult, computer programs take that to an exponential absurdity. Computer programming is engineering on steroids. Rocket scientists should have it so easy.
2. While a language is a language from the point of view of learning a new one, they aren't from the point of view of the application. A Turing machine can, in principal, be used to create a database backed web site - but that doesn't make it a practical tool for the job.
5. While there are other programmers or even lifeless books that are smarter than you, and you can learn from them, sometimes the best way to learn something is to do it yourself.
You can also learn something you already know better by teaching it to someone else. You can use this to learn something better - by pretending to teach it to yourself the first time.
7. Change is inevitable. Except from vending machines.
But you should also consider the evolution of computer languages. In Evolution, the new species isn't better, it's just different. The environment decides if it will live or go extinct. Consider the C family tree. Was C better than BCPL? Well, structures are handy. I mean, it's a real pain to create linked lists without them. People did that in BCPL, though. Was C++ better than C? Operator overloading may be handy, but it can also be misused to obfuscate the code. And, calling methods can be much higher overhead than C ever had. It isn't always worth it. And Java doesn't generally compile to the bare metal. Each variant has trade offs. So companies that say that they'll only use Java have chosen to hammer in nails with a lovely screwdriver. And not a loose screw in sight.
13. When you do a code review, review the code, not the coder. But it's up to the coder to not take it personally.
15. I don't use smileys to indicate humor ;-) Feel free to laugh at the jokes - or not. When the tree falls - or stands, in the woods, I don't hear it.
19: All code needs to be rewritten. But that doesn't mean it should be.
20: Take your time. I type at around 70 words a minute. I hand-write at about 7. But if i hand write out code, then type it in, more total time has been spent, and fewer bugs result. This takes less time than the resulting debugging. And yet, I can kick out another 800 lines a day this way. That's hardly slow.
Just as mathematics can not be closed, there are no absolute truths (not even this one). None of these rules are absolute. You need to weigh them. So, while the authority says "Go-to's are harmful", or even "BASIC causes brain damage", it can be demonstrated with clear examples that a go-to is the right tool for the job, and that BASIC was the right introductory language for many. Think about it. There is no excuse for prejudice. The word 'prejudice' means 'without thinking', and you can't afford that. So, while no program is bug free, I've written two that were bug free from the start.
---
Every program has at least one bug.
Every program can be reduced in size by at least on line.
Therefore, every program can be reduced to a single line - which is a bug.
---
Nothing is better than complete happiness.
A buggy program is better than nothing.
Therefore, a buggy program is better than complete happiness.
-----转
相关推荐
Umi-OCR-main.zip
基于springboot+Web的毕业设计选题系统源码数据库文档.zip
基于springboot校外兼职教师考勤管理系统源码数据库文档.zip
58商铺全新UI试客试用平台网站源码
基于springboot大学生就业信息管理系统源码数据库文档.zip
基于SpringBoot的口腔诊所系统源码数据库文档.zip
数据存放网盘,txt文件内包含下载链接及提取码,永久有效。失效会第一时间进行补充。样例数据及详细介绍参见文章:https://blog.csdn.net/T0620514/article/details/143956923
3-240P2162218.zip
网络安全 基于Qt创建的Linux系统下的浏览器.zip
C++ 类和对象:多态-练习题目2(制作咖啡和茶叶)
基于springboot+J2EE在线项目管理与任务分配中的应用源码数据库文档.zip
简介本项目提供了一个在51单片机上运行的简单操作系统,旨在帮助学习者深入理解操作系统的基本原理和任务调度机制。该操作系统通过汇编和C语言编写,实现了任务调度、中断处理等核心功能,并提供了详细的源代码和注释,方便学习和实践。
本文将深度卷积神经网络(CNN)设计实现一个复杂结构的生成模型,旨在通过多阶段的编码器-解码器结构,能够有效地将灰度图像转换为彩色图像。最后,本文将实现一个简单的Web应用,用户可以通过上传灰度图像,应用会使用预训练的Caffe模型对其进行颜色化,并将结果返回给用户。 1.模型设计:模型由多个卷积层、ReLU激活函数和批归一化层组成,通过前向传播函数将输入的灰度图像(L通道)转换为彩色图像(ab通道)。如果指定了 pretrained=True,则会自动下载并加载预训练的模型权重。 2. 系统通过Flask框架提供了一个Web应用,用户可以上传灰度图像,系统会自动将其转换为彩色图像,并在网页上显示结果。整个过程包括文件验证、图像处理、颜色化预测和结果展示,具有较高的实用性和用户体验。
一个JAVA图形化的、联网的五子棋游戏.zip javaweb
KWDB 是一款面向 【AIoT 场景】的【分布式多模数据库】,支持在同一实例同时建立时序库和关系库并融合处理多模数据,具备千万级设备接入、百万级数据秒级写入、亿级数据秒级读取等时序数据高效处理能力,具有稳定安全、高可用、易运维等特点。
页面数量:7页 网页主题:网站模板、酒店网站模板、官方网站模板 网页页面:首页、关于我们、相关服务、服务详情、在线博客、博客详情、在线留言 页面实现元素:加载动画、滚动加载、主题切换、导航栏 、轮播图、图文列表、图片切换、 文字列表、 按钮悬停、图片悬停、表单 实现技术:HTML、CSS 、JQuery 源码样式及js文件均分开存放,所有内容仅供初学者学习参考
内容概要:本文档提供了详细的 Neo4j 安装与配置指南,涵盖 Windows、Linux 和 Mac 系统的安装步骤。具体包括下载、安装、启动服务、修改配置文件(如端口配置、远程访问和内存限制)、设置管理员密码以及基本的 Cypher 查询语言使用方法。同时,还提供了一些常见问题及其解决方案。 适合人群:数据库管理员、软件开发人员、系统管理员。 使用场景及目标:①帮助初学者快速掌握 Neo4j 的安装与配置;②适用于需要搭建和使用图数据库的项目;③为已有用户解决常见问题。 其他说明:本文档不仅包含了基础的安装和配置流程,还提供了实际操作中可能遇到的问题及其解决方法,有助于提高使用者的实际操作能力。
基于SpringBoot+Vue的软件产品展示销售系统源码数据库文档.zip
《书戴嵩画牛》教学课件.pptx
20届智能车 【项目资源】:包含前端、后端、移动开发、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源,毕业设计等各种技术项目的源码。包括C++、Java、python、web、C#、EDA等项目的源码。 【适用人群】:适用于希望学习不同技术领域的初学者或进阶学习者。可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。 【附加价值】:项目具有较高的学习借鉴价值,也可直接拿来修改复刻。对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。 【沟通交流】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。鼓励下载和使用,并欢迎大家互相学习,共同进步。