cancel
Showing results for 
Search instead for 
Did you mean: 

So You’re Learning to Code? Let’s Talk

Level 9

By Corey Adler (ironman84), professional software developer

Greetings thwack®! You may know me as the guy who always pesters Leon during SolarWinds Lab™ (lab.solarwinds.com). What you don’t know is that Leon has been pestering me for quite a while to share some dev knowledge with all of you outside of Lab. I doubt a week has gone by without him asking me to contribute. I have finally acquiesced, and here is the result. For those of you networking types who like to dabble in the coding arts, here are a few tips to help you have a long and prosperous journey.

You are our new best friend…

Yes, it’s true! We’re happy that you’ve joined us. If you ever need any help, whatsoever, feel free to pester us. The more DBAs, network gurus, etc. that understand what developers go through, the better we’ll all be at communicating what’s needed to get our projects out the door in time. Imagine it in reverse: If a developer started learning and genuinely trying to understand what it is that you do, wouldn’t you encourage it? I have certainly come across a good number of IT people who’ve lamented how ignorant developers (and  their managers) are.  One job, in particular, had me interacting with the IT guys regularly, and they grew to like me because I wasn’t demanding ridiculous things for my project, I always listened, and I showed them that I wanted to learn the reasons behind what they were doing.

…and our worst nightmare

The reason for this should be pretty obvious. How many times have you seen a co-worker with less experience and technical knowledge than you successfully convince management to do something you know will end badly?  Or the person who doesn’t even have A+ certification who tries to solve a network issue instead of a CCIE? In both cases, I put good odds on something getting screwed up. Often, people who have just learned something think they know exactly how to use that new information. Trust me on this one: If you don’t have the know-how, don’t get involved. If you think that you know exactly what we need without talking to us first, you probably don’t.

For these first two points, the best approach, in summation, is for both sides to do something insane: COMMUNICATE!

Don’t try to reinvent the wheel

Imagine that someone wants to learn how cars work. They’re trying to figure out a good project that will help them dive right into the learning process. They go back and forth about it, and finally decide to create something that will change a stick-shift transmission into an automatic one. Is this person going to learn a lot about how cars work? Certainly! Is this going to be something practical that they will do on a regular basis? Probably not.

The same thing happens with programming. Chances are, someone has already created a tool that will help you do the thing you want to do, if not do it for you. Want to use CSS to have some cool styling on your Web page? Use Bootstrap to do it! Want to do some DOM manipulation in JavaScript®? Use jQuery®! Or how about setting up binding in your forms? Use Knockout! Does this mean that there’s no benefit to doing it the hard way? Absolutely not. It’s just unlikely that you’ll do it the hard way in practice. If you want to learn how to code properly, you should try and emulate those of us who do it for a living.

I hope this has been useful for you. Let me know if you want any more tips, tricks, or just general help. Remember the first point: I’d love to help you out! Until next time, I wish you good coding.

17 Comments
MVP
MVP

Sometimes having the knowledge of doing it the hard way gives you insight to how the mechanism works and prevents you from falling into some of the traps that may exist.

Then there is the time when the best way or the only way is the hard way. 

Easiest analogy I can think of is from the fire training service fire academy...it is called "chain saw appreciation day".

On that day you use an axe or woodmaul to do all your work instead of the chainsaw...why ?  Because if there isn't a spare chainsaw or it for some reason is not working or got damaged you have the skills and ability to still accomplish your task.  Same thing applies to coding....know different ways to accomplish the same task and choose the best, most efficient, SCALABLE, and MAINTAINABLE code for project at hand.  Think about future updates and how code may have to change...so use modular functions so you can build it like lego blocks.

Level 14

Agree with Jfrazier‌ that sometimes "the hard way" is a great teacher. Because I have had to slog through some things with very little background or nearby resources I have learned to focus more and rely on my past experience. I do not consider myself a programmer, but have done some form of coding in various languages and environments for a long time. I keep a library of handy solutions for quick ways to do certain repeatable  tasks, this way I can plug those in and get moving on the "newer" sections of code. Additionally, I keep looking for newer tools to help in the process.

Last point.... annotate your code. Someone else may have to look at it down the road... and if there are special circumstances noting them can save the next person a ton of grief!

MVP
MVP

gsutherland@sharoncu.com‌ brings on a point I failed to mention as well.... well documented code both internally annotated and externally in run books and in a group service catalog setting greatly enhances it's use and "abuse" by others.  It is also good to list gotcha's and typical solutions to commonly encountered "opportunities".

Level 9

You're right, Jfrazier . I'm not saying that the only way to go is to look at the latest tools and use them, but that oftentimes a library or a plugin has been created specifically for that problem in mind. An example from a project that I'm currently on: I have some text boxes on an HTML form that I want to only allow numeric inputs. The trouble is that half of the browsers out there don't currently support the HTML 5 specification for having 'type="numeric"' within an <input> tag. Now, could I have created a JavaScript key-press event within the boxes and make sure that the input code matched a number? Sure. But I saw online that someone had written a jQuery plugin that did all of that, as well as handled some boundary cases that I hadn't considered yet. So instead of spending the time to write it myself, I downloaded that plug in, inserted it, and wrote one line of jQuery code to hook up every box to use the one from the plugin. Problem solved.

Obviously it's important to make sure that it's the right solution for now and the future, but many of these tools (why I specifically mentioned Bootstrap and jQuery) are tried and true ways of solving many problems that would normally take you longer to accomplish your goals. For someone who is starting to get into coding, and who wants to learn how to do things like we do, it would be to their benefit to learn some of these tools so that they can get stuff done faster, and with less headache. Because I don't want those people turning into other people that I know who shy away from coding because it "looks hard".If done the right way, with the right tools, it can be a cinch to pick up.

Level 9

Oh, absolutely. And to employ self-documenting code techniques as well. I've had some variable names that were over 50 characters in length just to make sure that it was crystal clear what it was there for and what it was doing there.

Level 9

I'd also like to add that if you do take up wanting to learn programming it is ideal to pick an easy to use language and stick to using it while you learn.  Also, there are a number of different options which are free and well structured from an academic perspective.  I plan to someday be in an automation role using tools like Ansible and so took up learning python via coursera (https://class.coursera.org/interactivepython1).  I'm taking the signature track because I plan to continue through the whole Fundamentals of Computing Course and would like to add it to my CV but you can audit the class for free.

Level 14

Learned the hard way to annotate when I got a call three years after I left a company and had someone ask about a piece of "temporary" code I wrote that had an original shelf life of 4-6 months asking why I did something the way I did.

(answered my former co-worker politely and then reminded them it was intended to be a temporary throw away solution.. she laughed and said "I know...I reminded them, but they don't want to spend the money for the app we told them we needed back then!")

MVP
MVP

Another point to think about when coding...make it and any internal annotations 3 AM friendly.

No matter how much sense it makes to you now...6 months later at 3 AM when it breaks it won't make any sense unless you annotate it and code it properly.

While it makes sense when you write it to embed a function call into a function call and possibly another function call...at 3 AM it is tough to figure out what the heck you were doing and what the results being passed to subsequent calls.  Granted it makes more verbose code, but I like to make each function call a separate call so that I can potentially look at variable data going into each call.  Also, build a logging function with a timestamp and use it to log specific events in your code and or conditions.  Also include a location notation in the logged event so you know where in the code it had it's issue.

Level 14

LOL on 3 am friendly... But an excellent point... "reinventers" tend to think everyone will understand what they have done so why leave comments...

sometimes the annotation even helps me at 3 AM in the event I am not fully awake..

MVP
MVP

gsutherland@sharoncu.com That is the point...

One thing that I fear from all the short cuts to hard coding is that we are raising a generation of "Google Coders" and I don't mean people who could code at Google, but rather people who have to Google every solution.

Look at many of the apps on the various app stores, more and more are built with systems designed for "People who have not coding ability to still code their games."  Even Microsoft Virtual Academy makes it hare to find classes on development that don't send you to AppMaker, MonoCode or Construct

That is why I love stack overflow.  The community is designed to help you find answers...not just give you them so you can grow as a developer.  I see it all around me... lazy coders who make lazy code.  The easy way is not always the best way.

Just call me the Bear Grylls of Coding.

I like the lessons here.  Back in the 90's I brought up a full web site (from scratch) for a non-profit for the sheer enjoyment of their ventures.  There were few (no?) standard web design apps available they could afford, so I learned and built html pages for them with Notepad and IE and Netscape.

I'd never do that low-level keyboarding on a web page today, but I sure learned a lot that helped me understand what goes on in the background.

So it is with Apps folk & SA's & Network Engineers and DBA's, etc. 

Your goal of making new friends and clients and users through sharing your skills helps everyone.

Good post!

Level 14

Scripting is the extent of my coding.  I tried my hand at coding two decades ago.  As much fun as it was, I quickly realized that my strong suit was hardware.  I have nothing but respect for coders. 

Level 8

I'm a computer guy, technical name for it. I've been playing with computers since the 70's, for pay since the 80's and in the nuclear labs since the 90's.

I started in cyber because I got a virus, Friday the Thirteenth. Nasty piece of work and it opened my eyes. I've been hooked ever since. Now cyber research in industrial control networks is my job.

SO when I joined up here(Geek Speak), it being security related and all, i hope you expect that new members check you out. No I'm not going to hack you but, there is more to cyber than attacking someone. Take for instance email. This site is on solarwinds.com and maintained by people at solarwinds.com. So you would expect that email would come from solarwinds.com. Any email purported to be from here should eventually come from, well, here. And while the return addresses on the two emails I got both pointed to here, they weren't sent from here.

From the headers,

Received: from solarwinds-v7-wa02.m2phx1.jivehosted.com (ip51-vlb1-services.phx1.jivehosted.com [10.160.25.51])

Something doesn't "jive".

First off it's not from the same company as it is supposed to, and the name, jivehosted? And then a 10. ip address?

Having solarwinds as part of the name of the system but not the domain is also a red flag of someone trying to phish you. 4 strikes against you in one line of the header. (and the name phx1, could mean phish1 maybe, it sounds similar when you say it slow enough. OK I am pushing it but I hope you get my point.)

That's not good.

Both of the emails have exactly the same line in the header but are from different people so a nat network maybe or the email is being sent from a web form or automated emailer from within the web app I suppose, doesn't matter it is just enough off to ask questions.

I know jivehosted is probably your provider but strictly speaking that email should be tossed and never referred to again because there is no way, in the email headers, to confirm that this email, from a security provider, is actually from them or if it's phishing. it's a little detail but telling.

How many of the rest of the people who receive these mails each day checked. Did they then check out jivehosted, find a business connection to Solarwinds and proved to themselves that this is a legitimate email? How many asked the person at solarwinds to confirm it was real (before opening the email. I still haven't actually opened the emails, I have a process on all new email sources I expect to get emails from over any significant length of time, and I hoping that Geek Speak is worth keeping the line open to.)

Of course if they are not real then you guys have an even bigger issue!

Yeah, i was looking at another product from another company and I was the first person to ask if they had sent the email even though the from in the headers was not the company they worked for. (In that case they did mass emails through a provider.) And to tell you the truth I am not 100% sure our emails from here go out with our domain on them, they may still have our old domain, we got renamed.

I know I'm paranoid. Isn't that in the job description?

This is how I would fix this, when a person signs up tell them they will receive an email from this other company because they are our provider. You know to help us paranoid security people know we can relax.

I mean, you're in the security business you have to cross the tee's and dot the I's. I don't, I'm a researcher I get to play and mess up, that is also in the job description; a bad result is still a result! IT hate me, I play at security, they have to actually do security 🙂

Sorry for my first comment to be a long running rant but it's what i do, try stuff and then write rants about it. And they pay me to do this!

Level 12

yes learning best way

MVP
MVP

interesting that some people differentiate scripting and coding...

Even scripting is coding although usually for simple tasks or repeatable batch operations.

While something like perl or rexx are considered scripting languages, I have seen some rather elaborate programs spanning over 1000 lines of code.

Perl is great in that they are many modules people have built and shared to solve many common needs so to do certain things you install the module and then effectively make a function call.

While I haven't built any modules yet, I do use and retain subroutines for inclusion in new code...  One of my more common routines is a logging routine.

It logs a line of text to a specific application log or to the syslog based on how it is called along with a timestamp. I am working on including logging levels for future use so when the program is called or a

config file is used, you can set a logging level.

MVP
MVP

"Don't reinvent the wheel" can't be said enough. I see guys all the time trying to over complicate basic tasks because they think they can do it better.