Posts tagged with ‘programming’

 

Wonder why Microsoft Zune fail on New Year leap year? It’s because of a Freescale date routine!

year = ORIGINYEAR; /* = 1980 */

while (days > 365)
{
  if (IsLeapYear(year))
  {
    if (days > 366)
    {
      days -= 366;
      year += 1;
    }
  }
  else
  {
    days -= 365;
    year += 1;
  }
}

Under normal circumstances, this works just fine. The function keeps subtracting either 365 or 366 until it gets down to less than a year’s worth of days, which it then turns into the month and day of month. Thing is, in the case of the last day of a leap year, it keeps going until it hits 366. Thanks to the if (days > 366), it stops subtracting anything if the loop happens to be on a leap year. But 366 is too large to break out of the main loop, meaning that the Zune keeps looping forever and doesn’t do anything else. (Source: ZuneBoard)

User “itsnotabigtruck” of ZuneBoard forum made that interesting find.

 

I’ll try to explain based on my experience explaining Java to some friends. I never been through formal programming training which probably hence made me a poor teacher.

To me, it is because they cannot accept the language as it is. They question why are things done this way? Why not another way? The modern programming language is so abstract. It’s hard to see how the lower level components interact.

Some learners need to fiddle with the lower layers to accept and understand the higher level components. We just build tools on top of the lowest layer and then establish more and more layers thinking it is making life simple.

I lost my patience before and said to a friend, “Why can’t you just memorize it? It’s by design, if you don’t like then design your own language.” Actually it’s just an excuse because the real reason is too long to explain. It’s like telling a primary school kid that light travels in a straight line even though you well know it doesn’t and thank god it doesn’t.

Perhaps it does make life simple for the already programmers, but it makes learning a lot harder.

 

One of the worst programming languages I ever wrote in is Fortran. It’s got a rather limited set of features. I dreaded to go work every day staring at the lines of codes that basically represent a cholesterol research paper’s equations.

I was using the g77 compiler. The only thing that I can remember is all the nonsensical representation of while loops. It has got the most basic support for structural programming. I had the impression that programmers in the 1970s are like artists, they paint a first layer and paint a second then the third and if there’s a mistake they cover it up with a thick coat of paint. The whole software is like a gibberish piece of code and no amount of comment ever made my life easier the next day.

However it is through Fortran that I start appreciating the more modern programming languages. I look at for each loops imagining how confusing would it be to represent the same code in Fortran.

Every time I hear people whine about how many lines of codes and how confusing a code chunk looked, I wish those people could see things from my point of view. Imagine the number of mistakes made and later corrected for the supposed better.

 

The general problem about tutorials is that they create things that are quick and hardly uses best practices. The most popular tutorial topic is perhaps the 20 minute blog screencasts. It’s a great way to introduce the features of the web framework but it actually is filled with so many bad practices. Many beginners leave the blog tutorial satisfied, forgetting issues like validation, security and so on.

Should beginners be completely unaware of these issues when they start? With ignorance, it’s easy to attract to would-be developers but they probably wouldn’t stay for long and it gets really discouraging at some point.

I love the 20 minute how to create your own blog screencasts by the way. My point is that it just is not for absolute beginners in programming.

 

After I drew the ER diagram on the white board in the database lesson, the lecturer commented that I am a programmer.

Lecturer: You have an Diploma in IT right?
Me: No, biotechnology.
Lecturer: I know you’re a programmer.

Yeah yeah… I hate being called a programmer. I somehow prefer to be called a developer. (By the way, I like the way Indians pronounce ‘developer’.) It’s just that programmer sounds like a menial task and developer sounds much nicer.

It’s just like lecturers preferring to be known as lecturers as opposed to being called ‘teachers’.

Just my 0.02 dollars.

 

We all love charts don’t we?

Linux Symposium Tshirt size

(Linux Symposium Tshirt size.)

I say the title is incorrect. The tees merely gotten smaller. (Original picture)

 

Are you perhaps, interested in PHP?

PHP books

We all know about Java interfaces, what about PHP interface?

Saw this at Kinokuniya, Kuala Lumpur.

 

WordPress powered and Django inspired.
Love and elephants come after.
RSS: Posts and comments.