Jump to content

Recommended Posts

Posted

Designatix answered you but it's not only this thing.

Imagine this topic in marketplace section with these bugs inside ;)

Also there are many shares that deserves your question and not mine for sure :P.

I'm gonna update it to be completed and reshare it

Thank you for your good words my friend!

i love your idea, i always try to do new things (but since i'm newbie on java i can only imagine them xD) so it's good to see new things. I'll be waiting for the update :D

Posted

i love your idea, i always try to do new things (but since i'm newbie on java i can only imagine them xD) so it's good to see new things. I'll be waiting for the update :D

if you can imagine ( that is good ) just try to write it ( is not so hard ) 

 

Designatix answered you but it's not only this thing.

Imagine this topic in marketplace section with these bugs inside ;)

Also there are many shares that deserves your question and not mine for sure :P.

I'm gonna update it to be completed and reshare it

Thank you for your good words my friend!

is not so bad ( drama ) ... just need 1 simple rework 

Posted

if you can imagine ( that is good ) just try to write it ( is not so hard ) 

Well, it's not that easy, my ideas are not that simple for a newbie to make them..

Posted

Can't get it, so you're saying that few unnecessary calls that give you a dummy empty list are cleaner than nullptr ? Its obvious that this emptylist should be used on other cases but here? Explain me why this is worst and I will go to fck off right away

 

final ArrayList<Coupon> coupons = getCoupons(player);

if (coupons == null)

{

     //msg and exit

}

{

else

{

   for (Coupon c : coupons)

        c.something();

}

 

if getCoupons returns empty list instead of null, the flow of the rest code is dumb and nonsense. null checks are as fast as 1 == 1

 

I personally believe (and most ppl on the internet, so far, since the time I checked it) it's not to the developer to care about null behavior. Or at least, as low as possible.

 

An empty list for looping does nothing, since it iterates on nothing it doesn't reach internal content of loop. The overhead is minimal.

 

It's just cleaner code-wise and in the developer's mind, you are sure you won't face any null, anywhere, anytime. So building new methods associated to such empty container become "easier".

 

Performance-wise, you win almost nothing using null since you call a static list (and what would be heavy with my method is the creation of the list).

 

But well since you explained you see it as a "error" and not an "exception" (so far it's called NullPointerException, not NullPointerError :D), what you say is correct, for yourself. If you seek on the internet the "standard" behavior, however, it's not that. After it's personal preferences, personally when I see a null I drop it, it remembers me the dark age of L2JIL where everything was tested using null, even if not needed ; so you were losing tracks of what could be null and what couldn't.

Posted (edited)

Imagine this topic in marketplace section with these bugs inside ;)

 

Most of shares made for L2JFrozen so far (with all due respect for sharers).

Edited by Tryskell
Posted (edited)

One interesting thing to add : grade type is counted as part of reward list. That way your system works even for low/mid rates servers.

 

Grade could be written on coupon in order player doesn't accumulate them when he reach lvl 80 (so a grade C coupon will still be a grade C coupon).

 

Obviously you have to write more reward lists :D.

 

Another thing : create a specific HTM for no coupon behavior (instead of the 20 non clickable "+").

Edited by Tryskell
Posted (edited)

I personally believe (and most ppl on the internet, so far, since the time I checked it) it's not to the developer to care about null behavior. Or at least, as low as possible.

 

An empty list for looping does nothing, since it iterates on nothing it doesn't reach internal content of loop. The overhead is minimal.

 

It's just cleaner code-wise and in the developer's mind, you are sure you won't face any null, anywhere, anytime. So building new methods associated to such empty container become "easier".

 

Performance-wise, you win almost nothing using null since you call a static list (and what would be heavy with my method is the creation of the list).

 

But well since you explained you see it as a "error" and not an "exception" (so far it's called NullPointerException, not NullPointerError :D), what you say is correct, for yourself. If you seek on the internet the "standard" behavior, however, it's not that. After it's personal preferences, personally when I see a null I drop it, it remembers me the dark age of L2JIL where everything was tested using null, even if not needed ; so you were losing tracks of what could be null and what couldn't.

 

Most of shares made for L2JFrozen so far (with all due respect for sharers).

 

One interesting thing to add : grade type is counted as part of reward list. That way your system works even for low/mid rates servers.

 

Grade could be written on coupon in order player doesn't accumulate them when he reach lvl 80 (so a grade C coupon will still be a grade C coupon).

 

Obviously you have to write more reward lists :D.

stop the drug plz or change simple yous first message ... why you need 3 message ? you talk alone ?

Edited by pirama
Posted

Tryskell, Pirama, with all respect guys, please don't start this flame and here. Respect Merlon's share.

 

Thanks!

ah Baggo You Don't Know What Real Love Means,This flame is just love :D 

 

on Topic nice idea melron thanks for share

Posted (edited)

ah Baggo You Don't Know What Real Love Means,This flame is just love :D

 

on Topic nice idea melron thanks for share

hahahah pirama love you re, more than Tryskell. :o 

 

Merlon thanks for this share mate.. It's a fresh idea.  :1010:

Edited by 'Baggos'
Posted

On the other hand if coupons were empty you dont even need to check.

All you do is:

 for (Coupon c : coupons)

        c.something();

 

No null checks, no NPE possibility, safer and cleaner code.

And if you seriously look at me in the face and tell me that returning null and checking it for performance reasons is better then you are not as smart as i thought you were.

 

idk how java optimizes empty list or empty loops, I don't even think it does, I always prefer nullptr due to the fact that things are straightforward once you have it. Imagine storing it somewhere and having to check if the character has any coupons, personally I prefer coupons == null than a dumb list.isEmpty() on an immutable empty list, I believe this case is just coding style, but my C background forces me to go with nullptr.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...