473,385 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Classes in files

I have the following class structure and I'm wonder how best to put this
in seperate files/folders instead of all in one file. Thanks!

class A{
}
class A1 extends A{
}
class A2 extends A{
}
class A3 extends A{
}
class A1a extends A1{
}
class A1b extends A1{
}
class A1c extends A1{
}
class A2a extends A2{
}
Jan 29 '07 #1
3 1184
I have the following class structure and I'm wonder how best to put this
>
in seperate files/folders instead of all in one file. Thanks!
It does not really matter if you put each class in its own file or if
you group them in library files. It is just a matter of personal taste.

What I really avoid is mixing "free running" code with class or function
definitions. A file should either define something or run something. Not
both.

--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/
Jan 30 '07 #2
On Mon, 29 Jan 2007 23:52:49 -0800, Willem Bogaerts
<w.********@kratz.maardanzonderditstuk.nlwrote:
>I have the following class structure and I'm wonder how best to put this

in seperate files/folders instead of all in one file. Thanks!

It does not really matter if you put each class in its own file or if
you group them in library files. It is just a matter of personal taste.

What I really avoid is mixing "free running" code with class or function
definitions. A file should either define something or run something. Not
both.
That's a good point you make there.

It might be fine to keep all the sub classes in one file, if they're small
enough. Usually, it'd be better to minimize the amount of require and/or
include constructs used.

--
Curtis
Jan 30 '07 #3
Rik
Curtis <ze******@verizon.netwrote:
On Mon, 29 Jan 2007 23:52:49 -0800, Willem Bogaerts
<w.********@kratz.maardanzonderditstuk.nlwrote:
>>I have the following class structure and I'm wonder how best to put
this

in seperate files/folders instead of all in one file. Thanks!

It does not really matter if you put each class in its own file or if
you group them in library files. It is just a matter of personal taste.

What I really avoid is mixing "free running" code with class or function
definitions. A file should either define something or run something. Not
both.

That's a good point you make there.

It might be fine to keep all the sub classes in one file, if they're
small enough. Usually, it'd be better to minimize the amount of require
and/or include constructs used.
When on PHP5:
http://nl2.php.net/manual/en/language.oop5.autoload.php
--
Rik Wasmus
Jan 30 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Phil Powell | last post by:
Where can I find an online PHP form validator script library to use? I have tried hacking the one here at work for weeks now and it's getting more and more impossible to customize, especially now...
3
by: TheLetti | last post by:
Hy! I've just downloaded the latest Java 2 SDK (j2sdk1.4.2_01). For my surprise in this version the servlet-classes are not integrated (e.g. the class javax.servlet). So I found all the...
9
by: Aguilar, James | last post by:
I know that one can define an essentially unlimited number of classes in a file. And one can declare just as many in a header file. However, the question I have is, should I? Suppose that, to...
3
by: Javi | last post by:
I have some doubts about what is the best method to distribute classes in .cpp and .h files: - Should I use a file per class? or should I group similar classes in one file? - Is it good to put a...
2
by: joye | last post by:
Hello, My question is how to use C# to call the existing libraries containing unmanaged C++ classes directly, but not use C# or managed C++ wrappers unmanaged C++ classes? Does anyone know how...
11
by: Alex Maghen | last post by:
I love that I can create ASPX and ASCX files with CS code embedded or in code-behind files and ASP.NET will auto-compile it all for me. I *like* it that way Is there ANY way to have classes...
10
by: ptass | last post by:
Hi In asp.net 2.0 an aspx files .cs file is a partial class and all works fine, however, I thought I’d be able to create another class file, call it a partial class and have that compile and...
11
by: Sylvia A. | last post by:
How can I define global classes in web application ? Classes can be set to session variables ? Thanks
1
by: Swapnil Kale | last post by:
Hi, I'm working on a Migration project (Forte to JAVA). The forte client had a C++ dll which used to call one more FORTE dll for a complex database calculations. Now all the forte code has...
12
by: Nathan Sokalski | last post by:
I have several CustomControls that I have written for my project. However, when I try to compile I recieve the following warning & errors: Warning 32 Could not resolve this reference. Could not...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.