I’m a lazy developer but be efficient

Thought Programmer

I automate everything to have time for inventing more

Stories in this post are stuff that I encountered in my daily work and remembered.

Photo by Kate Stone Matheson on Unsplash

Hello folks, I’m now more than 30 years old. I have written computer app programs since 16 years old and I love it.

I choose a lazy person to do a hard job. Because a lazy person will find an easy way to do it

I am only a very lazy developer who wants to make everything much easier for everybody else.

I always find the best, most efficient ways of doing things simply because I am too lazy to do things the laborious way.

Short alias for longer commands

Like most people, I’m really tired of typing a long command on my command line or searching bash history for a previously typed command.

% ps auxf | sort -nr -k 4 | head -10

So, I use bash aliases to save me from having to remember the long commands:

% alias psmem10 = 'ps auxf | sort -nr -k 4 | head -10' 

Here’re some examples of aliases in my machine that I saved.

  • If you want to display a list of all your defined aliases, let give an alias built-in command without any arguments.
% alias
  • We must use the following syntax to create the alias.
% alias name=value
% alias name='command'
% alias name='command arg1 arg2'
% alias name='/path/to/script'
% alias name='/path/to/script.pl arg1'
  • If I want to clear the screen, I use the below alias.
% alias c='clear'
% c
  • The following alias allows you to type r to repeat the previous command or r abc to repeat the last command line that began with abc:
% alias r='fc -s'
% r
  • To save your time.
% alias h='history'
% h
  • Show open ports
% alias ports='netstat -tulanp'
% ports
  • Sort by file size
% alias lt='ls --human-readable --size -1 -S --classify'
% lt
  • Sort by modification time
% alias left='ls -t -1'
% left
  • If you need to know how many files are in a directory.
% alias count='find . -type f | wc -l'
% count

In some cases, you’ll need to use the real command rather than an alias that already exists.

% \aliasname

It’s very good to share knowledge, you should share your aliases with everyone by leaving comments.

Scripts for automatic tasks

I will automate anything that can be automated.

I automate everything to have time for inventing more

Since everything becomes automated, I have time for myself to come up with many ideas and bring them to life.

Types of automation

In my mindset, there are three types of automation as follows.

  • Data driven automation. It involes automating actions based on data indicators.
  • Task driven automation. It involves automating tasks you would otherwise have to do manually.
  • End to end automation. When you need to touch several of these components in order to achieve a goal, you can use end-to-end automation. It’s a combination of data-driven and task-based automation.

Where to apply automation

I have applied automation to many different in different ways in my daily life.

For example, you can write a script that can collect network statistics and create dashboards and reports, notify me when meeting the threshold.

For example, you can write a script to open a website and do some tasks like crawl the content of this site.

In early 2010, I and my good colleagues developed a very big system for customer care.

We have limited resources, so to have much time for developing apps, we write many scripts to automate manual tasks such as zip logs, delete files, and so on.

Using reuse engineering

In fact, we always use the same solution for similar problems. As a programmer, how often do you see yourself writing the same skeleton of a code again and again?

Quite often right? So, I apply reuse engineering to get the following benefits.

  • Shorten software development time. I saved my time when an application that is working on requires a piece of code that already exists.
  • Greater time and cost-efficiency. In a good practice environment, existing code comes with existing documents, existing quality assurance, and compatible test results.

Achieving a high level of reuse is arguably the hardest goal to accomplish in developing a software system. You can save a lot of time and effort if you can reuse large components from the other products or opensource software but you need to know what components should be reused and how to implement them.

Here’re some of the following ways.

  • The reuse of patterns.
  • Create generic programs or configurable frameworks that support similar solutions for a variety of use cases and environments.
  • Use a model-driven approach with model patterns.

Rear more here: https://levelup.gitconnected.com/software-engineering-best-practices-for-reusing-in-software-development-6006f9d8d364

I’m a lazy man in programming…

In programming, I also apply lazy coding techniques what are also part of the programmer’s everyday habits.

Lazy Instantiation

It means not spending any time and resources creating something until you actually need it

One of the use cases for lazy instantiation is in the Singleton pattern. Lazy instantiation makes sure that the object gets created when it’s actually needed.

class Singleton:
__instance = None
def __init__(self):
if not Singleton.__instance:
print(" __init__ method called..")
else:
print("Instance already created:", self.getInstance())
@classmethod
def getInstance(cls):
if not cls.__instance:
cls.__instance = Singleton()
return cls.__instance
## class initialized, but object not created
s = Singleton()
# Object gets created here
print("Object created", Singleton.getInstance())
## instance already created
s1 = Singleton()

Lazy Initialization

It is the technique of caching unchanged data

Lazy Evaluation

It is an evaluation strategy which delays the evaluation of an expression until its value is needed.

But becoming a lazy man is not always good but it sure is interesting

In 15 years of experience, I found that lazy behaviors can be bad in some cases.

  • You can skip the most important to save time. Keep in mind that “do as little work as possible to get the task completed, but no less”.
  • Code can have smells and bad code smells are often ignored by programmers too lazy to clean up the mess.
  • Lazy programmers will not only ignore clear technical debt but they will even ignore the reporting of technical debt.
  • As generally intelligent people, most programmers are fiercely independent and like to “go their own way.” So, they are failing to create and enforce standards

Yes, a lazy man is not always good but it sure is interesting.

Lazy people are likely to be smarter, more successful, and better employees. Agree?

Thanks for reading and don’t forget my bits of advice. And here’re top my 10 best articles.

  1. How to design a system to scale to your first 100 million users
  2. Things I’ve Learned to Avoid in My 15 Years as a Software Engineer
  3. Stop using the ‘else’ keyword in your code
  4. How did I classify 50 chart types by purpose?
  5. Don’t be a STUPID programmer
  6. Software Architecture: The Most Important Architectural Patterns You Need to Know
  7. Rethinking SOLID principles in JavaScript
  8. These Bottlenecks Are Killing Your Code
  9. Top 20+ Github Repos Every Developer Must Know


I’m a lazy developer but be efficient😘 was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.

Thought Programmer

I automate everything to have time for inventing more

Stories in this post are stuff that I encountered in my daily work and remembered.

Photo by Kate Stone Matheson on Unsplash

Hello folks, I’m now more than 30 years old. I have written computer app programs since 16 years old and I love it.

I choose a lazy person to do a hard job. Because a lazy person will find an easy way to do it

I am only a very lazy developer who wants to make everything much easier for everybody else.

I always find the best, most efficient ways of doing things simply because I am too lazy to do things the laborious way.

Short alias for longer commands

Like most people, I’m really tired of typing a long command on my command line or searching bash history for a previously typed command.

% ps auxf | sort -nr -k 4 | head -10

So, I use bash aliases to save me from having to remember the long commands:

% alias psmem10 = 'ps auxf | sort -nr -k 4 | head -10' 

Here’re some examples of aliases in my machine that I saved.

  • If you want to display a list of all your defined aliases, let give an alias built-in command without any arguments.
% alias
  • We must use the following syntax to create the alias.
% alias name=value
% alias name='command'
% alias name='command arg1 arg2'
% alias name='/path/to/script'
% alias name='/path/to/script.pl arg1'
  • If I want to clear the screen, I use the below alias.
% alias c='clear'
% c
  • The following alias allows you to type r to repeat the previous command or r abc to repeat the last command line that began with abc:
% alias r='fc -s'
% r
  • To save your time.
% alias h='history'
% h
  • Show open ports
% alias ports='netstat -tulanp'
% ports
  • Sort by file size
% alias lt='ls --human-readable --size -1 -S --classify'
% lt
  • Sort by modification time
% alias left='ls -t -1'
% left
  • If you need to know how many files are in a directory.
% alias count='find . -type f | wc -l'
% count

In some cases, you’ll need to use the real command rather than an alias that already exists.

% \aliasname

It’s very good to share knowledge, you should share your aliases with everyone by leaving comments.

Scripts for automatic tasks

I will automate anything that can be automated.

I automate everything to have time for inventing more

Since everything becomes automated, I have time for myself to come up with many ideas and bring them to life.

Types of automation

In my mindset, there are three types of automation as follows.

  • Data driven automation. It involes automating actions based on data indicators.
  • Task driven automation. It involves automating tasks you would otherwise have to do manually.
  • End to end automation. When you need to touch several of these components in order to achieve a goal, you can use end-to-end automation. It’s a combination of data-driven and task-based automation.

Where to apply automation

I have applied automation to many different in different ways in my daily life.

For example, you can write a script that can collect network statistics and create dashboards and reports, notify me when meeting the threshold.

For example, you can write a script to open a website and do some tasks like crawl the content of this site.

In early 2010, I and my good colleagues developed a very big system for customer care.

We have limited resources, so to have much time for developing apps, we write many scripts to automate manual tasks such as zip logs, delete files, and so on.

Using reuse engineering

In fact, we always use the same solution for similar problems. As a programmer, how often do you see yourself writing the same skeleton of a code again and again?

Quite often right? So, I apply reuse engineering to get the following benefits.

  • Shorten software development time. I saved my time when an application that is working on requires a piece of code that already exists.
  • Greater time and cost-efficiency. In a good practice environment, existing code comes with existing documents, existing quality assurance, and compatible test results.

Achieving a high level of reuse is arguably the hardest goal to accomplish in developing a software system. You can save a lot of time and effort if you can reuse large components from the other products or opensource software but you need to know what components should be reused and how to implement them.

Here’re some of the following ways.

  • The reuse of patterns.
  • Create generic programs or configurable frameworks that support similar solutions for a variety of use cases and environments.
  • Use a model-driven approach with model patterns.

Rear more here: https://levelup.gitconnected.com/software-engineering-best-practices-for-reusing-in-software-development-6006f9d8d364

I’m a lazy man in programming…

In programming, I also apply lazy coding techniques what are also part of the programmer’s everyday habits.

Lazy Instantiation

It means not spending any time and resources creating something until you actually need it

One of the use cases for lazy instantiation is in the Singleton pattern. Lazy instantiation makes sure that the object gets created when it’s actually needed.

class Singleton:
__instance = None
def __init__(self):
if not Singleton.__instance:
print(" __init__ method called..")
else:
print("Instance already created:", self.getInstance())
@classmethod
def getInstance(cls):
if not cls.__instance:
cls.__instance = Singleton()
return cls.__instance
## class initialized, but object not created
s = Singleton()
# Object gets created here
print("Object created", Singleton.getInstance())
## instance already created
s1 = Singleton()

Lazy Initialization

It is the technique of caching unchanged data

Lazy Evaluation

It is an evaluation strategy which delays the evaluation of an expression until its value is needed.

But becoming a lazy man is not always good but it sure is interesting

In 15 years of experience, I found that lazy behaviors can be bad in some cases.

  • You can skip the most important to save time. Keep in mind that “do as little work as possible to get the task completed, but no less”.
  • Code can have smells and bad code smells are often ignored by programmers too lazy to clean up the mess.
  • Lazy programmers will not only ignore clear technical debt but they will even ignore the reporting of technical debt.
  • As generally intelligent people, most programmers are fiercely independent and like to “go their own way.” So, they are failing to create and enforce standards

Yes, a lazy man is not always good but it sure is interesting.

Lazy people are likely to be smarter, more successful, and better employees. Agree?

Thanks for reading and don’t forget my bits of advice. And here’re top my 10 best articles.

  1. How to design a system to scale to your first 100 million users
  2. Things I’ve Learned to Avoid in My 15 Years as a Software Engineer
  3. Stop using the ‘else’ keyword in your code
  4. How did I classify 50 chart types by purpose?
  5. Don’t be a STUPID programmer
  6. Software Architecture: The Most Important Architectural Patterns You Need to Know
  7. Rethinking SOLID principles in JavaScript
  8. These Bottlenecks Are Killing Your Code
  9. Top 20+ Github Repos Every Developer Must Know


I’m a lazy developer but be efficient😘 was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.


Print Share Comment Cite Upload Translate
APA
Anh T. Dang | Sciencx (2024-03-29T00:17:03+00:00) » I’m a lazy developer but be efficient. Retrieved from https://www.scien.cx/2021/12/14/im-a-lazy-developer-but-be-efficient/.
MLA
" » I’m a lazy developer but be efficient." Anh T. Dang | Sciencx - Tuesday December 14, 2021, https://www.scien.cx/2021/12/14/im-a-lazy-developer-but-be-efficient/
HARVARD
Anh T. Dang | Sciencx Tuesday December 14, 2021 » I’m a lazy developer but be efficient., viewed 2024-03-29T00:17:03+00:00,<https://www.scien.cx/2021/12/14/im-a-lazy-developer-but-be-efficient/>
VANCOUVER
Anh T. Dang | Sciencx - » I’m a lazy developer but be efficient. [Internet]. [Accessed 2024-03-29T00:17:03+00:00]. Available from: https://www.scien.cx/2021/12/14/im-a-lazy-developer-but-be-efficient/
CHICAGO
" » I’m a lazy developer but be efficient." Anh T. Dang | Sciencx - Accessed 2024-03-29T00:17:03+00:00. https://www.scien.cx/2021/12/14/im-a-lazy-developer-but-be-efficient/
IEEE
" » I’m a lazy developer but be efficient." Anh T. Dang | Sciencx [Online]. Available: https://www.scien.cx/2021/12/14/im-a-lazy-developer-but-be-efficient/. [Accessed: 2024-03-29T00:17:03+00:00]
rf:citation
» I’m a lazy developer but be efficient | Anh T. Dang | Sciencx | https://www.scien.cx/2021/12/14/im-a-lazy-developer-but-be-efficient/ | 2024-03-29T00:17:03+00:00
https://github.com/addpipe/simple-recorderjs-demo