Refactoring - Manage Your Code and Layers
Refactory - Design Improvement of the Existing Code.
When I say Code Management most people tell me "I know exactly what I wrote... I know exactly where everything lays".
Well.. This sentence usually takes me back to when I was 6 or 7 years old. My mother used to tell me to clean and organize my room and that's exactly what I told her...:
"But mom... I love it when my soldiers are under the carpet, my school books are in the closet, my clothes are on my library and my shoes are where my action figures were.
I'm pretty sure most of you are nodding and agreeing with me.
But this is wrong.
Back to development then...
There are several file types that should be in a unique folder (for each) in every project:
1. JavaScript
2. HTML
3. CSS
JavaScript should not be inside "script" tag.
CSS should not be inside "style" tag nor inside the element it's affecting.
And HTML... Well... HTML should be on his own.
Now I want to talk a little about Classes.
In every language we write we should have different classes to achieve different functionality.
One of the most important Classes out there is the DB Layer - Data Base Layer.
Lets go over the basic terms:
The basic level is the GUI - Graphic User Interface - Meaning, what the user see and work with.
The GUI is basically the HTML and CSS (in website development).
After that, we have the Client side code - Scripts - JavaScript.
The JavaScript should usually be the one (or plain HTML elements "OnClick" attributes) to activate the code behind functions.
After a Client Side element calls a Server Side function - the function should preform it functionality. Meaning, run through the code.
In most of the cases, a large part of the functions involve calling the datalayer.
The Data Layer Class (or as I call it "DBLayer") contains all the functions that should call the database. Since we want a neat and tidy code, we wont write Select / Insert / Update / Delete / Drop inside the code.
This is not meant only for a clean code, this code moderation is basically for security reasons.
Example?
Lets say you have several projects that use the same data base. On one of these projects you have a friend working with.
Giving him full access permissions to Drop and Truncate Tables is not the best idea.
Eventually, the whole point of this post was to give a short explanation of how to correctly moderate your code. How it should be designed.
If your code isn't designed that way - That's the exact point of Refactoring..
Changing the design of the existing code without altering it's functionality.
Thanks,
Elad Shalom,
CTO at ITweetLive.com
When I say Code Management most people tell me "I know exactly what I wrote... I know exactly where everything lays".
Well.. This sentence usually takes me back to when I was 6 or 7 years old. My mother used to tell me to clean and organize my room and that's exactly what I told her...:
"But mom... I love it when my soldiers are under the carpet, my school books are in the closet, my clothes are on my library and my shoes are where my action figures were.
I'm pretty sure most of you are nodding and agreeing with me.
But this is wrong.
Back to development then...
There are several file types that should be in a unique folder (for each) in every project:
1. JavaScript
2. HTML
3. CSS
JavaScript should not be inside "script" tag.
CSS should not be inside "style" tag nor inside the element it's affecting.
And HTML... Well... HTML should be on his own.
Now I want to talk a little about Classes.
In every language we write we should have different classes to achieve different functionality.
One of the most important Classes out there is the DB Layer - Data Base Layer.
Lets go over the basic terms:
- DBLayer - a class containing calls for the Views or Stored Procedures in the database.
- Stored Procedure - SP - a function inside the database which designed to insert / update / delete / select from a table or from a number of tables. Stored Procedures can also return DataSet / DataTable / String / Int / DateTime according to specific parameters.
- Views - A View is a static query designed to be activated without any major changes (a view won't usually accept parameters. Store Procedure will).
The basic level is the GUI - Graphic User Interface - Meaning, what the user see and work with.
The GUI is basically the HTML and CSS (in website development).
After that, we have the Client side code - Scripts - JavaScript.
The JavaScript should usually be the one (or plain HTML elements "OnClick" attributes) to activate the code behind functions.
After a Client Side element calls a Server Side function - the function should preform it functionality. Meaning, run through the code.
In most of the cases, a large part of the functions involve calling the datalayer.
The Data Layer Class (or as I call it "DBLayer") contains all the functions that should call the database. Since we want a neat and tidy code, we wont write Select / Insert / Update / Delete / Drop inside the code.
This is not meant only for a clean code, this code moderation is basically for security reasons.
Example?
Lets say you have several projects that use the same data base. On one of these projects you have a friend working with.
Giving him full access permissions to Drop and Truncate Tables is not the best idea.
Eventually, the whole point of this post was to give a short explanation of how to correctly moderate your code. How it should be designed.
If your code isn't designed that way - That's the exact point of Refactoring..
Changing the design of the existing code without altering it's functionality.
Thanks,
Elad Shalom,
CTO at ITweetLive.com
fitflops shoes
ReplyDeletelongchamp uk
new balance shoes
fitflops
mont blanc pens outlet
louis vuitton handbags
rolex watches
michael kors canada
ghd hair dryer
cheap oakleys
birkenstock shoes
ralph lauren uk
kobe bryant shoes
kate spade bags
ed hardy
louis vuitton outlet online
north face uk
tiffany and co outlet
kate spade outlet online
coach factory outlet
coach outlet online
tory burch outlet online
canada goose outlet
coach outlet online
canada goose jackets
nike tn pas cher
pandora charms outlet
michael kors purses
true religion jeans outlet
michael kors handbags outlet
coach factory outlet online
cartier love ring
birkenstocks
20160723caiyan
true religion outlet
ReplyDeleteugg outlet
lacoste shoes
cheap ray bans
louis vuitton outlet
gucci outlet
polo ralph lauren outlet
true religion outlet store
coach outlet
michael kors canada
20161117caiyan
adidas nmd uk
ReplyDeletenike air force
air force 1
patriots jersey
yeezys
hogan outlet
michael kors
fitflops sale clearance
adidas ultra boost
fitflops
adidas originals tubular
ReplyDeleteadidas outlet store
nike air max
adidas yeezy
michael kors outlet clearance
the north face jackets
timberland store
ralph lauren outlet
hermes outlet
coach handbags
2017.3.15chenlixiang