Saturday, March 20, 2010

A Few Problems with ColdFusion

Posted by Scott on 27. February 2009 05:11

I have a couple of Co-Workers who work in ColdFusion along with my Alma Mater. I wanted to see if it was the right thing to do or was there something better than it.  I did find a couple reasons why NOT to use ColdFusion which I have begun to believe in.  Don't want to start a flame war here, but I see a big problem with ColdFusion.

 
Photo by Mike Licht, NotionsCapital.com

  • It discourages the separation between business logic (the code) and the presentation layer (the layout).  This in turn creates something I like to call spaghetti pages. Bad for code reuse and code readability.
  • Because of the template model it uses, it creates cross site scripting vulnerabilities easier.  Most web frameworks escape the html entity in output automatically.
  • CFML and CFScirpt are poor abstractions.  You just aren't able to write business logic in them.  Some CF components will say to write you business logic in Java classes and then refer to them from CFML. 

This means that CF is a $3000.00 template library with has to be renewed.  Whats the point?

Just putting some thoughts down on paper.

If you liked this post, please be sure to subscribe to my RSS Feed.

Share/Save/Bookmark

Best Practices for CSS Style Sheets

Posted by Scott on 23. January 2009 05:10

A while back Microsoft released a program called "StyleCop".  StyleCop is almost like a style guide for code, kind of like what CSS is for HTML.  It gives the rules for how HTML should be setup and react.  Now I only wish someone released a stylecop for CSS.  In my many years of dealing with CSS I had to come up with a best practice or thought on how I would like all my Style Sheets to look and feel.  This would help me determine exactly where to look over each sheet.  I realized that this guide was in my head and I had never put it down on paper.  So here today, I won't put it down on paper, but will post it here for all to see.  I have seen many style sheets and this is the guide that I use when I start to build my sheets.

  • Style sheets should always have the basic essential styles which are things like underline, bold, italics, predefined h1, h2, and h3 fonts, colors, link variations, and sizes of fonts.  This allows for a similar look and feel on every page of the site.
  • Style sheets should be downloaded as fast as possible from the server and therefore must have the least possible white space while still allowing for the ability to separate styles with the human eye.  This is where a one line per style should come into practice.  For each style used, it should only take up one line of the style sheet.  No longer should you use one line per declaration of style.  This new way is an easy way of looking over each feature of the style while still allowing for fast downloads of the sheet. For Example:
body { margin:0px 0px 0px 0px; background-color: #0077b3; background-image: none; vertical-align: top; text-align: center; font-family: Arial; font-size: .8em; text-decoration: none; }

  • Style names should be camel cased starting with the name/abbreviation of the tag the style applies to and then the name of the div tag/style. 
    • For Example:  I have a Div tag with an id of userName, I should name the style divUserName. 
    • If I have no name for the tag, I should name a type of ID for the style.  For Example: divPageInformation. 
    • Unless it is a standard id like .bold, .italic, etc... I will not declare what the style does, rather I would declare where the style belongs. For example for links: aPageTitle
  • Style grouping is a way to organize your sheet for better readability and navigation of the sheet.  In the past, people used to just put styles up on the sheet and forget it.  Not thinking that they would have to later come back to the sheet for editing.
    • If the style is generic through out the entire site, I group it at the top of the sheet with all the other generic styles.
    • I then group all the styles by page and then control/object it styles.  I then alphabetize the styles in each group for a fast skimming rate.

For Example:  I have an accordion that is generic along the entire site, so I would group the entire accordion together and then alpha sort the tags.

/* Accordion */
.accordionContent { border: 1px dashed #2F4F4F; border-top: none; padding: 5px; padding-top: 10px; }
.accordionHeader { border: 1px solid #2F4F4F; font-family: Arial, Sans-Serif; font-size: 12px; font-weight: bold; padding: 5px; margin-top: 5px; cursor: pointer; text-align: left; }
.accordionHeader a { text-decoration: none; }
.accordionHeader a:hover { text-decoration: underline; }
.accordionHeaderSelected { border: 1px solid #2F4F4F; font-family: Arial, Sans-Serif; font-size: 12px; font-weight: bold; padding: 5px; margin-top: 5px; cursor: pointer; text-align: left; }
.accordionHeaderSelected a { text-decoration: none; }
.accordionHeaderSelected a:hover { text-decoration: underline; }

For another Example:  I have a reports page.  I group the reports page together separated by one line and then group the report styles together while sorting them.
 

.liReportChkbxs { list-style: horizontal; margin: 0 5px 0 0; display: inline; }
.ulReportChkbxs { float: left; margin: 0 5px 0 0; }

.liReportsList { list-style: none; padding: 5px 0 5px 5px; }
.liReportsListHorizontal { display: inline; }
.ulReportsList { text-align: left; display: block; list-style: none; }

I hope that helps in your style sheet endeavors.  I sure do wish I didn't have to go through the learning phase of this type of style.  I would love to hear my readers thoughts on this guide and how they differ from it.

If you liked this post, please be sure to subscribe to my RSS Feed.

Share/Save/Bookmark

The Software that Never Crashes

Posted by Scott on 1. December 2008 18:23

There are many untold stories in the world today.  From saving lives to sacrificing your self for the greater good.  Stories are past down from generation to generation and I want to make sure there is another story that is told to every programmer in the world.  It is the story of those who write perfect code. An interview in Dec. 2007 was done by Charles Fishman about the programmers who code for the space shuttle.  The men and women that put their code to the test.  It either works and people live, or it fails and people die.  There is only a good and a bad scenario.  If you are space shuttle programmer, you are a perfect coder.  I don't want to bore you with the forward, I would just rather get to the meat of the article. So here it is in all of its glory.

http://www.fastcompany.com/magazine/06/writestuff.html

After reading the article, I hope you realize the amount of inspiration that could be taken from this as a programmer. The quote that sums it all up for me is:

"But how much work the software does is not what makes it remarkable. What makes it remarkable is how well the software works. This software never crashes. It never needs to be re-booted. This software is bug-free. It is perfect, as perfect as human beings have achieved. Consider these stats: the last three versions of the program -- each 420,000 lines long-had just one error each. The last 11 versions of this software had a total of 17 errors. Commercial programs of equivalent complexity would have 5,000 errors."

That quote right there sums up coding in a basket.

  • Write better code.
  • Write cleaner code.
  • Write as if you had to save a life  - Its amazing what someone would do to know that their code could end up costing lives.
  • Learn something from this article and bring it back to your company.
  • In the end, its the process by which they executed that makes their code perfect.  Learn to make great code, plan and think about great code.
  • The average programmer today thinks 80% of the time and actually codes only 20% of the time.  This thinking is what makes the programmer better at writing clear and concise code.

This story should be placed in a book for all to see and remember.  Its an inspiring piece about the perfect programmers.

Now the question remains: Have you ever created something flawless?

kick it on DotNetKicks.com

If you liked this post, please be sure to subscribe to my RSS Feed.

Share/Save/Bookmark

In programming, clever != smart.

Posted by Scott on 10. November 2008 21:52

You ever have one of those days where you think you are the smartest man in the world and the best programmer at your place of work?  Then some clever kid comes along and does something that speeds up your code by a few seconds/minutes?  Ease your self.  Just because that person just solved your problem, doesn't mean they are smart.

"In programming, clever != smart." - anonymous


You work all day on a certain project, take a step back and look at it.  Its some of the beautiful code you just created, but you are hung up on this little issue.  Along comes some programmer and they solve it for you. When I was in high school or middle school and I was getting off the bus.  One day I heard one of my bus drivers say to a girl.

"You might be book smart, but your not street smart" - anonymous 

I tend to think that I am about in the middle of this quote.  I tend to think I am both book and street smart.  I imagine most people do.  Book smart programmers tend to be better at writing code then their street smart counter part.

The book smart programmer (smart):

  1. tended to focus more in school on classes including algorithms.
  2. tended to have less of a social life due to studying more or less depending on how fast they got solutions to projects.
  3. tended to be either inside playing video games or working on a cool project that could solve the way USB drives communicated to computers.
  4. tended to have soda cans and candy around while staying up late around his computer.
  5. tended to get better grades.


The street smart programmer (clever):

  1. tended to focus a bit more on going out and socializing.
  2. tended to focus a bit more on girls.
  3. tended to copy and paste code.
  4. tended to join a social organization.
  5. tended to have a bit more fun in the activities they thought up.
  6. tended to get a little lower grades.


This reminds me of the movie "Real Genius". Where Chris seems to have both of these types of people tackled.  He sees Mitch and he sees the old him.  The book smart programmer(laser tech).  Mitch is stuck with trying to do the best in college that he can. Then one day, Chris gives Mitch a little lesson. He lets Mitch know that college and life can't just be all books.  It has to be books and fun.  It has to be smart and clever. Sure clever != smart, but wouldn't it be good to be both? Wouldn't it be satisfying to be Chris and let Mitch slack off a bit.  They are both geniuses.

I went to college for four years, I did my fair share of partying and I didn't graduate with the best GPA.  For a Computer Engineer, it is a pretty shameful GPA.  Though I got a real job before even graduating.  I had done some work on the side while still in school.  I got an intern with my college Fraternity. This advanced my ability to show my future employer I can have a real job and keep it.  I am not saying stop all your studies now, but live life.

Programmers need to both be smart and clever. Not just smart and not just clever.  If you want to tackle the real issues, you can't keep writing code all day and every day.  You need to just step out and have some fun.

"Don't let Life pass you by..." - Scott

I am not trying to be a philosopher, but what I am saying is find your true happiness in life.  Be smart and clever.  Don't get stuck on always trying to be the best or smartest, but make sure you Get the Job Done at the same time.

P.S. I always tend to start on one subject and completely finish with another by the end of the post.  This one is no different. hah.

kick it on DotNetKicks.com

If you liked this post, please be sure to subscribe to my RSS Feed.

Share/Save/Bookmark

Get Drunk and Code

Posted by Scott on 4. November 2008 22:34

Have you ever reached the pinnacle of the programmers peak when working on a piece of code while drunk?  Have you ever thought: now that's a brilliant piece of code, what the hell did I do last night?  From time to time, all programmers will eventually experience the peak.  Its called the "Ballmer Peak". Its the moment that your a few beers in with the Blood Alcohol level of .13%-.14% where you just start to write the magical code.

Last night I was writing some good code for customers on one of my pet projects.  It involved web services and a bit of Javascript.  I was working great until I was a few beers in, when I was truly able to focus anymore.  I was talking to one of my fellow peers today at work, and he explained it was the "Ballmer Peak".  I guess there is a theory for everything.

Its the theory that computer programmers can obtain a superhuman coding ability with the blood alcohol level between .129% and .138%.  It was discovered with Steve Ballmer and coined at the web comic XKCDThe theory came about referencing Steve Ballmer and his crazy acting pretty much what looks like a drunk when ever he is on stage.  The theory though is more than what meets the eye.  It might actually be somewhat correct in assumption.  Have you ever had those nights where you just hacking away at code while having a few beers and you wrote brilliantly?  Only to wake up the next morning not able to compile the code you wrote!  I have been there many a times and put this theory to the test.

 

 

Point of concern that throws this whole theory out the window is that Steve Ballmer never wrote any production code while at Microsoft.  He has a background in business and is known for being able to solve difficult math calculations mentally, but not code.

This is one of those theories I don't mind trying over and over again.  Someone needs to take the initiative and insert it into Wikipedia.

Programmer's Paradox, which is the lag in creativity behind skill on the inebriation scale.

 

kick it on DotNetKicks.com

If you liked this post, please be sure to subscribe to my RSS Feed.

Share/Save/Bookmark

The Self Improving Programmer

Posted by Scott on 29. October 2008 22:34

Money never made a man happy yet, nor will it. The more a man has, the more he wants. Instead of filling a vacuum, it makes one. - Benjamin Franklin

"Money can't buy you happiness, but it can buy you extra time to be happy." - Scott Pio

Today after a successful twelve days of blogging, I made my first dollar.  I am at $1.03 this present moment and I am still moving upward.  Most small businesses always have a commemorative dollar sticking up on their wall so everyone can see. At this present moment, after making my first dollar, I don't feel any different and I don't think after I make my first hundred dollars will it feel different either.  I am a person who doesn't worry too much about money and seem to always be okay with the amount of money that comes in my door.  I always seem to sustain my current lifestyle which isn't much and don't ever seem to have to worry about money.

"I am a computer programmer.  There will always be work for me."

If there will always be work for me then why write a blog?  First and foremost, I will be honest and say I am doing it for selfish reasons.  A bit different than what the readers might think, which isn't for money. In school and now at work, I have always been told I write like I speak.  I shouldn't do that.  In high school, I got around a 400 on my American SATs which at the time the max was 800.  I wasn't a great writer by any means, I'm still not.  I am a technical person.  I write to this blog to further increase my writing ability.  I want to make a better writer some day, which means practice makes perfect.

So why mention the money? Why can't I get paid to write what I say.  Why can't I make the measly 10 cents per post that I write up? I suggest if your a technical person, that you make a goal to start writing if you care where you might be in ten years.

Programmers and technical people in general need to learn how to write better.  They need to learn how to comment better.  They need to learn how to write proposals better.  Programmers might write in several places, but to name a few.

You might write:

  • A business plan for when you deploy your first startup.
  • A white paper explaining the next best idea to help increase programming efficiency.
  • A business case analysis for that startup you just created.
  • A proposal for that TOP SECRET Government contract that will put your name down next to Albert Einstein.
  • A argument for or against Microsoft/Apple/Adobe/Google products that could end up saving you or your company MILLIONS.
  • A technical manual for use of that TOP SECRET government project you just created.
  • For a magazine article.
  • Your next speech to the WORLD explaining to them why you are the best programmer in the world.

These things are some what far fetched, but you really don't know when you might be put into that position.

So write articales, do a journal and write often.

"It is better to have tried and lost, than to never have tried at all." - anonymous

Programmers seek to improve them selves every day with beautiful code, but why not also seek to improve your self every day with your dialect?

For me, I am happy when I improve upon my self, not upon my wallet.

kick it on DotNetKicks.com

If you liked this post, please be sure to subscribe to my RSS Feed.

Share/Save/Bookmark

Thank your local programmer

Posted by Scott on 28. October 2008 22:55

"Who started it all? Who made the world a better place for all programmers?  Who should we pay homage to as programmers?"  When asking these questions, who do you think of? One thing I was never taught was who were the first successful programmers?  Who made my job what it is today?  Of course you have Bill Gates and Steve Wozniak, but they weren't the ones who started it all; only the ones that made millions from it all.

The first and foremost programmer was:

  • Ada Lovelace - She was the first person to write an algorithm that was expressly intended to work on mechanical computer by Charles Babbage. She died at the early age of 36, but has remained for ever in the programmer's hall of fame. The programming language Ada was named after her which was first used by the U.S. Department of Defense.
The following are a list of notable programmers, for if it weren't for these frontiers men we would still be about 20 years behind.

  • ENIAC -This giant machine was considered the first giant brain when it was released to the press in 1946. This machine needed the first working programmers Kay McNulty, Betty Jennings, Betty Snyder, Marlyn Wescoff, Fran Bilas and Ruth Lichterman.
  • Leonard Adleman - Co-inventor of the RSA algorithm which also coined the term "Computer Virus".
  • Paul Allen - Co-founder of Microsoft.
  • John Backus - Creator of FORTRAN.
  • Tim Berners-Lee - The person all internet startup companies should pay homage to.  He is the creator of the World Wide Web. The Internet.
  • Richard Brodie - The creator of Microsoft word. For all those against Microsoft, you have to agree that we would still be way behind if it not for this guy.
  • Walter Bright - Creator of the first C++ compiler.
  • John D. Carmack - Creator of Doom and Quake.  This man changed the average time spent on the computer.
  • Bram Cohen - Creator of the BitTorrent Protocol.
  • Alan Cooper - Creator of Visual Basic.
  • Alan Cox - Creator of the Linux Kernel.
  • Ward Cunningham - Inventor of the Wik.
  • Bill Gates - Co-Creator of Microsoft.
  • Jawed Karim - Creator of YouTube.
  • Mike Muus - Author of Ping.
  • Jarkko Oikarinen - The creator of IRC.
  • Bjarne Stroustrup - Creator of C++.

These programmers are the most notable of our field today and have been for some time.  They are the guys we should say thank you to.  For those interesting factoid kind of people.  I would like to point out that the first programmer is a woman in an industry that is dominated by males. Go figure!

Programmers have a way of making the world a better place.  Making it a place where things get easier and life gets faster.  Programmers save lives, prevent natural catastrophes (hurricanes, earthquakes, tsunamis) in which BILLIONS of lives have been saved by your average programmer sitting in a cubicle somewhere making the next best digital widget that could end up saving your life.  Computers are everywhere so lets not forget that code from a programmer is also entrenched in our daily lives. 

Moral of the story: Thank your local programmer! They might not be preventing heart failure in a pacemaker, but they are making the world a easier place to live in!

If you liked this post, please be sure to subscribe to my RSS Feed.

Share/Save/Bookmark

What class of programmer are you?

Posted by Scott on 27. October 2008 14:29

"People can be divided into two classes: those who go ahead and do something, and those who sit still and inquire." - Oliver Wendell Holmes

What kind of programmer are you? In today's world of programming, the average programmer does not sit on the bleeding edge nor do they sit on the back burner waiting for the coils to get hot enough to jump ship.  You have to change and evolve.  You have to keep moving forward.

Programmers generally move forward to a new product every few years, but also sit complacent when they don't feel threatened.  Like one of the Militaries favorite quotes, "If it ain't broken, don't fix it." The military is a reactionary force along with the average programmer.  The programmer that moves ahead in the world is not the average programmer.  They are a programmer who moves forward, who thrives for the best.  Who sees a problem and fixes it.  They do not wait for the problem to come about and then go about fixing it.  They are ahead of the crowd, the first kind of programmers are your Bill Gates, Steve Wozniaks, Scott Guthries, Paul Allens, Steve Capps, Justin Frankels and Jarkko Oikarinens. The first type of programmer wants to innovate, move around and make things that help humanity.  These are the programmers I look up to.  As of recently these types of programmers have gone into hiding at Microsoft, but not Google or Apple.  Why is it that most of Microsoft's programmers (Microsoft employees) fit into the second class of people.  These days, Google is the innovator.  Google's employees fit into the first class of people.  They are now the company to beat in the programming world.  They are the ones that everyone else is trying to play catch up with. Microsoft has lost a lot of its innovative programmers and they have moved to Google or decided to venture into their own startups.

If Microsoft wants to compete in Google's world, it has to accomplish a few great things. The first thing to do would see how Google works.  See what they do to make great software.  If Microsoft fails at this, they will not be a company in the next twenty years. Microsoft has to go back to the basics.

"Competition always creates an environment for innovation."

Microsoft tried to compete with Google over two years ago today.  They started a service that could have created such a competitive environment, but they fell complacent. Therefore they fit in the second class of programmer. 

What was this service? Live Labs. Google has launched over 30 innovative products from their labs, so why has Microsoft launched only six in the passed two years?  Microsoft has become complacent. This post is not to slam Microsoft on their shortcomings.  It gives you a difference between what the first class of programmer looks like compared to the second class.  Microsoft is neck deep in the second class of programmers with only a few truly innovating, while Google is up to its knees in the second class of programmers.

I would like to hope since your reading this, that you are not falling complacent.  That you have an innovative environment around you.  That you are pushing the thresh hold of your very fabric. I hope that you are not like Live Labs, but actually like Google Labs. Always creating, always innovating. The average programmer sticks with Live Labs, but the first class programmer is Google Labs. Be Google Labs. Become better than you are.

Microsoft launches its Google Labs - Here is an article from January 06 that had hopes of Live Labs competing with Google Labs.  Microsoft wonders why people are flocking towards Google.

"The country needs and, unless I mistake its temper, the country demands bold, persistent experimentation. It is common sense to take a method and try it. If it fails, admit it frankly and try another. But above all, try something." - Franklin D. Roosevelt - 1932

Don't just stand there.  Go ahead and do something! The world is waiting for you to experiment. Be the first class of programmer!

kick it on DotNetKicks.com


If you liked this post, please be sure to subscribe to my RSS Feed.

Share/Save/Bookmark