Page 1 of 6 123 ... LastLast
Results 1 to 30 of 164

Thread: The computer programming thread

  1. #1
    Join Date
    Dec 2005
    Posts
    1,835

    The computer programming thread

    I started C# programming a week ago. It's all self thought with my major reference being the book C# how to program. Before this I had some experience with Java and prolog. Now this is really taking taking over my mind and I'm finding the OOP concept really interesting. Now I'm looking for some ideas for some programs to try and test my skills and maybe learn more in the process.

    This thread may be used to discuss anything about programming, maybe post some of the your codes or request for some.

  2. #2
    Join Date
    Oct 2001
    Posts
    8,831
    Its interesting that weve never had a decent programming thread, in spite of the many ITers here. Hope your initiative is successful.

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    6,332
    I used to have an old BBCmicro computer which I enjoyed programing to solve the NewScientist puzzels by brut force. That was the BASIC language.

    Made a few puzzle crackers in assemble too.

  4. #4
    Join Date
    May 2005
    Location
    N.E.Ohio
    Posts
    20,091
    Quote Originally Posted by The_Radiation_Specialist View Post
    Now I'm looking for some ideas for some programs to try and test my skills and maybe learn more in the process.
    Like you said, c# is a lot about the OOP, and the language is really secondary.
    I bit my teeth on OOP by playing with little simulation type things. It gave me a feel for the objects provided for graphics, and each "entity" in the simulation can contain its own perception of the environment.

    Just think of what an object might keep to itself, remember, tell others, and how to do various tasks.

    Quote Originally Posted by Argos View Post
    Its interesting that weve never had a decent programming thread, in spite of the many ITers here. Hope your initiative is successful.
    Nope...too complex. So much of programming is an art, and the languages are just the tools of the trade.
    I have seen too many programming styles to say that you can only get a gut feel for what techniques fit with what thought.
    And, some styles work like multi-lingual issues. Some people translate one technique or language into another, and some people just think in that [programming] language.

  5. #5
    Join Date
    Oct 2001
    Posts
    8,831
    I should rewrite it as "I hope your intiative of opening a thread to discuss this subject is successful".

    Do you think it is too complex for discussion, NEO?
    Last edited by Argos; 2007-Nov-05 at 03:35 PM. Reason: Typo fix

  6. #6
    Join Date
    Nov 2002
    Posts
    14,595
    Is C# Object Oriented? I'd thought it was Object Based like most of the other visual languages. (Yeah, the distinction is significant. Object-based retains some of the advantages of procedural without giving up the key advantages of OOness.)

    Speaking, I had a chance to play with Python a few months ago. What a sweet language. They made some odd decisions in parts of the API, but it has some of the best string and comma-delineated-list handling I've ever seen.

    It's also designed to be readable under most circumstances, something I've come to appreciate.
    "Words that make questions may not be questions at all."
    - Neil deGrasse Tyson, answering loaded question in ten words or less
    at a 2010 talk MCed by Stephen Colbert.

  7. #7
    Join Date
    Dec 2005
    Posts
    1,835
    Quote Originally Posted by NEOWatcher View Post
    Like you said, c# is a lot about the OOP, and the language is really secondary.
    True, but the language is closer to human, and that would help a n00b like me.


    Quote Originally Posted by Argos View Post
    I should rewrite it as "I hope your intiative of opening a threat to discuss this subject is successful".
    I never threatened anyone, really!
    Or at least... didn't mean to...

    Quote Originally Posted by Moose View Post
    Is C# Object Oriented? I'd thought it was Object Based like most of the other visual languages. (Yeah, the distinction is significant. Object-based retains some of the advantages of procedural without giving up the key advantages of OOness.)
    Well, Wikipedia says it Object-oriented. Can you explain what you mean?

    C# (see section on name, pronunciation) is an object-oriented programming language developed by Microsoft as ...


    So what's the verdict, is this too geeky even for BAUT?

  8. #8
    Join Date
    May 2005
    Location
    N.E.Ohio
    Posts
    20,091
    Quote Originally Posted by Argos View Post
    Do you think it is too complex for discussion, NEO?
    Not at all... I just think that it is too complex to limit it to a single thread.
    There's so much too it that I think the discussion may start to wander in all sorts of directions.

    It would be like saying "we need a thread to discuss [whatever]ology".

  9. #9
    Join Date
    Dec 2005
    Posts
    1,835
    Well given that this thread has only 28 views so far I think we would be lucky if any major discussion takes off...

  10. #10
    Join Date
    Oct 2001
    Posts
    8,831
    It would be like saying "we need a thread to discuss [whatever]ology".

    Except that computer programming, unlike zymurgism, is at the core of erverything we do nowadays...

  11. #11
    Join Date
    May 2005
    Location
    N.E.Ohio
    Posts
    20,091
    Quote Originally Posted by The_Radiation_Specialist View Post
    True, but the language is closer to human, and that would help a n00b like me.
    Hah... that's exactly what a noob would think. In the days of yore, C was probably the most cryptic (least human) language available.

    I would think that VB would be more human (or humane?) for a noob.

    The problem with "human" is that the details and flexibility start to get lost when you make it easy.

    Quote Originally Posted by The_Radiation_Specialist View Post
    Well, Wikipedia says it Object-oriented. Can you explain what you mean?
    Object oriented is when the language lends itself to create and work with objects.

    Object based, is when the language itself is based on objects. Less and less of the language is used to perform functions. For example; c# uses objects to perform string manipulations, where other (and earlier) languages used operators and functions. Particularly, C# string objects have various concatenation methods where other languages just concatenate with a "+".

    Quote Originally Posted by The_Radiation_Specialist View Post
    So what's the verdict, is this too geeky even for BAUT?
    Is that possible?

  12. #12
    Join Date
    Dec 2005
    Posts
    1,835
    Quote Originally Posted by NEOWatcher View Post
    Hah... that's exactly what a noob would think. In the days of yore, C was probably the most cryptic (least human) language available.

    I would think that VB would be more human (or humane?) for a noob.
    I did some VB a few years ago. Didn't like it.

    The problem with "human" is that the details and flexibility start to get lost when you make it easy.
    Yup, I think its better if you start with that though, and then you can get the basic idea and maybe get working with Java or C++.



    Is that possible?
    Yes.

  13. #13
    Join Date
    Nov 2002
    Posts
    14,595
    Quote Originally Posted by The_Radiation_Specialist View Post
    Well, Wikipedia says it Object-oriented. Can you explain what you mean?
    In classic procedural languages (C, Pascal, Fortran), x := 2 + 3 is a procedural addition of two constantly-sized (1 or 2 bytes, typically) memory locations. The x variable would also be some sort of numerical variable (usually int, but not necessarily). The + is an operator that is pre-defined at the compiler level.

    The assembler will basically "put 2 in a register, add three to that register, and store the result". It translates from high-level language to machine code very cleanly, and would typically require only three clock cycles to run. [Edit: Sorry, four cycles on intel processors. The 3 would itself have to be put into a register. The result 5 would overwrite the 2 in the AX register in the same clock cycle.]

    In a true object oriented language (Smalltalk, Python, Java), x = 2 + 3 works differently. A lot differently. Everything, and I mean everything, is either an object or a method to an object.

    To do x = 2 + 3, the compiler will start by creating an int object, initialize its value to 2 in its creator method. It'll then create a separate but otherwise similar 3 object, pass a reference to that object to the 2 through the +-operator, a method. The 2 object would then alter its own value to a 5, then return a reference to itself to the x variable for storage. The 3 would either then be explicitly destructed by the compiler or would be abandoned and garbage collected as soon as the 3 object left the current scope.

    The 5 (n 2) object would persist only so long as the x variable retained the reference to it. If the x was reassigned or itself passed out of scope, the 5 object would get garbage collected.

    Getting that 5 instance could require a few hundred bytes (not counting the class itself), and require a few hundred clock-cycles to process.

    In between, you have two kinds of languages.

    Hybrids (Mainly C++, and I thought C#), where x = 2 + 3 is usually handled like a procedurally-based language in that both the 2 and 3 are going to be 1 or 2 byte variables, and the + will also render to just a few clock cycles like procedural. But the x could be a procedural-style variable, or it could just as transparently (at that level) be itself an object taking the result 5 through an assignment =-operator method that you've previously defined and overloaded. Without additional information (x's type or class), there's no real way to tell.

    Object-based languages (Earlier versions of Visual Basic, Delphi, Multimedia Toolbook) use objects, but tends to abstract things to an almost procedural-like state. x = 2 + 3 will tend to work procedurally. But you'll have seperate object reference variables to interface with your objects. If you're setting or reading properties, you're probably doing something object-based. You usually lose multiple-inheritance and operator overloading when you go object-based.

    (I won't get into Recursive languages like LisP and Prolog, but they're part of a separate style too, with their own advantages and costs.)

    Each style has its costs and benefits. Which style you use depends on the task itself and the availability of the individual sub-features and library constructs you intend to make use of.
    Last edited by Moose; 2007-Nov-05 at 04:52 PM.
    "Words that make questions may not be questions at all."
    - Neil deGrasse Tyson, answering loaded question in ten words or less
    at a 2010 talk MCed by Stephen Colbert.

  14. #14
    Join Date
    Oct 2001
    Posts
    8,831
    Quote Originally Posted by The_Radiation_Specialist View Post
    I did some VB a few years ago. Didn't like it.[/URL]
    Some peoplelcall VB a event-oriented language.

  15. #15
    Join Date
    May 2005
    Location
    N.E.Ohio
    Posts
    20,091
    Quote Originally Posted by Argos View Post
    Some peoplelcall VB a event-oriented language.
    Only the "V" in VB.
    The event-driven nature of VB is a very small part of the language.

  16. #16
    Join Date
    Dec 2005
    Posts
    1,835
    thanks for the explanation Moose.

    Hybrids (Mainly C++, and I thought C#),
    What you mean by "I thought"?

  17. #17
    Join Date
    Nov 2002
    Posts
    14,595
    Mmm. Yeah, Events go along with Properties as the most recognizable (and useful) features unique to the object-based style of languages.
    "Words that make questions may not be questions at all."
    - Neil deGrasse Tyson, answering loaded question in ten words or less
    at a 2010 talk MCed by Stephen Colbert.

  18. #18
    Join Date
    Nov 2002
    Posts
    14,595
    Quote Originally Posted by The_Radiation_Specialist View Post
    What you mean by "I thought"?
    Because I've never seen C# in the wild. Without it, I can only go by what impressions I get through the comments of others.

    I suppose I could look it up on Wikipedia. Maybe I will tonight if I think of it.
    "Words that make questions may not be questions at all."
    - Neil deGrasse Tyson, answering loaded question in ten words or less
    at a 2010 talk MCed by Stephen Colbert.

  19. #19
    Join Date
    Dec 2003
    Posts
    1,212
    Quote Originally Posted by Moose View Post
    Because I've never seen C# in the wild. Without it, I can only go by what impressions I get through the comments of others.

    I suppose I could look it up on Wikipedia. Maybe I will tonight if I think of it.
    C# has intrinsic "value" types like int, float, etc. that are handled procedurally. Of course, C# supports operator overrides, so it is quite easy to create a fully object oriented data type. The .NET framework provides a "Decimal" class, for example, that overrides all of the math operators and can be used instead of int. The compiler can even optimize the operator overrides and "inline" them so that the Object style code could be almost as fast as the native value type code.

  20. #20
    Join Date
    Nov 2002
    Posts
    14,595
    Okay, so it is a Hybrid style language then. Nice to know.
    "Words that make questions may not be questions at all."
    - Neil deGrasse Tyson, answering loaded question in ten words or less
    at a 2010 talk MCed by Stephen Colbert.

  21. #21
    Join Date
    Oct 2001
    Posts
    8,831
    Quote Originally Posted by Moose View Post
    You usually lose multiple-inheritance and operator overloading when you go object-based.
    By that criterion C# is OO [or OB if you will], since it does not support multiple-inheritance.

  22. #22
    Join Date
    Sep 2004
    Posts
    14,076
    I'm building a software synthesizer in VB6 from scratch. I have one major problem though. The latest compatible directsound DLL is DS8. Now DS8 allows you to change pitch of samples and add effects to samples. Nice! Only, not at the same time as far as I know. For some effects it's not a problem, I can program those myself. But some other effects...think of a low pass filter.

    Does anyone know if and how you can use both the effects and pitch section of directsound 8 in a VB program at the same time on the same sample?

  23. #23
    Join Date
    Jul 2003
    Posts
    4,217
    From someone who would have liked to program
    but was too old! I did manage a few lines on
    my speccy though, just a big for/next loop
    with graphics of the error in a scotch mount
    camera tracker for stars. Anyway.. if I list
    all the languages off the top of my head, a
    few words of appreciation or otherwise.

    Basic
    Fortran
    algol
    Pascal
    prolog
    ada
    Forth (hot at one time)
    Apl
    C
    C+
    C==
    Lisp
    Quickbasic
    Visual basic

    I would have chosen the wrong one to learn!

  24. #24
    Join Date
    Nov 2002
    Posts
    14,595
    Quote Originally Posted by Argos View Post
    By that criterion C# is OO [or OB if you will], since it does not support multiple-inheritance.
    These aren't formal or even rigid definitions, by any means. At least as far as I know. Certainly, without personally getting my hands dirty in C#, I'm hesitant to lock down my arbitrary pigeonholing.

    But no, multiple inheritance isn't a feature I would count on to firmly demarcate language styles. Not on its own, anyway. But if there's an object-based language that supports it, I'm not aware of one.

    I'd stick with how (and where) scalar arithmetic of constants is defined as the outermost demarcation. The inner one seems to be in the details of how enforced the abstraction of objects are seems to be the other demarcation.
    "Words that make questions may not be questions at all."
    - Neil deGrasse Tyson, answering loaded question in ten words or less
    at a 2010 talk MCed by Stephen Colbert.

  25. #25
    Join Date
    Jan 2005
    Location
    New Zealand
    Posts
    9,672
    Quote Originally Posted by The_Radiation_Specialist View Post
    I started C# programming a week ago. ... Now I'm looking for some ideas for some programs to try and test my skills and maybe learn more in the process.
    As something "astronomyish"; a few weeks ago I took the C# Express screen saver starter kit and made a "gravity simulator".

    When the saver starts up, some objects with mass appear on the screen, and they all start attracting each other and flinging all over the place. I find it relaxing to look at.

    If you are interested, PM me and I'll email you the code.

    You can tell me how badly I messed up the gravity-force-acceleration maths.

    (I'm a C# programmer by trade, but this was a lunch-time hack, not a carefully crafted sample.)

    Cheers,
    I don't see any Ice Giants.

  26. #26
    Join Date
    Feb 2003
    Posts
    2,087
    Quote Originally Posted by The_Radiation_Specialist View Post
    Now I'm looking for some ideas for some programs to try and test my skills and maybe learn more in the process.
    Don't know about the OOP aspect of it, but if you're looking for stuff to program, check out Project Euler. You have to register (free) to check you answers, but it seems to be a good way to test you skills, both in programming and math. I've only done the first few, others here have gone quite a bit through them.

  27. #27
    Join Date
    Dec 2003
    Posts
    1,212
    Quote Originally Posted by Argos View Post
    By that criterion C# is OO [or OB if you will], since it does not support multiple-inheritance.
    This is, now that we have generics, the biggest limitation of C# IMHO. Microsoft doesn't seem interested in fixing it either. I'm not sure this alone means that C# is not truly OO, but it certainly eliminates a lot of design patterns I used to use in C++. Composite aggregation is a pain, as is encapsulation.

  28. #28
    Join Date
    Nov 2002
    Posts
    14,595
    Hey, Project Euler looks neat. I might just dig into these to get my hand back in. DB herding has gotten me more than a bit rusty in most of my core skills.
    "Words that make questions may not be questions at all."
    - Neil deGrasse Tyson, answering loaded question in ten words or less
    at a 2010 talk MCed by Stephen Colbert.

  29. #29
    Join Date
    Dec 2005
    Posts
    1,835
    Quote Originally Posted by Captain Kidd View Post
    Don't know about the OOP aspect of it, but if you're looking for stuff to program, check out Project Euler. You have to register (free) to check you answers, but it seems to be a good way to test you skills, both in programming and math. I've only done the first few, others here have gone quite a bit through them.
    That's great, thanks. I just registered and did a few of the easy ones. Definitely a good place to start.

  30. #30
    Join Date
    Mar 2004
    Posts
    3,134
    Quote Originally Posted by Moose View Post
    In a true object oriented language (Smalltalk, Python, Java), x = 2 + 3 works differently. A lot differently. Everything, and I mean everything, is either an object or a method to an object.

    To do x = 2 + 3, the compiler will start by creating an int object, initialize its value to 2 in its creator method. It'll then create a separate but otherwise similar 3 object, pass a reference to that object to the 2 through the +-operator, a method. The 2 object would then alter its own value to a 5, then return a reference to itself to the x variable for storage. The 3 would either then be explicitly destructed by the compiler or would be abandoned and garbage collected as soon as the 3 object left the current scope.
    I don't know about Python and Smalltalk, but that's not true for Java. Java's primitive types, like int, are memory locations on the heap or stack operated on directly as in a procedural language. I think C# is the same in this respect. Reference types in Java are really just another primitive type as well, a strongly typed pointer - although that observation is highly discouraged

    Java (and I think, C#) has always had objects that represent the primitive types as well so that you can objectify them and reference them like any other object (and stick them in a HashMap, for example), but they are type incompatible with the primitive objects they represent. Relatively recently the Java compiler has started to stick in the conversion code between primitives and their object (i.e. reference type) counterparts automatically making it appear at times that their is no difference. I believe they did this in answer to C#'s ability to do just the same thing. Sun always came up with "good" reasons not to do it until C# came along

Similar Threads

  1. Computer programming: What is the status of XSLT 2.0?
    By jfribrg in forum Off-Topic Babbling
    Replies: 0
    Last Post: 2009-Dec-16, 08:45 PM
  2. The computer help thread
    By The_Radiation_Specialist in forum Off-Topic Babbling
    Replies: 46
    Last Post: 2008-Jan-10, 10:56 PM
  3. A little programming help
    By Tranquility in forum Off-Topic Babbling
    Replies: 8
    Last Post: 2005-Mar-14, 07:31 PM
  4. Apollo Guidance Computer and Other Computer History
    By jrkeller in forum Conspiracy Theories
    Replies: 0
    Last Post: 2004-Mar-29, 03:07 PM
  5. Computer Programming
    By Pi Man in forum Off-Topic Babbling
    Replies: 26
    Last Post: 2003-Aug-12, 12:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
here
The forum is sponsored in-part by: