
|
View Full Version : Does programming help you ease off your tensions ?
Energizer Bunny 11-10-2009, 02:11 PM hi,
I love programming ! Been building scripts now for php in raw php format :blush: not an expert at php yet, but whenever i am building a system it makes me fell good when something that is not working i get it to work and devising new evil ways to do what you want to achieve :D.
how many of you feel that while programming you feel better and excited about getting project completed ?
Adam-AEC 11-10-2009, 02:51 PM I find I enjoy the problem solving aspect of developing more than anything else.
mattle 11-10-2009, 02:53 PM I only get excited about a project coming to completion if it's been a particularly grueling process. As far as personal edification, that happens in discrete moments during the course of a project when I either (a) uncover some fundamental truth of which I was previously unaware or (b) I surprise myself with a particularly ingenious solution to a problem.
Honestly, I could care one way or the other about project completion (although the people who sign my paychecks are rather effective at getting me to care ;)). There's always another project waiting in the wings. I've always been in this for the personal challenge, and overcoming those is my real source of joy.
stahightech 11-10-2009, 03:31 PM I don't know how much getting a project completed excites me, but I do enjoy the overall process of creating something from scratch. From a psychological perspective, I guess it is important for me to see a project completed. It brings a feeling of accomplishment.
I also enjoy coming up with an elegant solution to a complex problem, as well as the teamwork aspect of this field. Working with smart people, from varied backgrounds, who approach problems a little differently than myself, has been quite an experience.
energizedit 11-10-2009, 03:58 PM Programming is a bit like solving a puzzle. It is very satisfying when you find a solution to a problem, using your own know-how.
Mark
PhaRule 11-10-2009, 03:58 PM lmao - of course it does.
it's like everything else, if you have time to kill, and a goal to set your sights on, there is nothing like coding!
if you like linux, learn bash scripting! so helpful!
on top of all that, learn the most common languages! php/perl/asp/(x)html/c++/vb - once you learn all those, not alot that can hold you back!
plus, you can get a good job and get lots of cash :P
jcook6924 11-10-2009, 04:46 PM the only problem i have with coding is when i try to fix or create something and then my lack on knowledge prevents me from fixing or creating it.
Now that is the most frustrating!
Energizer Bunny 11-10-2009, 07:48 PM does anyone else hate it when they try to figure out someone else's code ? I am in a job where i have nothing but issues with what the other person wrote :(
BurakUeda 11-10-2009, 08:12 PM does anyone else hate it when they try to figure out someone else's code ? I am in a job where i have nothing but issues with what the other person wrote :(
Tell me about it!
For 5 months I was working on an old version, highly-and-badly customized osCommerce. It was a nightmare.
Couple of days ago at least I convinced the boss to build our own system from scratch.
bizness 11-10-2009, 08:14 PM i think programming gets me a bit on edge... i do enjoy ruby these days...
as far as relaxing, i rather drive with the top down at 100mph.
Energizer Bunny 11-10-2009, 08:28 PM Tell me about it!
For 5 months I was working on an old version, highly-and-badly customized osCommerce. It was a nightmare.
Couple of days ago at least I convinced the boss to build our own system from scratch.
I doubt u know how i feel :( its been a year or more now, and everytime someone wants a change and after weeks if not months i figure out which file to modify (over 500 files with hundreds of functions/classes with zero documentation) , guess what happens ? 10 new things break cause of that one little change :D
I doubt it even the original guy will understand what he did anymore if he was to work on it again.
mattle 11-11-2009, 10:46 AM I once spent about two years (unintentionally) following the same hack from job to job. By the end of it, I was so used to fixing this guy's scripts that I could recognize his work on sight and had a procedure that was all but documented because I knew where all the holes would be!
It is irritating. Generally, unless it's some sort of modular code (function class/framework) that's operating well on it's own, I'll just start over from scratch. I find in the long run I save more time doing that than deciphering.
GregVernon 11-11-2009, 11:59 PM I doubt u know how i feel :( its been a year or more now, and everytime someone wants a change and after weeks if not months i figure out which file to modify (over 500 files with hundreds of functions/classes with zero documentation) , guess what happens ? 10 new things break cause of that one little change :D
I doubt it even the original guy will understand what he did anymore if he was to work on it again.
500 files?! Holy Smokes!
To answer the topic question: Lately coding has been the cause of tension in my life.
Energizer Bunny 11-12-2009, 01:46 AM 500 files?! Holy Smokes!
To answer the topic question: Lately coding has been the cause of tension in my life.
Yaa probably 500+ files, 1 file has like 2 functions and they connection to like 3 other files individually like crazy !!
Hmmmm coding cause of tension i can see when its not working good or you do not have enough time to do enough coding and troubleshooting :(
IslandWave 11-13-2009, 04:35 PM I once spent about two years (unintentionally) following the same hack from job to job. By the end of it, I was so used to fixing this guy's scripts that I could recognize his work on sight and had a procedure that was all but documented because I knew where all the holes would be!
I've had a similar experience following up a local VB coder who thinks he knows C++ but that's still not as bad as trying to follow a sloppy PHP or PERL scripter. I've seen PHP code that made me want to pull my hair out.
Energizer Bunny 11-13-2009, 04:53 PM I've had a similar experience following up a local VB coder who thinks he knows C++ but that's still not as bad as trying to follow a sloppy PHP or PERL scripter. I've seen PHP code that made me want to pull my hair out.
O yaa coding is fun but the people around you at times make me pull out my hair and their attitude.:mad:
LifeSteala 11-13-2009, 05:36 PM Definitely! I've been programming with PHP for about 4 to 5 years now. Have always loved programming as it was a passion I quickly realized when I was young. I get into a great zone when I am on a roll and it really does release my stress levels. There are a few occasions where it gives me a headache, but I take this as a challenge and overcome it.
It is very satisfying to solve complicated problems.
alias454 11-18-2009, 09:44 AM I think if you look at code as an art form, a way to express yourself you could enjoy it. If it is just a way to make a buck then maybe not so much.
I get great satisfaction when I solve a problem and make something that is useful in the process. I also have times when I wish I was a dishwasher but I know when a problem is hard that is when it teaches me the most, I look forward to the difficult problems when they arise. Exceeding our own limits and stretching ourselves gives a satisfaction that is hard to explain.
Regards,
Brandon
Energizer Bunny 11-18-2009, 11:49 AM K u php gurus i code simple php and dont use functions or build functions and stuff, is that good or i should do more php coding with functions ?
Programming isn't relaxing but it is fun! and great when it works.
HostBill 11-18-2009, 03:54 PM Programming isn't relaxing but it is fun! and great when it works.
Well said. I find myself mentally exhausted somedays - it is hard to being 100% focused about 5-6 hours a day, and effective programming can only last this long during day [ rest of work day for experienced programmers is scratching head, drinking cofee, and fixing same code 3times ].
At the beggining it might looks different but this is hard job - but sure is very fun. Creating anything which at the end works in every discipline gives lot of satisfaction.
K u php gurus i code simple php and dont use functions or build functions and stuff, is that good or i should do more php coding with functions ?
Learn OOP basics - sooner you'll switch to objective programming the faster you'll become good at solving advanced problems - in any language, because its like sb mentioned before - if you know few languages learning new one is really fast.
mattle 11-18-2009, 05:59 PM K u php gurus i code simple php and dont use functions or build functions and stuff, is that good or i should do more php coding with functions ?
I'm sure you use functions. If your code has any parentheses in it, then there's a good bet you do...
I would absolutely learn how to write functions, including learning about variable scope. Then move up to OOP. It's the difference between re-using code and re-writing code!
Jakoota 11-24-2009, 07:43 PM Have been programming for many years now, and it's definitely a love-hate relationship. I love the satisfaction of finishing a project, or getting a piece done that may have been difficult or I didn't know how to do at first. But sometimes (I find this happens a lot with C...ugh) just come across issues that keep you racking your brain for hours and then the solution turns out being so incredibly simple - I hate that :( heh.
-edit-
Learn OOP basics - sooner you'll switch to objective programming the faster you'll become good at solving advanced problems - in any language, because its like sb mentioned before - if you know few languages learning new one is really fast.
I don't think learning how to program in an object oriented way will somehow help in solving advanced problems any more than programming in a procedural or functional manner would. It may, however, provide for cleaner code with more reusability and better factoring, etc...
That's not to say you shouldn't learn it :P I love OOP :)
Energizer Bunny 11-24-2009, 09:18 PM I don't think learning how to program in an object oriented way will somehow help in solving advanced problems any more than programming in a procedural or functional manner would. It may, however, provide for cleaner code with more reusability and better factoring, etc...
That's not to say you shouldn't learn it :P I love OOP :)
How tough is this OOP thing of a jiggy ? Do i have to learn how to write private and public classes and how the variables and functions within them work ?
what confuses me is what does $this->something; actually do ?
What is "this" say in below ? Variable or object or something else ?
$this->cvars[$cvars[$i]]
e-Sensibility 11-24-2009, 09:54 PM Learn OOP basics - sooner you'll switch to objective programming the faster you'll become good at solving advanced problems - in any language, because its like sb mentioned before - if you know few languages learning new one is really fast.
OOP is a style. Anything you can achieve using the OO paradigm you can achieve using the Procedural paradigm.
Jakoota 11-25-2009, 06:15 AM How tough is this OOP thing of a jiggy ? Do i have to learn how to write private and public classes and how the variables and functions within them work ?
what confuses me is what does $this->something; actually do ?
What is "this" say in below ? Variable or object or something else ?
$this->cvars[$cvars[$i]]
The key with OOP is that, each "class" is (generally) self-sustained and independant of other code. A class can be instantiated (think of it as giving the code its own little world to work in, and giving a name to that world so that you can access it).
In PHP, when you do $this->[some var name here], you are saying you want to access the current objects variable named [some var name here]. That is, you want to access the variable from your own 'world'.
So if you have a class, say... (and sorry but my PHP is quite rusty so might not be 100% accurate)
class ImaginaryWorld {
var $population;
function getPop() { return $this->$population; }
function setPop($value) { $this->$population= $value; }
}
You could instantiate a copy of that class, into an object as:
$newWorld = new ImaginaryWorld();
or
$myWorld = new ImaginaryWorld();
Now if you look at the class definition above, you'll see that inside it's curly braces {...} we've defined 3 things. A variable, $population, and 2 functions.
The two functions are pretty simple. You have getPop() which says "return the value of the variable $population in THIS world" and setPop() which says "set the value of the variable population in this world to the parameter given, $value."
Now the cool thing about this is, it's now a reusable structure. That is, we can do something like this:
$newWorld->setPop(5000);
echo $newWorld->getPop(); // displays 5000
$myWorld->setPop(10000);
echo $myWorld->getPop(); // displays 10000
echo $newWorld->getPop(); // still displays 5000
The two are independant of each other, and the code can be reused. We have a nice self contained definition of our "imaginary world" which, for each instance, can have its own population :)
This is just a simple example...you'll want to look up tutorials or something for more :P
*edit* err and sorry for somewhat hijacking the thread...
mattle 11-25-2009, 10:24 AM You can look at PHP's stdClass object for a very simple example of a class and to get an understanding of an object-member relationship.
Energizer Bunny 11-25-2009, 10:49 AM @Jakoota Interesting last 2 days i been working with a code that was classes, now the code you posted looks similar in structure, with the difference that the class file or the class itself used
public function name ()
and private function name ()
however you are just using function name() within that class ? So putting no public or private in front by default, defaults to public ??
And what purpose does private function within a class would serve ? Does it increase speed ? or is it some security measure ?
Same with the var = $population; part, there was public and private vars ! Now can they within the class be used interchangebly that is private var used in one the private functions within that class ? or do you have to have public function using public variable only ?
mattle 11-25-2009, 12:33 PM however you are just using function name() within that class ? So putting no public or private in front by default, defaults to public ??
Yep. But I find it helps my sanity to declare them as public anyway.
And what purpose does private function within a class would serve ? Does it increase speed ? or is it some security measure ?
Same with the var = $population; part, there was public and private vars ! Now can they within the class be used interchangebly that is private var used in one the private functions within that class ? or do you have to have public function using public variable only ?
Nope. public/private/protected declarations regard the member's scope. I'll avoid dealing with protected functions and inheritance for the moment, but here's a basic demonstration of public/private implementation:
class A
{
private $var;
public function setVar($newVar) { $this->var = $newVar; }
}
$a = new A();
// legal usage
$a->setVar(4);
// illegal
$a->var = 4;
What's happening here is that because $var is a private member, you cannot access it directly out of the scope of the class declaration. However, other member functions of the class (such as setVar) may access the private member.
You can set it via setVar() because setVar is declared to be public.
Jakoota 11-25-2009, 06:54 PM Like I said, my PHP is rusty :P School has had me using java, C, python, prolog, and hell if I remember what else for so long heh.
The intention with my code was to have population as a private variable, and the get/set functions as public methods. This way, you can do all sorts of other fancy stuff inside those functions when you want to set the variables value, if needed/wanted.
So for example, you had a population variable but when it was set you wanted to also set the percentage of male to female population in other private variables. You would want the population variable to be private because otherwise, if someone were to modify it directly the other variables will not get set properly. However, for the example I gave in my previous post it may be perfectly fine to just have the population variable be public and let it be modified that way.
There's probably a convention for how PHP coders like to do it but I'm not aware of what it is... Like in C# its generally accepted to just expose the variable as public, but in Java people prefer to use getter/setters.
Also, just to clarify on scope...going back to my "world" analogy - if you are actually inside the world (you are a method inside the class) you can access anything inside the class regardless of if it's set to public, private, etc... If you are outside the world and are accessing it by the name you have given it, you can only access the public methods or variables.
ranjitkgupta 11-27-2009, 05:42 AM Programming is the best thing that has ever happened in my life. Creating an application and making it behave the way you want, writing block of codes and actually seeing it work fascinates me a lot.
rcallaghan 11-27-2009, 06:33 AM I find when I listen to music whilst coding it's really soothing and "enjoyable"
Codebird 11-27-2009, 07:30 AM Yeah it does, it is so enjoyable especially when u're working on complicated stuff
|