Showing posts with label coding. Show all posts
Showing posts with label coding. Show all posts

Friday, November 13, 2020

Good Coding Tip: NEVER USE ELSE Statement

This author has a really good point (to NEVER USE ELSE statements) that I've never spent much time meditating on.

"We can see that without the if statement, we can't determine what this [else] is meant to be doing. Why would it return an empty string? Is this an error, or the ‘normal' behaviour? This code instead relies on us remembering, and having read, the earlier context. This doesn't matter much when the statements are small, but if there's complicated logic within the
if { … }
block or we are scanning quickly, then the separation of context from code can hurt readability massively. It hurts even more when if/else statements are nested, or there are multiple of them in one function (which if statement is this else for?)."

Read the full article here:

https://dev.to/dglsparsons/write-better-code-and-be-a-better-programmer-by-never-using-else-statements-4dbl

Tuesday, July 21, 2020

Monday, February 24, 2020

Top Browsers in 2020

When I read this strange article about the top browsers for developers, I'm usually skeptical. But, seeing the expected browsers was logical to consider.

  1. Firefox (Developer Edition)
  2. Google Chrome (for Developers)
  3. Opera (for Developers)
  4. Polypane - never heard of this but will now consider and test
  5. Blisk - never heard of this and am skeptical
  6. Safari - like for real, in 2020?

Reference

https://www.webdesignerdepot.com/2020/02/6-best-browsers-for-developers-in-2020/

Wednesday, November 20, 2019

Review: Top Ten Software Skills by 2020

I still don't see anyone publishing the push for managers to upgrade their thinking and leadership for development teams to keep up with the global tech competition. Specifically, many developers have families and can't afford to spend all of their time developing. That's just a part of life - to have a family. Instead, I see managers still *encouraging* developers to learn to keep with the rapid changing pace of technology without providing the means necessary to stay relevant or leap ahead.

Anyhow, thankful for this list stating the next top ten things that developers should master.
https://www.cnbc.com/2019/11/19/these-will-be-the-top-10-most-popular-tech-skills-of-2020.html

Top 10 Software Skills by 2020

  1. Python
  2. React (web)
  3. Angular
  4. Machine Learning
  5. Docker
  6. Django
  7. CompTIA - skills that certify cybersecurity, IT, etc
  8. Amazon AWS - or any popular cloud certification
  9. Deep Learning
  10. React Native (mobile)

Happy Coding!

Tuesday, August 13, 2019

Review: GitHub Actions


GitHub Actions?!

So, yeah, I feel old. After reading this article and not being in the loop on GitHub Actions, I can't believe I'm not on top of this area of DevOps.
https://github.blog/2019-08-08-github-actions-now-supports-ci-cd/

Matrix Builds

I mean - Matrix Builds, wow! This is phenomenal to test multiple builds of your software especially considering that not all customers will upgrade at the same time. In addition, some of these customers who actually want the latest offerings (or solutions) are in-house customers and/or early adopters.

Live Logs

Although "live logs" is nothing new, it seems that GitHub is saying they already have the display of live logs available to those who use GitHub Actions. That's actually pretty cool. I can push my code and instantly see a build run while showing any errors.

And More...

Basically, it's kind of like an IDE in the cloud but seems to also connect and deploy to a live server. I haven't looked into the pricing yet. Maybe one day I'll catch up and start using something like this instead of doing everything on my local?


Thanks GitHub!

Wednesday, April 10, 2019

Review: Facebook's Aroma ML for Code Recommendation

I actually don't need to say much here except you should also read this article.
https://ai.facebook.com/blog/aroma-ml-for-code-recommendation/

Fascinating and useful!

I definitely have my days where I find myself digging through too many StackOverflow (or other Developer Forum sites) to find great coding answers to my problems. Thank you, Facebook!

Thursday, February 21, 2019

Avoid inconsistent Date object definitions

I recently took a pop-quiz question on this, and failed. Errrrr...

Pop Quiz

What is the Date value of the following code?

new Date(2016, 5, 31);

My Answer:

May 31, 2016

Makes sense, right? At least to 70% of us developers who are not JS experts?

See more fun questions at https://app.enkipro.com.

Correct Answer:

June 1, 2016

Since JavaScript early days leveraged a lot techniques and patterns from Java, I looked up both definitions.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#Syntax
https://docs.oracle.com/javase/8/docs/api/java/util/Date.html#Date-int-int-int-
https://www.w3schools.com/js/js_dates.asp

My Further Thoughts

With all the new technologies and programming languages (along with updates to these languages), I'm actually shocked that we haven't provide better consistency with a common class instantiation like the Date object. Particularly, in JavaScrpt.

Since the Time parameters all start from 0, this makes sense and is consistent. However, for the Date parameters, since 'day' starts with 1 and makes the most sense, then why not start the month and the year with '1' as well? Nope, instead, the creators decided to make the month slightly difficult (and very difficult when we add in how fast developers need to work nowadays) by starting the value at '0'. But, no one in the world uses '0' to represent a month, and if it's an array index then define the parameter as such for ALL parameters in the Date definition. If you're not already confused, then try the year with a starting value of '1' and see this is actually 1901. Why, just because the creators somehow thought that programming would only be useful for years 1900-1999 (or shortcut values as 0-99). Thanks guys. Especially to Java guys who decided to just deprecate this and recommend using more code for date formatting (i.e. SimpleDateFormat).
*By the way, I wouldn't complain if these two programming languages weren't so currently popular and in demand.

My Solution

To avoid this unnecessarily confusing definition and prevent making mistakes within my apps, I would create a Date wrapper object that would allow for easier reading of my code. And consistency. That's [programming language] agnostic.

Tuesday, January 29, 2019

Review: Write Simple Code - Fast

I like how this author points out the difference between a senior developer and junior developer.

"But code is human language. It has to communicate the who, what, when, where, how, and why of a task, as well as instruct the computer. It has to make sense five years from now after the company has been acquired and a new team who has never seen this code before has to crack it open and make an enhancement or fix a bug.

Yes, writing dumb code is hard. ...I know that the best thing I can do for my team, and the future maintainers of the code, is to write dumb code."


KISS

Basically, a senior developer writes the most simplest code - think KISS. Even better, s/he creates the simplest designs and then directs her/his team to code simply according to the simple design.

But, we do live in a real world and almost every developer is trying to gain points over another.

Good luck.



Sunday, December 30, 2018

Review: Traditional Developer vs Cloud Developer

Another interesting article.
https://blog.bluesoftglobal.com/cloud-developer/

I need to do more research on the argument made in this article about the need to become a Cloud Developer. There will just be too much technology to learn if we keep thinking that a techie needs to learn stack development, deployment, tech support, translation of business domain knowledge into technical feasibility, and more.

Teams will continue to grow and not with an all-in-one talented techie. Developers will continue to need to specialize, in my opinion. But, if the cloud handles all the deployment and support issues, then maybe a developer can just focus on - developing?

Friday, December 28, 2018

Review: 10 Critical Tips to Learn Programming Faster

Today's article, I'm focusing on something practical and essential for all people working with technology: 10 Critical Tips to Learn Programming Faster

I like what the author does here and her explanation is straight to the point. But, if you want to know some of the practical challenges accompanying each tip, then here's what I'll add (based on my experience).

1. Start With the Basics and Spend More Time There


  • This is fundamental to learning any skill. So, don't learn just because you feel like it or it sounds cool, but learn with purpose; learn with the intent to master the skill.
  • This takes time, lots of time! So, start early as possible.
  • These basics can become boring if you're learning by yourself (like playing any sport by yourself). So, learn with friends and enjoy the course(s).

2. Coding by Hand is Highly Recommended


  • This is a great tip for interviewing, but is practically useless. With so many programming languages to choose from and so many companies using multiple languages to suit their product development, practicing in one language might not be helpful with understanding and using another language. However, practice coding in a way to understand the programming language. Pick a few languages like industry standards such as Java, JavaScript, and SQL. Pick languages that a full stack developer would require.
  • Know how to write pseudocode. With the computing industry changing quicker than ever before, it's important to switch between programming languages and still carry the function definitions and application structure over. 
  • In addition, other people should be able to read and easily understand your code.

3. Fiddle Around With the Codes


  • Don't just fiddle, but start exercising your creativity and figure out how to update the code. This is also called "refactoring". Learning to made code updates is a lifelong skill since most programmers must work on teams which means eventually you'll need to update someone's code - including your own.

4. Reach Out to Others for Guidance


  • Make mentors that are tech gurus. It's difficult to find tech gurus, but not if you get involved in open source project like in Apache Software Foundation.
  • Take advantage of online mentors (that you may never meet).
  • Take advantage of community forums online like Reddit and StackOverflow.

5. Take Breaks to Get Refreshed


  • This is not a critical programming tip, but a good tip for every hard worker out there.
  • This is much easier said if you don't have any social responsibilities.
  • I guess the gist here is to do what you need to do to work smarter and healthier.

6. Use Online Resources


  • I thought I would see some reference here to StackOverflow or useful sites where programmers learn to "debug" and "troubleshoot", but I didn't. Thus, make sure you bookmark sites that help you not only learn to code, but learn to decode/encode (so to speak). :)
  • There are hundreds of online tutorials. So, go through some sites, pick your top few, and be sure to add YouTube to that list. There are great channels on YouTube offering free tutorials and resources. Also, tech giants offering tutorials use YouTube. Note: I haven't seen many tutorials on Vimeo (or any other online video library site).

7. Read Relevant Material


  • What's funny to me about this tip is that the statement with  the "majority of real-life situations...the client's team will possess complete knowledge of their business". From my experience, this is not really true. As a software developer, or aspiring software developer, you'll learn that the business experts eventually become outdated (due to lack of vision and improving current processes rather than focusing on disrupting processes for greater ROI) or they become dreamers (and provide unrealistic visions and predictions).
  • Before becoming an expert in a business domain, you'll need to ask yourself about the direction that you want to take your work. Do you want to start your own business one day or invent something? Or, do you want to become a tech guru within the company or industry you're in? After you choose the question to answer (and you can't choose both), then you will learn to understand how to code in ways that will take you to your career destination.

8. Learn From the Bugs


  • This is another tip which I find interesting to lack the advice on specifically leveraging online community forums. One particulary online forum that is picking up attention is GitHub. So much code is not being stored in GitHub that one can pick up lots of knowledge on how to create by leverage.
  • Again, leverage sites like StackOverflow for debugging.
  • Understand the limit of tools used for debugging as well.
  • Better yet, learn to write tests (e.g. unit tests, end-to-end tests) before you write your program and then you'll pick up a better habit than debugging.

9. Never Get Tired of Practicing


  • Practice with other like-minded coders.
  • Practice to innovate, not just to improve - because you'll never reach perfection.
  • Problems are neverending, and you'll need to discover how to become quicker at finding or creating solutions. This takes practice, too, and can be practiced outside of coding like with puzzles, understanding economic impact on local developments, studying psychology and quizzing behaviors, and learning different parts of society by volunteering and traveling.

10. Keep Your Cool


  • I actually thought this tip would address the politics in a workplace. Every developer not only needs to know how to "play with others", know how to code according to customer satisfaction, know businees needs and where the development team fits in, but also how to challenge bad ideas without offending people as well as add value to an organization's mission.
  • Never think your work life is about your life; it's about work. Never bring "work" to your life. Bring "life" to your work.


Good luck, newbie!

Thursday, December 13, 2018

Intro to a Coding Mindset

From the article:
"We want to propose that beginner coders could start with an attractive and engaging activity, but should also explicitly develop what could be called "the coding mindset."
This mindset represents a gradual development of  programming knowledge and strategies, but also includes analyzing systems, solving problems, persisting in front of errors, being resourceful and collaborating.
To teach the coding mindset, educators need to include more explicit foundational  concepts and competencies, such as creating algorithms to solve problems, debugging existing programs, and designing systems to accomplish new tasks or gather data.
Learning to code should not be intimidating. But it should fulfil promises, not simply hype mythic dreams."
https://phys.org/news/2018-12-code-movement.html

Monday, November 5, 2018

Jupyter Notebooks - what is it?

I stumbled upon this article and became very curious as to what a Jupyter notebook is.


Main website



Online Tutorials

Seems pretty cool for people interested in Data Science and crunching data especially using Python (or iPython). So, I decided to watch some YouTube videos to learn a little more.



Thursday, April 13, 2017

Electron - Quick Introduction (destop app in JS)

Hey Dev Fam,

I wanted to know what "Electron" was and went through these tutorials.

Red Stapler's quick tutorials on Electron

Introduction & WebApp -> DesktopApp Quick Conversion

https://www.youtube.com/watch?v=1Qf2Yjz-zsk

Hello World

https://www.youtube.com/watch?v=sJFuMKPfpfs

Packaging Application

https://www.youtube.com/watch?v=rP7j_hDL40Y

Another Overview on Electron

https://www.youtube.com/watch?v=mr9Mtm_TRpw

GitHub's Electron Overview 2016

https://www.youtube.com/watch?v=FNHBfN8c32U

GitHub's selling point on using Electron is:

If you can build a website, you can build a desktop app. Electron is a framework for creating native Desktop applications with web technologies like JavaScript, HTML, and CSS.


Happy Coding,
G2

Monday, March 13, 2017

Keeping up with Programming Languages

It's always tough to keep up with all the programming languages and to know which one is the best for the year. I use to think certain languages would die, but many still are surviving like Java. I like this article though and agree. Best bet is to securely know the fundamentals of programming and then learn a few well while staying aware of the basics for other programming languages. Thank goodness for the quick tutorials on YouTube (in addition to Google+StackOverflow)!

https://ntguardian.wordpress.com/2017/03/13/on-programming-languages-why-my-dad-went-from-programming-to-driving-a-bus/

Wednesday, September 7, 2016

D3 - Coding with Readability and Usefulness, no more d variable

One of the things I find so irritating is the overuse of letters which lack sufficient readability (to understand code without having to dig into the back-end to gain meaning).

I'm learning and working on D3 stuff and I see many examples using the letter d. This d stands for data, obviously. BUT, almost everything in the world is a d (i.e. data). Needless to say, I had to update code to ensure better understanding and programming. Here's my example of better coding using D3.

Before

groups.selectAll('text')
    .data(function (d) {
        console.log(d);
        return d;
    })
    .enter()
    .append('text')
    .text( function (d, i) {
        console.log(i);
        if (typeof d === 'number')
        {
            console.log("data type is a number, not object...skipping.");
            return;
        }
        console.log(d);
        return d.x;
    });

After

groups.selectAll('text')
    .data(function (arr) {
        console.log(arr);
        return arr;
    })
    .enter()
    .append('text')
    .text( function (obj, i) {
        console.log(i);
        if (typeof obj === 'number')
        {
            console.log("data type is a number, not object...skipping.");
            return;
        }
        console.log(obj);
        return obj.x;
    });

In the After, I updated the d within the data method into "arr" as its a data array representing the dataset passed in. I updated the d within the text method into "obj" as its a data object of the data array passed in.

I hope this helps somebody.

Blessings,

Wednesday, July 13, 2016

PHP Array indexes are CaSe-SeNsiTIvE

Devs,

Quick note, PHP array indexes are CaSe-SeNsiTIvE.

I ran into an issue with sending a $_POST to the database to insert a record. I was validating the data in the post array and setting required values if a key was not set properly. However, this gave me a database insert error stating I'm using duplicate field (column) names.

Well, ain't that tricky!

Did a quick search to confirm my assumption about PHP array indexes being case-sensitive.
http://stackoverflow.com/questions/1511230/php-array-are-array-indexes-case-sensitive

Yep, added the check for all cases and database insert worked! Yay!!

I wonder what other languages treat array indexes as case-sensitive? Maybe all programming languages? This would only make sense, no? The value of an index is calculated differently based on char value, right?

To be continued...

Happy Coding,
G2