Programming tip: Abstraction

(Obligitory corny joke at end of post….)
OK you are writing a program that reads data from a file and does analysis of the data. Works fine for reading data from a csv file but you decide that you want to now read data from a spreadsheet file or xml. But you wrote the program with the parser mixed in with the analysis code and to make it work with the new format you are changing code all over and now it won’t read csv files anymore.
So what do you do. Well first separate the code for the parser out of the code to analyze it. And do it in such a way you can switch the parser from one to another; this is abstraction. The part of your program that does the part you don’t want to break is separated from the other parts that may change so that you can change them easily without breaking the rest of your program. Now the part that is reading the data can read it in any format and then put it into the format the rest of the program is expecting.
OR if that was too boring, Abstraction: what happens to young girls when a young man with great abs walks by, abstraction.

Advertisements

About echlinm

Computer Programmer/Systems Analyst/Hacker S31
This entry was posted in Computers and Internet and tagged . Bookmark the permalink.

One Response to Programming tip: Abstraction

  1. Angelique says:

    Looks like you are an expert in this field, excellent article and keep up the good work, my buddy recommended me your blog.

    My blog:
    rachat pret hypothecaire puis comparatif Rachat De Credit

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s