Thursday, December 12, 2013

Jeremy's Programming Blog - Hazardous Attitudes in Software Development

JeremyMorgan.com Newsletter

 
Sent to Insider Member blogs.sherrylinx.8442@blogger.com



Jeremy's Programming Blog - Hazardous Attitudes in Software Development

With software projects it’s rare that a failure can be pointed a single cause, or a certain person. Usually it’s a culmination of many smaller mistakes. With technology and formal project management, best practices are usually well documented and available, but one thing that isn’t talked about as much is attitude. The attitude of persons in your group or your group as a whole is one of the biggest factors of your success.

As a volunteer firefighter my training often intersects with my career in development. It happens more than you might think, and today while taking a class (L-180 Wildland Fire Leadership Development) I learned about a set of “hazardous attitudes” that can often get teams in trouble. Reading through it I could see the parallel with software development very clearly. These attitudes on the fireground can get yourself or others killed, so they’re especially important for everyone to keep in mind, but why not apply them seriously to software development?

Hazardous Attitudes

Here is the list of some hazardous attitudes from the class, and this is what we’ll be applying to software projects.

  • Invulnerability
  • Anti-Authority
  • Impulsiveness
  • Macho (competitive)
  • Resignation
  • Complacency (casualness)
  • Escalation of commitment (target, fixation, mission-itis)
  • Other ( sexist, racist, agency bias )

If you’ve ever worked on a group project of any type, you’ve seen these. These types of attitudes also tank software projects just as bad.


Invulnerability

“This would never happen to us”. Very common especially with teams who have had some level of previous success. They know of the pitfalls, know the risks and still take chances thinking the worst won’t happen to them. While this might work for a while or even a long time, the backfire can be devastating. Because you took a risk you know you shouldn’t have it looks very bad when it fails. You are guaranteed to hear the phrase “You should have known better”.


Anti-Authority

“Those guys are a bunch of idiots!” These words are often uttered about executives, directors, VPs and other forms of upper management. While it may be true that you know more details about your job, there’s a really good chance you don’t know what they know about the business, and the reasons behind their leadership decisions. While it’s healthy to question policy and ask questions of your leadership, willful denial of their rules or requests can be detrimental to your project, and your employment status. When this attitude gets carried away bad things tend to happen.


Impulsiveness

“Let’s just do it! Shoot from the hip!” This attitude is sometimes disguised well as a “can do” attitude. Often times impulsive managers and staff are referred to as “go getters” who really get work done. While that may often be the case, truly impulsive decisions that aren’t well thought out lead you down paths that are very difficult to get out of. Remember it’s not just the immediate decision that can backfire, it’s often the subsequent actions and decisions that really get you into trouble with this attitude.


Macho (Competitive)

“We’ll really show them how it’s done”. This attitude gets you in trouble mostly because you are using a bias, and it’s another dangerous road to go down. You may get overconfident and step on a lot of toes thinking you’re going to hit a home run, and then everyone will forget earlier transgressions cheer your victory. This rarely happens in practice. What usually happens is you alienate people who could be collaborating with and destroying your reputation when you fail.


Resignation

“This is never going to work anyway, so why try?”. While the downsides to this attitude is pretty obvious, what most people don’t consider is how well this can take hold and spin out of your control. A single team member who possesses this attitude can eventually infect the whole group. If not corrected, this attitude becomes a self fulfilling prophecy very quickly.


Complacency

“I’ve done this a million times”. Many folks possess this attitude after getting good at something. When working at a lumber mill I was told the people who get injured the most are the ones with the most repetitive jobs that they’ve been doing forever. They simply quit caring and become complacent to the point they aren’t paying attention to what they’re doing. In the business world this can lead to serious bugs and security problems being introduced. Complacent team members are among the most well known.


Escalation of Commitment

“Well, we’ve come this far so we as well keep going!”. This attitude may have the best of intentions, but we usually end up in projects that are over budget and way beyond the deadline. Remember Brooks’ law? Adding more programmers to a late project usually makes it later. And usually the action taken with a failing project is to start throwing money, time and programmers at it until it finishes and nobody is happy with the final product.

Sometimes you just have to know when it’s time to go back to the drawing board.


Other (sexist, racist, agency bias)

Remove “agency” and replace it with “group” and you have a problem that’s extremely common in today’s business environment. “Those marketing idiots! Those salespeople!”. This kind of bias doesn’t help anyone involved. You should be sharing a common goal not fighting against each other.

Racism and sexism? Remember you’re a professional, and it’s 2013. These views are antiquated and ignorant. These views towards your coworkers only creates a bias that harms everyone around you, and your decisions should never be based on them. Not only should you not harbor this bias but you should not allow others to do it. There’s a reason people can be fired immediately for racist or sexist comments, it’s a poison that destroys groups, companies, and morale. It inflicts personal damage to others. Be better than that.


Summary

Reading through these hazardous attitudes it’s very likely you’ve already seen it in action. If you have any of these attitudes you’re contributing to the destruction of your project and group. If you see these attitudes in others and take no steps to correct it you’re also doing harm. Their is no single recipe for guaranteed software project success, but attitude is a key element. If you have the problems, fix them. If you see it, say something. Lead by example and remember success favors the prepared.

     



 

 

Thank you for subscribing to my updates! 

Follow Jeremy on Facebook | Twitter | Linkedin

 




Your requested content delivery powered by FeedBlitz, LLC, 9 Thoreau Way, Sudbury, MA 01776, USA. +1.978.776.9498

 

Thursday, November 14, 2013

Jeremy's Programming Blog - The Road To Technical Debt is Paved With Good Intentions

JeremyMorgan.com Newsletter

 
Sent to Insider Member blogs.sherrylinx.8442@blogger.com



Jeremy's Programming Blog - The Road To Technical Debt is Paved With Good Intentions

What is Technical Debt?

Technical debt is a metaphor for the result of taking shortcuts in your development that you’ll have to fix later, creating “debt” that has to be paid off. In keeping with that metaphor you often have “interest” that must be paid on that debt whenever extra time is added to work around the bad implementation in the first place. It usually starts with the phrase “we’ll fix that later” and often goes unresolved.

Technical debt usually takes some time to manifest, but once it does you’ll find yourself spending an exponentially larger amount of time creating workarounds.

Here’s an example:

In this diagram we can see a couple of applications. As you can see we have a common database class that has abstracted methods to connect to the database. This is good practice, as these functions are often repeated across applications.

How Technical Debt Happens

Technical debt is a long and slow process that rarely happens overnight. But a few bad decisions up front can lead to larger problems later.

The beginnings

As application 1 is being developed, the programmer takes the wise choice of creating an abstract database connector he or she can reuse later. The class is developed to accept parameters defining each connection. Then the programmer moves on and creates the rest of application 1.

During testing it’s found that the database returns some strange results under certain circumstances. The programmer evaluates the problem and determines they can do one of two things:

  • Fix the problem by altering the database schema and reworking the code to properly handle this case. This may take a few days.

  • Hack up a quick fix that works around the issue and only takes an hour.

About this time the project manager says the CEO is waiting for this application and it needs to be finished promptly. The developer remembers that there are still 5 more features that need to be added and the design needs to be finished. “I’ll do the workaround then fix it later”. We’ve all been there, including me. The programmer has saved 3 days of valuable development time, but the application gets completed and we move on.

Piling it up

So now a few months later we start to develop application 2. Remembering we have our database class already completed, we simply extend and develop application 2. We layout a model, and build our framework and start testing our application. Suddenly we notice that there is some strange output again from that same database query method. What should we do?

  • Fix the problem by altering two database schemas and reworking the code on both projects to properly handle this case. We must coordinate our change so that there are no unexpected side effects from this refactoring. This may take a week.

  • Hack up a quick fix that works around the issue and only takes an hour.

Again the programmer feels the pressure from a looming deadline. We don’t want to explain to the boss why there is a delay, and that it’s our fault. So it gets hacked and duct taped again.

Now we’re underwater

A year later, we have 6 applications that are all sharing different abstracted parts of code. We have attempted to refactor the database class a couple times and it ended up breaking parts of the other applications. So we put workarounds on top of our workarounds. We make small changes for one application and the others go down. The CEO sees it and is rightly furious. How can we fix it? Wipe it out and start over?

At this point you’re looking at weeks or possibly months of work. During this time no new projects will be completed. It’s dead time that’s impossible to justify to your management. Yet project number 7 is an application that ostensibly should take 2 weeks, and instead it’s taken 6. The project manager is furious, the developers are unhappy and the software is a mess. So who is at fault? Everyone involved. Poor planning, unrealistic expectations and shortcuts is what got us to this point.

So how do we avoid this?

If you ask ten programmers how to avoid and fix this you’ll probably get ten different answers. There have been debates for decades about it, but one thing most can agree on is the fact that shortcuts are bad. Here are a few ways to avoid this problem.

  1. Create a programmer utopia - All programmers are given as much time as they need to develop perfect code that applies all the best practices and teachings of the last 50 years of academic research on software development. It might take months for a simple CRUD app, but rest assured it will be the most beautiful and perfect CRUD app you’ve ever laid eyes on.

  2. Silo development for everything - Create software on an ad-hoc basis and reuse nothing. Abstract nothing, and build every application as a self standing independent application. Each application is developed by a single person for a single purpose. Don’t ever try to change platforms, databases or languages used and avoid any broad changes.

  3. Do it right the first time - Plan your software as much as you can. Establish requirements and stick to them. Build with future scaling and reuse in mind. Decouple as much as possible, reuse what you can and test accordingly. If you have a problem, refactor and fix it as soon as possible, and don’t stop working on it until it is right. Test everything and retest it every single time a change is made.

So which one do you think you should choose? I have over simplified it here for the sake of brevity but these are all good ways to avoid the technical debt sinkhole that so many companies end up in.

Here are some hard fast rules:

  • Establish realistic expectations
  • Gather requirements and get them in writing.
  • Set priorities and stick to them.
  • Plan for the worst, it might happen.
  • Plan for change, it will happen.
  • Don’t rely on workarounds
  • Test. Use structured, measurable testing techniques
  • Don’t wait to refactor
  • Don’t patch it to push it out the door
  • Don’t overlook fixes because features were added

Who is at fault for technical debt again?

Technical debt is usually the fault of nearly everyone involved in a project. It starts with unrealistic expectations from management, increased pressure from project managers, and programmers who are either under the gun, lazy, inexperienced, or some combination of those factors.

But these things all stem from the good intentions of everyone involved. The CEO wants to ensure the survival and growth of the company. Management wants to make sure goals are met at a reasonable expense for the company. Project managers want to produce lots of work to show management they’re making it happen. Programmers want to create cool stuff. Everyone wants to produce things (if they don’t they shouldn’t be working there) but experience teaches us how to collaborate to make it work.

Summary

Technical debt is a killer. It wastes your company resources, angers your boss, confuses your project managers. It causes programmers to become frustrated and lose pride in their work. It causes projects to take longer and longer to develop.

The power is in your hands as a programmer to push back and try to avoid this pitfall. A simple investment of time up front can prevent massive problems later on. If you inherit technical debt (at some point in your career you will) you absolutely need to make the case to freeze development and fix problems, even if it’s just one small problem at a time. In fact, that may be the only way you’ll ever get it done. One method at a time.

I’ll expand on this more soon and expand on some of these points. Be sure to subscribe to my feed to get more articles like this.


Do you like articles like this?

I’m constantly hacking on stuff and writing about happenings in the programmer world. You can subscribe to my feed here, or you can get the programmer newsletter spam free!
     


More Recent Articles

 

 

Thank you for subscribing to my updates! 

Follow Jeremy on Facebook | Twitter | Linkedin

 




Your requested content delivery powered by FeedBlitz, LLC, 9 Thoreau Way, Sudbury, MA 01776, USA. +1.978.776.9498

 

Thursday, October 24, 2013

Jeremy's Programming Blog - How to install Magento on Windows Azure

JeremyMorgan.com Newsletter

 
Sent to Insider Member blogs.sherrylinx.8442@blogger.com



Jeremy's Programming Blog - How to install Magento on Windows Azure

Today I’m going to show you how to set up Magento with Ubuntu 13.04 on Windows Azure. Scalability and performance are always a concern with Magento, and one way you can rectify that is to throw some more server power at it. Windows Azure is great for this purpose.

Why Azure?

While traditionally used for Microsoft Development, Linux Virtual Machines are available on Azure. One of the biggest complaints about Magento is speed and Azure handles it quite nicely. When Magento sites start getting a lot of products and / or traffic they tend to slow, with Azure you can easily scale up and load balance across many machines to solve that problem.

You can also split up application and the database servers and scale more VMs for each until you get the performance you’re looking for. It’s always good to have room to grow in an easy and affordable fashion.

Getting Started

First, you’ll need to create a virtual machine on Windows Azure. This is pretty easy.

From the Windows Azure Portal,

  • Select “Virtual Machines” from the button on the left hand side.
  • Click “Create a virtual Machine”
  • Select Compute -> Virtual Machine -> Quick Create
  • Select “Ubuntu Server 13.04”
  • Create a name for your service, and enter a password

After your machine is created, select the arrow next to the name to access the Quick Start page.

  • Select “Endpoints”
  • Select “Add standalone endpoint”
  • Select “Name: http”
  • Save changes (check mark)

This will create a http endpoint so you can access the web. It should now show the http endpoint in addition to the ssh endpoint, which we’ll use in a minute.

Connect to your Virtual Machine

Now we’ll want to connect to your virtual machine through ssh. If you’re using Linux or a Mac, it’s already installed, if you’re using Windows I recommend Putty for this purpose.

1  
ssh azureuser@[ your cloudapp url ]  

Let’s get started!

Step 1: Add MariaDB Repositories

We need to enter a few commands here to add the MariaDB repository. MariaDB is the database we’re going to use for Magento, it’s a drop in place swap for MySQL that’s better and more secure, so that’s what we’ll use. Magento will never know the difference.

1  2  3  4  
sudo apt-get install software-properties-common  sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db  sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu raring main'  sudo apt-get update  

Step 2: Install the Web Server

We’re going to install Apache with PHP 5 to support Magento on this machine, as well as MySQL connectors, and the maria Database server with the following commands:

1  2  3  4  5  
sudo apt-get install apache2  sudo apt-get install php5 libapache2-mod-php5  sudo apt-get install php5-mysql  sudo apt-get install mariadb-server  sudo apt-get install php5-mysql php5-curl php5-mcrypt php5-gd php5-common php-apc  

During the install you will see the following screen asking for a root password.

Set this password and keep a note of it, we’ll be using it very shortly.

Step 3: Install Magento

For this you’ll need to download the Magento tarball here and put it on your server, or you can use the wget command below. I’m currently hosting the 1.8.0.0 version.

1  2  3  4  
cd /var/www  sudo wget http://www.jeremymorgan.com/hosted/magento-1.8.0.0.tar.gz   sudo tar -zxvf magento-1.8.0.0.tar.gz   sudo mv magento/* magento/.htaccess .  

Now we’ll need to set the permissions so Magento can write the files it needs to:

1  2  
sudo chmod -R o+w media var  sudo chmod o+w app/etc  

You’re set! now let’s create the database.

Step 4: Create the Database

Now we want to create a MariaDB database for this. First, since we just installed this database we want to run a quick script that will make it more secure. Run the following script and answer yes to all the questions:

1  
sudo mysql_secure_installation  

Now we need to create our tables and a user for Magento.

1  
mysql -u root -p  

Once logged in, you’ll want to create the database, and a user:

1  2  
CREATE DATABASE magento;  CREATE USER magentouser IDENTIFIED BY '(enter a password here)'  

Now we want to assign that user to the database and give it the proper permissions:

1  
GRANT SELECT, INSERT, CREATE, ALTER, UPDATE, DELETE, LOCK TABLES on magento.* to magentouser;  

now type in “quit” to exit MariaDb.

Step 5: Final Server Configuration

We want to enable search engine friendly URLs in our install, so run the following command to install mod_rewrite for Apache:

1  
sudo a2enmod rewrite  

Now, we need to open up this file to enable it:

1  
sudo nano /etc/apache2/sites-available/default  

Change “AllowOverride None” to “AllowOverride All” so it looks like this:

Save the file and quit.

Now restart the server:

1  
sudo service apache2 restart  

Load it up in a web browser and let’s get this configured!

Step 6: Set up Magento

Now we have Magento all set up and ready to go. Load up the url (whatever name you chose) in web browser and start the installation.

Click I agree on the first screen, and continue on the next.

On the next screen, enter your database name, user name and user password in the Database Connection box. You created these earlier on the MariaDB setup.

in the web access options, make sure “Use Web Server (Apache) Rewrites” is checked

Click Continue.

You will now set up your admin information:

Click Continue and you’re done!

You can now log into to your admin panel (yourname.cloudapp.net/admin) and get started!

Summary

I hope this helps to get your Magento site up and running on Windows Azure. With the load balancing and scaling capabilities this could be an awesome solution for your e-commerce site. Traditionally expansion has been tough and expensive for small and medium businesses who run software like this, but Windows Azure and other cloud based solutions are making it easier and cheaper to expand.

If you’re looking for a durable and scalable solution for your e-commerce needs I would recommend trying this approach.


Do you want to be notified every time a new tutorial is posted?

If you want to see more tutorials like these subscribe to our spam free newsletter and get them instantly in your inbox or feed reader. If you want to get all my updates, subscribe to the main RSS feed here.
     


More Recent Articles

 

 

Thank you for subscribing to my updates! 

Follow Jeremy on Facebook | Twitter | Linkedin

 




Your requested content delivery powered by FeedBlitz, LLC, 9 Thoreau Way, Sudbury, MA 01776, USA. +1.978.776.9498

 

Thursday, September 19, 2013

Jeremy's Programming Blog - Top Free Image Optimization Tools

JeremyMorgan.com Newsletter

 
Sent to Insider Member blogs.sherrylinx.8442@blogger.com



Jeremy's Programming Blog - Top Free Image Optimization Tools

Making your images load faster is extremely important for page load performance on your site. It makes your pages load faster, which makes for happier visitors, and better search engine performance for your site. Page load time is also a key factor in your bounce rate. Here are some tools I use commonly to reduce image size on my sites.

Mac OSX

Macs and image editing go hand in hand. A couple of the tools I really like are listed here.

Shrink O matic

What I like about this software is it’s very fast and easy to use. You can do things like a straight optimize, rotating and size adjustment. It also supports mass renaming.

The Awesome: Free. Great tool that works fast and consistently. Simple.

Not so Awesome: You have to be careful with quality settings, it can get bad very quickly and you may overwrite your originals.

Download Shrink O Matic Here


ImageOptim

This one is super easy to use, and great for shaving down size.

The Awesome: Free, dead simple and really fast. Does what it’s designed to do.

Download ImageOptim Here


XNConvert

This is a very powerful program that’s really good for fine tuning your images. It’s full of options, everything from changing quality to colors, stripping metadata, adding watermarks and more. Huge feature list to this application and it’s hard to believe it’s free.

The Awesome: It’s free, and incredibly powerful. More than just image optimization.

Not so Awesome: Can be a bit overwhelming if you don’t know what you’re doing, and there are tons of options that can be confusing. Don’t let it stop you from using it though.

Download XNConvert for Mac here


iResize

This is a great tool for doing batch operations on images, it’s extremely powerful and gives you tons of options for converting, resizing and quality adjustments.

The Awesome: Free, and really nice toolset.

Not so Awesome Interface is a little clunky, and I’ve never been a fan of separated windows. Still great software though.

Download iResize for Mac here


Windows Software

There are still a lot of good options for Windows developers too. Here are a couple great ones:

RIOT

This is a great tool because it’s so simple, plus you can visually see what changes are being made. It’s really good for finding that perfect balance of quality and file size.

The Awesome: It’s just a great free package that’s simple to use, yet powerful.

Download RIOT for Windows


PNG Gauntlet

For those times when you simply must use those giant PNGs, this tool is really good for sizing them down. It’s really easy to use and pretty powerful too.

The Awesome: Free, easy to use and manages to wrangle giant PNGs down to a reasonable size without losing quality.

Download PNG Gauntlet for Windows


Linux Software

The Gimp

This old die hard has been around for years. More of an image editing program, but you can use it to reduce and optimize your file size too, plus it’s fully scriptable.

The Awesome: It’s an extremely powerful program that’s 100% free and community supported.

Download the Gimp for Linux


XNConvert (again)

I just thought I’d give an honorable mention to XNConvert once again. They have a version of the software that runs in OSX, Windows and Linux. And since hardly anyone likes to port stuff to Linux I’m mentioning it again. The Linux version works just as great, and has just as many features.

The Awesome: Everything I mentioned before, in a fast Linux client.

Download XNConvert for Linux


Jpegoptim

(No Screenshot available)

This is an executable you run from the prompt, which you may be comfortable with in Linux anyway. It uses lossless optimization with tons of features. Plus it’s scriptable in BASH, Python or whatever you choose. Can definitely be used for large projects or automated optimization.

The Awesome: Lean and mean, and highly customizable and scriptable.

Download Jpegoptim for Linux


Online Image Optimizers

Of course with online optimizers you don’t need to worry as much about your operating environment. These also work very well, so long as you don’t have a lot of images to work with and have an internet connection.

Most of these work pretty well, though I’ve always preferred to run optimization on my desktop when I can.

Conclusion

I hope this has helped you find the optimization tool that will help you get your sites loading faster. All of the tools I have featured are free, which is pretty amazing considering the value they give. Consider donating if you can to help fund these projects.

If you’re developing websites, image optimization is one thing to have in your toolkit to really help the speed and responsiveness of your site. Take the time to optimize properly, it will pay off in the long run.


Do you like articles like this?

I’m constantly hacking on stuff and writing about happenings in the programmer world. You can subscribe to my feed here, or you can get the programmer newsletter spam free!
     


More Recent Articles

 

 

Thank you for subscribing to my updates! 

Follow Jeremy on Facebook | Twitter | Linkedin

 




Your requested content delivery powered by FeedBlitz, LLC, 9 Thoreau Way, Sudbury, MA 01776, USA. +1.978.776.9498