Getting my head around object oriented programing

Posted by nLL on Stack Overflow See other posts from Stack Overflow or by nLL
Published on 2010-05-17T20:13:30Z Indexed on 2010/05/17 20:20 UTC
Read the original article Hit count: 302

Filed under:
|
|

I am entry level .Net developer and using it to develop web sites. I started with classic asp and last year jumped on the ship with a short C# book. As I developed I learned more and started to see that coming from classic asp I always used C# like scripting language. For example in my last project I needed to encode video on the webserver and wrote a code like

public class Encoder
{
    Public static bool Encode(string videopath) {

        ...snip...

        return true;
    }
}

While searching samples related to my project I’ve seen people doing this

public class Encoder
{
    Public static Encode(string videopath) {
        EncodedVideo encoded = new EncodedVideo();

        ...snip...

        encoded.EncodedVideoPath = outputFile;
        encoded.Success = true;

        ...snip...
    }
}

public class EncodedVideo
{
    public string EncodedVideoPath { get; set; }
    public bool Success { get; set; }
}

As I understand second example is more object oriented but I don’t see the point of using EncodedVideo object.

Am I doing something wrong? Does it really necessary to use this sort of code in a web app?

© Stack Overflow or respective owner

Related posts about c#

Related posts about object