473,796 Members | 2,618 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

String arrays vs Object based data structures

Some programmers prefer to stay with native level data structures such
as string arrays instead of using Object based data structures such as
ArrayList.

From and efficiency point of view. Are string arrays the most
efficient way of dealing with static tabular data such as query
returns? or is it more efficient to use a Recordset type data
structure using say ArrayList with a Record objects? (Pardon my JDBC
ignorance)

Personally, for business logic, I find that String arrays make for
much tighter and even more readable code as long as you use efficient
byte index constants. String arrays are also extremely portable when
porting code to and from other languages.

JsD
Jul 17 '05 #1
3 4854
I agree. I believe the arrays is your best choice, too.

"Java script Dude" <de********@yah oo.ca> wrote in message
news:86******** *************** ***@posting.goo gle.com...
Some programmers prefer to stay with native level data structures such
as string arrays instead of using Object based data structures such as
ArrayList.

From and efficiency point of view. Are string arrays the most
efficient way of dealing with static tabular data such as query
returns? or is it more efficient to use a Recordset type data
structure using say ArrayList with a Record objects? (Pardon my JDBC
ignorance)

Personally, for business logic, I find that String arrays make for
much tighter and even more readable code as long as you use efficient
byte index constants. String arrays are also extremely portable when
porting code to and from other languages.

JsD

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 5/22/2004
Jul 17 '05 #2
Liz
If your database returns only strings or if your app
only uses strings (for the purpose you plan to use them for)
and you don't change the strings (read only) then an array
of strings is easier to understand. But the implementation
of a string array is really a bunch of references (I think)
and the strings are actually on the heap. Well, ok, so is
the bunch of references.
"Java script Dude" <de********@yah oo.ca> wrote in message
news:86******** *************** ***@posting.goo gle.com...
Some programmers prefer to stay with native level data structures such
as string arrays instead of using Object based data structures such as
ArrayList.

From and efficiency point of view. Are string arrays the most
efficient way of dealing with static tabular data such as query
returns? or is it more efficient to use a Recordset type data
structure using say ArrayList with a Record objects? (Pardon my JDBC
ignorance)

Personally, for business logic, I find that String arrays make for
much tighter and even more readable code as long as you use efficient
byte index constants. String arrays are also extremely portable when
porting code to and from other languages.

JsD

Jul 17 '05 #3
based on what you said, i'm thinking it all comes down to the scope of
your objectives.... if your into the let's port mystuff to different
languages... ok....

however if you into making life simple for yourself, you'll take java
for granted and use it how it is meant to be used. since it's inception
it has gone thru tremdous lenghts to shelter your app from platform
dependencies... as for performance, let's get with it... unless your
have specs like processing 1,000,000 transactions per second don't worry
about using java, worry about using yee old vax/vms.....

i get so annoyed when some mixes performance issues with portability. if
you are writing "business logic" do not worry about writing "tigher"
code as much "manageable " code. allowing you to form business objects
using objects and not strings is what java is all about....

cheers

- perry

Personally, for business logic, I find that String arrays make for
much tighter and even more readable code as long as you use efficient
byte index constants. String arrays are also extremely portable when
porting code to and from other languages.

JsD



Jul 17 '05 #4

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

Similar topics

5
6762
by: Golf Nut | last post by:
I am finding that altering and affecting values in elements in multidimensional arrays is a huge pain in the ass. I cannot seem to find a consistent way to assign values to arrays. Foreach would clearly be the most efficient way to do it, but it only works on a copy of the original array and not the original (which is counter intuitive in my estimation). Using each doesn't work consistently either. Not only that, it's unduly complex for...
11
9274
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in C++. I find my self sometimes, trying Object app = Object(); Object *app = Object(); Object app = new Object();
33
3876
by: Peter Seaman | last post by:
I understand that structures are value types and arrays and classes are reference types. But what about arrays as members of structures i.e. as in C struct x { int n; int a; }
10
4997
by: David Fort | last post by:
Hi, I'm upgrading a VB6 app to VB.net and I'm having a problem with a call to a function provided in a DLL. The function takes the address of a structure which it will fill in with values. I get an error: ---------------- An unhandled exception of type 'System.NullReferenceException' occured in
94
4784
by: smnoff | last post by:
I have searched the internet for malloc and dynamic malloc; however, I still don't know or readily see what is general way to allocate memory to char * variable that I want to assign the substring that I found inside of a string. Any ideas?
64
3440
by: Zytan | last post by:
I know there are no pointers in C#, but if you do: a = b; and a and b are both arrays, they now both point to the same memory (changing one changes the other). So, it makes them seem like pointers. Can someone please explain why? thanks. Zytan
6
2381
by: rainy6144 | last post by:
Does the following code have defined behavior? double *new_array(unsigned n) { double *p = malloc(n * sizeof(double)); unsigned i; for (i = 0; i < n; i++) p = 0.0; return p; }
127
4930
by: sanjay.vasudevan | last post by:
Why are the following declarations invalid in C? int f(); int f(); It would be great if anyone could also explain the design decision for such a language restricton. Regards, Sanjay
182
4825
by: Bill Cunningham | last post by:
I understand this code. int a; int b; for (b=0;b<5;b=b+1) int a; This should take every element of the array a and set it to 1,2,3,4,5. Great. Now for the big question. How would you work this?
0
9531
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10459
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10187
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10018
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7553
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6795
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5446
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.