I have been taking some time and going over peoples sources.. and peoples modifications..
I would like to point out a few things.
OOP = Object oriented programming..
Quote from wikipedia
use constructors... Why do so many sources use functions as constructors...
Example..
this is just plain ignorance. Get out of your c++/delphi ways
Second thing.
STOP putting all your fucking handlers in 1 class in 1 file....
You have ways todo this.. 1 class handler per packet..
OR
Partial Classes! Take your pick!
Example
Third Thing
If else statements...
Dont use them if you dont need to.
doing
is just pure lazy and inefficient.. Use the CASE statement
Finally...
USE SEARCH!
STOP BEING SO LAZY PEOPLE AND CODERS MAY HELP YOU! AND THIS COMMUNITY MAY JUST MAY GET BACK ON TRACK!
I would like to point out a few things.
OOP = Object oriented programming..
Quote from wikipedia
This means 2 very big things you guys seem to get the grasp.Quote:
Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which are data structures that contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods. A distinguishing feature of objects is that an object's procedures can access and often modify the data fields of the object with which they are associated (objects have a notion of "this"). In object-oriented programming, computer programs are designed by making them out of objects that interact with one another.[1][2] There is significant diversity in object-oriented programming, but most popular languages are class-based, meaning that objects are instances of classes, which typically also determines their type.
use constructors... Why do so many sources use functions as constructors...
Example..
Code:
var actionpckt = ActionPacket.Create(); ??????? or var actionpckt = new ActionPacket().Create(); ??????????
Code:
var actionpckt = new ActionPacket(); //Clean and simple
STOP putting all your fucking handlers in 1 class in 1 file....
You have ways todo this.. 1 class handler per packet..
OR
Partial Classes! Take your pick!
Example
Code:
Action Handler.cs
public partial class PacketHandler
{
public void ProcessAction(params)
{
}
}
Item Handler.cs
public partial class PacketHandler
{
public void ProcessItem(params)
{
}
}
Third Thing
If else statements...
Dont use them if you dont need to.
doing
Code:
If (packet.type == xxxx)
{
}
else
if (packet.type == xxxx)
{
}
Code:
switch (packet.type)
{
case xxxx:
{
PacketHandler.ProcessAction(packet);
}
case xxxx:
{
PacketHandler.ProcessItemUsage(packet);
}
}
USE SEARCH!
STOP BEING SO LAZY PEOPLE AND CODERS MAY HELP YOU! AND THIS COMMUNITY MAY JUST MAY GET BACK ON TRACK!