SitePoint Sponsor

User Tag List

Page 2 of 4 FirstFirst 1234 LastLast
Results 26 to 50 of 81
  1. #26
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    214
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Angry Coder
    Hello,

    I am wondering if it's a bad thing to create a large PHP app based on one file!

    What would be the cons & pros?

    Thank you.
    It is surely a bad thing if you do not separate design from deployment it should be a nightmare maintenance .

    But separation is not the aim at runtime but only at design, the aim at runtime is performance. When you compile a C++ program with hundred of files at the end you just have one file. If you use tools like UML modelers that would generate a script language like PHP the UML Modeler allows separation in design stage and could generate a single file if it was suited for best performance.

  2. #27
    Employed Again Viflux's Avatar
    Join Date
    May 2003
    Location
    London, On.
    Posts
    1,130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd be interested to see if a 20000 line application would run more efficiently when split up into multiple files and using include() (or similar) or dropping the whole damn thing into one file.

    If it's the latter, I may be tempted to create a parser that, after the application is complete and before uploading, strips out comments, whitespace, and replaces all include()'s with the actual code...

  3. #28
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by andrin
    How about collaboration in projects? Many developers working on the same file?!?

    <yoda-speech>
    Exists such an IDE I think not.
    </yoda-speech>
    <skywalker-rant>
    But master Yoda, what of SubEthaEdit?
    </skywalker-rant>
    My name is Steve, and I'm a super-villian.

  4. #29
    SitePoint Addict
    Join Date
    Nov 2003
    Location
    Malmoe, Sweden
    Posts
    265
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <yoda-speech>
    Clouded my judgement was... Impressive features this editor has but a full fledged IDE it is not. Also seems that only works for people that deep down fear real computers it does. And fear leads to anger, anger leads to hate, hate leads to...
    <yoda-speech>


  5. #30
    SitePoint Member
    Join Date
    Jun 2004
    Location
    USA
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i really prefer to take ANYTHING that's slightly more complex than a loop, or an if/then/else, and make a function or a class.

    that way after a few years, you end up with a large library of functions to call upon, and it makes every site you do that much easier.

  6. #31
    Non-Member Dan's Avatar
    Join Date
    Feb 2005
    Posts
    921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1mb = bandwidth killer

  7. #32
    SitePoint Evangelist CapitalWebHost's Avatar
    Join Date
    Apr 2003
    Location
    Albany, NY
    Posts
    417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Definitely bad just on the fact that it has to load the 1mb into memory each time it executes. Where as a properly segmented system would load only the parts it needs at that moment.

  8. #33
    SitePoint Zealot
    Join Date
    Oct 2004
    Location
    naperville
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dale_C


    Mind you, I do have about 6 classes in this file so I could probably re-structure it better. Also I think I've ended up re-writing a few methods because I sometimes forget I've already written a piece of code I also use a lot of white space as you can see in the screenshot, I like to separate each class, each method etc. so it's easier on the eye.
    You honestly dont have 6k lines of OOP in one file, with repeated methods? There are SO many things wrong with that.

  9. #34
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not really, just many many different functions a lot of which are handling some pretty complicated logic based on a multitude of different scenarios.

  10. #35
    get into it! bigduke's Avatar
    Join Date
    May 2004
    Location
    Australia
    Posts
    847
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dale_C
    Thats not 6k lines of code

    As for the organization problem, storing similar classes together in separate files or even a single class in a file like in java makes things so much better. No doubt it increases file I/O but wth you can't have EVERYTHING now ... can you ...

  11. #36
    SitePoint Member QuasiEvil's Avatar
    Join Date
    Nov 2004
    Location
    SF Bay Area
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Angry Coder
    Hello,

    I am wondering if it's a bad thing to create a large PHP app based on one file!

    What would be the cons & pros?

    Thank you.
    YES

  12. #37
    SitePoint Wizard Young Twig's Avatar
    Join Date
    Dec 2003
    Location
    Albany, New York
    Posts
    1,355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My largest file is around 300 lines. That's too big in my opinion.

  13. #38
    SitePoint Guru momos's Avatar
    Join Date
    Apr 2004
    Location
    Belgium
    Posts
    920
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My largest file is only 268 lines of code, but I must say: I don't comment inside my code. I keep that apart.

  14. #39
    Employed Again Viflux's Avatar
    Join Date
    May 2003
    Location
    London, On.
    Posts
    1,130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Obviously nobody's ever done any work with old COBOL files.

    There are COBOL source files with hundreds of thousands, likely even millions, of lines of code.

  15. #40
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    makes my 6,000 seem like nothing then

  16. #41
    SitePoint Guru momos's Avatar
    Join Date
    Apr 2004
    Location
    Belgium
    Posts
    920
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that is probably one of the reasons why COBOL is not often used for the web

  17. #42
    SitePoint Enthusiast matid's Avatar
    Join Date
    May 2005
    Location
    Knurow, Poland
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by krustie
    1mb = bandwidth killer
    When you execute the file on the server, it doesn't have to download it. It executes it and send to the browser (actual output takes your branwidth, not the code itself)

  18. #43
    SitePoint Addict
    Join Date
    Mar 2005
    Posts
    214
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by krustie
    1mb = bandwidth killer
    Performance is primary objective at runtime, I didn't see at first that it was about 1mb, obviously it would be bad for performance
    But separation of modules, layers and abstraction (using abstract class, inheritance etc) are primary objective only at design except if it is a functional objective at runtime because the client's specs require so.

    Even for compiled languages there is a known question about cost performance when creating abstraction layers sometimes one wouldn't do it for performance reason, this the same kind of question we have here: you must analyze the drawbacks in particular cases.

    For example the EJBs in Java are mostly criticized for the performance drawbacks though they facilitate scalability: scalability and performance are not the same objective often they contradict.

    For me a professional application developped in script should be using a development process similar to compiled language: instead of compilation, there would be a preprocessing phase which allows to include meta datas. In fact it is more the existence of meta datas for design that are important than the fact that the code are in one or separate file because with modern IDEs with stuffs like code folding you can easily navigate your code. Now if you develop with notepad that's a problem. As I use Notepad often myself indeed I really cut things into small pieces.

  19. #44
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by matid
    When you execute the file on the server, it doesn't have to download it. It executes it and send to the browser (actual output takes your branwidth, not the code itself)
    Exactly, but it puts more stress on the server at the same time. So, if you aren't on a stable server, then I wouldn't suggest putting more than 250-500 lines of code in one file.

  20. #45
    Massimiliano Bruno Giordano sid egg's Avatar
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    1,280
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by someonewhois
    My top is about 600 lines, and that's for a single class that just happened to have a massive task in front of it. The thought of having more than that is kind of sickening.
    Yeah, I'd explode having a 600 line single class.... Most of mine are readable on 2-3 screens worth (200-ish or less) .
    GamesLib.com - the slickest, most complete and
    easily navigatible flash games site on the web.

  21. #46
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sid egg
    Yeah, I'd explode having a 600 line single class.... Most of mine are readable on 2-3 screens worth (200-ish or less) .
    Yeah, it's definitely not something I'm proud of. I keep most classes 100-300 lines, but there are the occasional classes that work best longer -- and splitting them up is more trouble than it's worth.

  22. #47
    SitePoint Guru aamonkey's Avatar
    Join Date
    Sep 2004
    Location
    kansas
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just throwing out an opinion here, but I think that judging a script by the number of lines is pretty much worthless....file size is another thing.

    You could easily (although not quickly) write a 10,000 line php script that would load to a user's browser much faster than some 100 (or even 10) line scripts....

    The whole issue is readability when writing / editing these scripts and what makes these things the easiest for the person(s) actually writing the code....

    I think the most lines I have in any website page i've written is 700. but I use a LOT of line breaks and I also try to keep lines of code as short as possible, because when I actually have to go back and edit the script, it's 1000 times more readable to me. I don't like it when a single line of code soft-wraps to even 3 or 4 lines in my text editor.

    That said, I would never, ever, in a million years try to write an entire site entirely in one page, unless it was an extremely simple site.....mainly because I think I would have a heart attack upon seeing the error message "Parse error on line 100234".

  23. #48
    SitePoint Zealot ShytKicka's Avatar
    Join Date
    Aug 2004
    Location
    New York
    Posts
    120
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Worst idea ever. No benefits whatsoever, except what that one guy said, it would be easier to make backups of. But then again, the only backup you need, is the one you saved on your pc before you uploaded to the internet.

    Imagine how long it would take for uploading that 1 file everytime you made a puny change in it.

    Debugging would be hell.
    Organization would be hell.

    It would fail QA immediately to be honest with you. I just look at some of the software out there that does this, such as invisonboard and simplemachines, it's horrible. Those guys really have no idea what they are doing.

    Goodluck though.

  24. #49
    SitePoint Addict
    Join Date
    May 2005
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Angry Coder
    Hello,

    I am wondering if it's a bad thing to create a large PHP app based on one file!

    What would be the cons & pros?

    Thank you.
    Pros:

    - If you're using something like Turck MMCache, or e-Accelerator, this is the only file that would ever have to be cached. This would boost performance by a huge amount.

    - Only one file ever has to be maintained

    Cons:

    - Harder to find bugs
    - Less modular
    - On non-accelerated systems, it'll load EXTREMELY slowly.

  25. #50
    SitePoint Guru dbevfat's Avatar
    Join Date
    Dec 2004
    Location
    ljubljana, slovenia
    Posts
    684
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Etnu
    Pros:
    - If you're using something like Turck MMCache, or e-Accelerator, this is the only file that would ever have to be cached. This would boost performance by a huge amount.
    I disagree. Time taken to cache a few smaller files compared to one large is probably negligable.

    Quote Originally Posted by Etnu
    - Only one file ever has to be maintained
    This is not really an advantage, is it? If taken into account how much effort has to be put into the maintainance of a large file.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •