Skip to Content »

FlashApe » Encapsulation!

 Encapsulation!

  • May 14th, 2007
  • 1:29 pm

I finally learned how important this concept is when you are programming. Coming up as a flash developer, on of the things you learn quickly and get very used to, is how easy it is to break encapsulation on your objects and ‘hack’ things. I’ve said before I’m a big fan of just getting the stuff done and to not worry about strict OOP concepts. However, on this project I am currently trying to wrap up, I am experiencing first hand the other side of that issue…namely, the ripple effect that poor encapsulation can have on your code. Too many times, fixing one bug is breaking something else. Granted, that could’ve been caused by introducing an entirely new way of trying to accomplish something that needed to get done in the late stages of a project…but properly written interfaces would’ve saved a lot of work (and stress).

The way I’m seeing it now, therea re some projects that you can get away with sloppy encapsulation (websites) and some you WILL get your ass bitten with (applications). From now on, it’s a well-defined interface for objects and classes for me.

6 People had this to say...

Gravatar

If you have time to breathe, you have time to refactor the mess you made. If you don’t have time to breathe, raise hell to git-r-done. That’s my philosophy on programming.

Gravatar
  • rich
  • May 14th, 2007
  • 6:59 pm

yeah, i agree with that. I’m saying I think I cost myself some breathing time.

Gravatar

Let me rephrase that. I was attempting to be witty whilst watching Hero’s and making sure her majesty got her time to inform me of yarn purchases. Comletely failed…. (being witty).

You had one of those posts that causes people to agree, identify, and have the desire to use your comment form as a Twitter blog post. This, as opposed to offering anything useful other than agreement via a seemingly irrelevant comment-blog-post…comment.

Anyway, bottom line, been there and totally agree. Obligatory advice?

…uh, DON’T SEE SPIDERMAN 3!!! See Hot Fuzz instead. Well, actually, I dug SM3, but if you’re on a budget, HF 4 t3h w1n!

Gravatar
  • rich
  • May 14th, 2007
  • 8:40 pm

…making sure her majesty got her time to inform me of yarn purchases.

Haha! i think i related to that more than anything else you said!

Gravatar
  • Tangent
  • May 15th, 2007
  • 3:33 am

I hear your pain. Unit testing is a big helper for the whole mass, because it helps speed up your development by mitigating the mess of fixing bugs.

Gravatar

It’s key. To quote oh so many OOP books:

“A object should act as a black box. You can put things in, and request things back. But you should never be exposed or directly communicate with the inner workings”

Try not following encapsulation when theres more then 5 people working on the same project. Never fun.

Want your say?

* Required fields. Your e-mail address will not be published on this site


You can use the following XHTML tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>