onion stlye of coding

This is a discussion on onion stlye of coding within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Originally Posted by maxorator For example this style... Code: int bla(int blabla) { //bla } ...annoys me a bit but ...

  1. #16
    Banned
    Join Date
    Nov 2007
    Posts
    678
    Quote Originally Posted by maxorator View Post
    For example this style...
    Code:
    int bla(int blabla)
    {
        //bla
    }
    ...annoys me a bit but that doesn't mean I should whine.
    what's wrong about that style? can you explain a bit?

    Now make sure the next topic you make won't be named "Why do people like olives?".
    no, i suppose my next thread should be:
    Are programmers still Human?

    citizen, what is recycle?

  2. #17
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Quote Originally Posted by manav View Post
    what's wrong about that style? can you explain a bit?
    There's nothing wrong with it, it just seems a bit too discursive for me.

    If you don't like something, that simply means you don't like it. It does not mean there's anything wrong with it.

    Quote Originally Posted by manav View Post
    no, i suppose my next thread should be:
    Are programmers still Human?
    They are people. But that doesn't mean they like the same things as you do. People are different, accept that.
    Last edited by maxorator; 04-18-2008 at 06:08 AM.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  3. #18
    Banned
    Join Date
    Nov 2007
    Posts
    678
    Quote Originally Posted by maxorator View Post
    If you don't like something, that simply means you don't like it. It does not mean there's anything wrong with it.
    actually in my case too, i did not say it was wrong, i asked why it is better, and i just explained that i could not justify it.

    They are people. But that doesn't mean they like the same things as you do. People are different, accept that.
    i accept that.
    also even if they like the same thing as i do, they still may not like to share it with me anyway, since, for the most of it, they came to this board for an entirely different purpose!

    and about the coding styles, it's better that, i stop saying anything!

  4. #19
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,758
    In this context - recycle: v. to use again.

  5. #20
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,577
    Quote Originally Posted by manav View Post
    and about the coding styles, it's better that, i stop saying anything!
    You shouldn't manav. Just ignore him. Don't be afraid to ask anything even if some people in here are currently thinking too much of themselves to take the time and lay down an answer that doesn't involve calling you an ignorant.

    They are just forgetting that a little while ago they were the ones doing the questions and, more often than not, just like you, they didn't understand enough of the programming language to judge the relative value of these questions.

    Personally, the simple fact you are worried with coding styles, the presentational aspects of your code, and basic coding strategies, reveals to me you are in the right path. Ask away and try to filter what good answers you get and just ignore the rest of the self conceited noise. (An advise I not always follow, but wish I did.)
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  6. #21
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by manav View Post
    thanks Mats! yeah i know the example seems silly, but i have literally the same situation, where a function in one class, calls other function in other class, which calls another function in another class ... and so on!
    Um, yes. That's how structured programming works. The alternative is one monolithic function that does everything.

  7. #22
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Quote Originally Posted by Mario F. View Post
    They are just forgetting that a little while ago they were the ones doing the questions and, more often than not, just like you, they didn't understand enough of the programming language to judge the relative value of these questions.
    True. But shouldn't people learn from others' mistakes?
    Quote Originally Posted by Mario F. View Post
    Personally, the simple fact you are worried with coding styles, the presentational aspects of your code, and basic coding strategies, reveals to me you are in the right path. Ask away and try to filter what good answers you get and just ignore the rest of the self conceited noise. (An advise I not always follow, but wish I did.)
    Worried about what coding style to use is a good thing. Worried about what coding styles other people use is not so good anymore.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  8. #23
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by medievalelks View Post
    Um, yes. That's how structured programming works. The alternative is one monolithic function that does everything.
    There is of course a balance to be struck between making tiny functions that do almost nothing but call another function, and a huge function with thousands of lines in it. Functions should do something - not necessarily that much either, but there should be some work other than just calling another function [in most cases].

    In C++ you often find that a class calls a function in another class, which calls a function in another class, and so on. If all levels of calls here "do nothing but call the next level", one must ask if all these class levels are needed.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  9. #24
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by matsp View Post
    There is of course a balance to be struck between making tiny functions that do almost nothing but call another function, and a huge function with thousands of lines in it. Functions should do something - not necessarily that much either, but there should be some work other than just calling another function [in most cases].

    In C++ you often find that a class calls a function in another class, which calls a function in another class, and so on. If all levels of calls here "do nothing but call the next level", one must ask if all these class levels are needed.
    I agree with you here. If you've read Fowler's "Refactoring", he calls this particular one "Remove Middle Man".

    "Refactoring" is a must read for anyone doing OO programming.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 03-20-2009, 06:22 PM
  2. Coding Guideline ....!!
    By imfeelingfortun in forum Tech Board
    Replies: 8
    Last Post: 10-08-2006, 08:09 AM
  3. Before Coding
    By cyberCLoWn in forum C++ Programming
    Replies: 16
    Last Post: 12-15-2003, 02:26 AM
  4. Coding Contest....
    By Koshare in forum A Brief History of Cprogramming.com
    Replies: 46
    Last Post: 10-14-2001, 05:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21