Moral support from other coders...
So I've been working on this big coding project for a web based app mostly using PHP & a nice robust framework.
I've been building it for quite some time & it was going well until recently, when I started weaving everything together & it all started falling apart & getting ridiculously impossible to debug.
I've sort of coded myself into a corner, and I've realized I need to rewrite significant portions of it to deal with error/exception handling & correction, dependency injection, static facades, and interface abstraction.
This, apparently is what happens when you code big stuff using advanced frameworks without really understanding how to properly structure the code for proper long-term, complex/modular interactions, and without understanding how error & exeception handling really works in the language & framework you're using.
A bit of hacking & clever coding doesn't, apparently, prepare one for the realities of coding a large app from the ground up using an OOP structure & framework.
Meh.
Live & learn.
I just feel so stupid for not catching onto this stuff sooner.
Hell, it took me all day Wednesday just to wrap my head around the whole thing and understand how & why all this stuff is so stupidly important, and how I would deal with all of it, and that's after spending most of Tuesday groping towards the fact that my problem was much, much bigger than just passing errors between classes & dealing with uncaught execeptions, and a few hours on Monday trying to figure out how to pass errors between classes effectively before realizing that I needed to rethink that whole process & giving up for the day, but not before fubaring a bunch of my classes with extraneous error handling crap which won't work at all.
Two days completely lost, just trying to figure out how I had gone so wrong, and what needs to be done to correct it.
Now I have to somehow summon the enthusiasm to actually rewrite & add to & fix & figure out all this stupid friggin' code, but I feel like such a moron & it's just so much!
Have to go over the whole thing and redo it, every single controller & model, and add stuff for all of that.
I know some of you folks out there have made mistakes just as egregious, right?
At least tell me I'll get it together & it'll be alright, 'cause right now I'm kinda freaking out.
Don't be so hard on yourself. If you are teaching yourself then this is how you learn. Sounds like you have learnt a great deal already. You started off with one understanding of how to create the app but now you have learnt some more and need to revise your thinking. This is not a mistake, its not a waste, its not stupid, its progress.
You didn't lose the two days, they were spent exploring an avenue that is now redundant.
It will all be fine because you clearly have the ability and enthusiasm to make it so.
Post back and let us know how it goes.
What are you using for the versioning? Just beginning to code myself so I'd be interested to know.
Thanks for the support, I really appreciate it.
Actually, those two days were extremely productive in that I learned a ton about PHP & Laravel, the framework I'm using, and I actually did manage to find the answers I needed, it's just that they indicate a complete overhaul of the whole damned thing is now necessary.
I was referring to them as lost in terms of time spent learning instead of working, which translates to money lost. :/
However, I do appreciate your candor.
I'm pretty much entirely self-taught, especially with all this web stuff I've been doing lately, and this is the biggest, most complicated thing I've ever built, coding wise anyhow, so I guess you're right to some extrent that I shouldn't be so hard on myself for my ignorance.
It's just that I knew I was missing a bunch of stuff about both PHP & Laravel, but I figured it'd be ok since I'd always managed without knowing all that stuff before.
Man, was I naive, and stupid, for not learning a lot of these things a long time ago.
I mean, I didn't even understand how PHP's exception handling worked, and I'm still a little fuzzy on the errors, which is ok for now since Laravel converts them to exceptions which I know how to deal with now, but I'm always like that, only ever learning what I need at the moment, never really looking into things too closely if what I have already works.
It's not a good way to learn, always the hard way, but for me, it's the only way that seems to work.
Actually, in a way all that research & reading was good for me (if terribly frustrating since I didn't really get the answers I needed about why things should be done the 'right' way until the very end of my research) since I picked up a much deeper understanding of PHP & coding in general & Laravel specifically along the way that I wouldn't have otherwise which is likely worth the time it took to get it and then some.
Versioning... *sigh*
I should be using Github or something, I have an account & have used it before for other projects which other coders need to be able to see.
I'm terrible at using stuff like that, though.
The idea of having all those records of my past screw-ups is extremely aversive, and as I'm working alone on this at home in my own little local LAMP environment I just zip the whole thing & export the database every now & again when I get to a decent stopping point.
I should probably use a better method, but you're talking to a guy who hand codes PHP, HTML, JS, and CSS in a glorified color-coded text editor with no debugging or step-through or previews or anything like that.
It's not even because I'm so good I don't need one or anything (clearly not true), but because I find programs like Dreamweaver & other debuggers, previewers, and step-through programs too confusing to figure out and as they haven't been strictly necessary yet (apparently my lower threshold for learning stuff that I find confusing) I stick to what makes sense to me & works.
The point is, I abide by the KISS philosophy: Keep It Simple Stupid.
If it works, I use it, until it doesn't, and then I have to go learn more stuff or find another way.
Sorry for the rambling reply.
So... What kind of coding do you do/have you done/are you interested in?
I really do appreciate your response & kind words.
Also, since that seems to have been your first post here:
Welcome to WP!
Thanks for the welcome. There isn't a UK-based site like this, so here I am.
I'm a network analyst with a Unix background so I've been butchering other people's scripts for a good while. I've installed a few LAMPs at work but not done any coding for them.
I decided to learn how to make Android apps. I've done a MOOC course and have another one lined up. I installed Eclipse and started to use Github for that course but its still new and scary.
I'm interested to hear about how you learn, because its how I learn - grab the bits that are meaningful now and drop everything else on the floor. I found this article which goes a long way to explaining why that is and helped me stop trying to learn like the NTs:
brainhedotcom?documents?TheHolistManifestoApril2011Word97dotdoc
Please put www in front and swap the question marks for slashes and put in a full stop where its says dot -I sorry, had to put them in as it won't let me include URLs in my posts yet
Ha!
There was a good HuffPost article the other day about how coders shouldn't 'throw their code over the wall' or they'd risk it getting mangled by people like you.
Good thing I've got Unix & Linux experience going back almost a quarter of a century and more recent qausi-sysadmin experience dealing with a dedicated hosting server & so I know how to deal with most of the configuration & other details coders often know very little about.
That, and having my own Linux box keeps me on my toes & current.
Java, nice!
I've considered learning it.
I've already got most of the Android dev suite because I use adb for port forwarding so I'm able to tunnel to my Android's unlimited data connection using OpenVPN & a 3rd party app which sets up an OpenVPN server on the phone.
It's been a long time since I learned a compiled language though, and the software, hardware knowledge, and understanding of display & input parameters & such have always been a bit beyond what I've ever learned.
Not to mention that this mostly PHP based project is the first really in depth OOP thing I've ever coded, and it's certainly the biggest.
Always been more of a low-level guy, a hacker, a debugger, a fixer.
Never wrote much of my own code because I knew that someone had already written anything I'd ever think of (I'm not really creative in that way), and probably did it better, and so why write my own when I could just use and/or hack theirs for my needs?
I suppose you could call me lazy in that I rarely do anything that doesn't seem like it must be done, especially if it not being done isn't bothering me too much & it's not strictly necessary for anything I'm doing, need, or want.
Just as true for the rest of my life as for coding, unfortunately.
Still, give me a project to do, pay me a few bucks, and watch me learn how to do just about anything.
Of course, it'll usually be the simplest, most direct & least complicated way I can think of doing it, but that's just how I roll.
As far as my learning style goes, I suppose it's complicated.
Though I never saw the numbers it's been aserted by more than one mental health professional that I have a genius level IQ (140s, maybe 150s), and the reactions of people who apparently did see the numbers when I was in school seem to bear that out.
I'm very, very smart, I learn many things extremely quickly & easily, my reading comprehension scores off the charts, and I'm great with numbers, math & straight logic.
No one ever even imagined calling me learning disabled, even though my handwriting & drawing skills are roughly on par with that of a drunken 3-year-old (I hear it's called dysgraphia, never heard of it before coming here though), I can't relate numbers & symbols to pictures except by graphing them point by point & I can't relate them to sound at all even tough I know those relationships exist, they just don't for me.
Also, I'm not creative in terms of comming up with my own ideas for systems & settings & such, but within a given system/setting I can be extremely creative.
Some things, however, I seem to have a lot of trouble with.
I find complicated software programs with lots of options & built in helper & structural type functions extremely confusing and am rarely able to use them as effectively as others or even in some cases at all.
Many abstract structural, procedural, and mechanical concepts are impossible for me to understand without concrete working examples which clearly demonstate to me the principles involved.
Even then, my ability to deliberately picture & understand abstractly described 2 & 3 dimensional interactions is almost non-existant, except in the boardest terms.
Weirdly, I'm pretty good at 3d puzzles, because my subconscious is able to find the patterns even though I usually can't consciously visualize them.
Generally speaking uderstanding is reached for a lot of this stuff through proof of concept rather than sudden internal realization.
I see it, it clicks into place, and I understand it.
Until then, it tends to remain amorphous and not well defined.
So even when I pick things up, which I do naturally because my mind tends to absorb potentially useful abstract information (almost never names, dates, or places, or generally anything that specifically defined unless there's a story involved) related to things I already know, that knowledge is only, to me, a theory until I see it in action & thus can understand it.
When I learn, then, especially abstract stuff like coding information, I really only learn by seeing a decently real example, and even then I ofen test it in various ways to make sure I understand what I'm looking at and that it actually works.
So though I definately picked up a bunch of things related to but outside what I needed to know regarding both PHP & Laravel, I'd look those things up again before I'd ever even try to use them, if only to make sure I remembered the function name, parameters, and functionality/response correctly, even if I was certain that I did, and then I'd run a test or two on it to make sure it worked the way it was supposed to, even though I expect it to.
It's compulsive, I suppose, the need to see to really remember & understand.
As an example of this sort of thing: babies, in general, have trouble with fitting the star peg to the star hole, but if you point at the peg and say 'star' they'll generally put it right in the hole because the name makes it less amorphous & more real for them allowing them to see the similarity of the shapes clearly where before it was just a confusing spiky, blurry thing that didn't seem to fit anywhere.
In a way, its like seeing it in action names the abstract relationship for me, except in my case all solidified concepts, ideas, and even people, in my mind each one has its own, feeling is the best word I've been able to find for it but it misses the mark, but yeah for our purposes here imagine that each has its own feeling to it which actually both contains & represents my entire gestalt perception & knowledge of & about whatever it is, but that feeling doesn't generally crystalize without a catalyst, a story, a particular impression made that reifies it, or with things like code, a real working example and preferably some working tests of my own to confirm it & really drive its reality home to me.
For things like perople that feeling is sometimse linked to an abstract image of them which is also part of the gestalt, but thats' almost never the case with the more abstract stuff with is just a feeling-gestalt thingy.
So you might describe my process of learning concepts I don't immediately just understand/pick up (which covers a fairly large range of things these days as it turns out) as one of reifing reality into feeling-idea-gestalts, often through direct demonstration and application.
I'm not sure if that helps or is interesting to you at all, and I apologize if I seem at all boastful about my intelligence, as that was not my intention.
Interesting article, and I find that the idea of external gestalt perceptions being avoided in favor of simpler details by autistics is accurate enough as far as it goes, though given my internal understandings are all gestalts, I think that it's probably only true for deliberate conscious learning & perceptions but that, for me at least, my subconcious mind is often, though certainly not always, aware of most of the gestalt & is able to find patterns and discern information from it which is not entirely lost or inaccessible to my conscious mind as there seems to be less of a barrier between the two for me than for most other people.
It chatters away at me constantly, actually, and to be honest it's the genius, not my conscious mind which is, at best, decently above average.
All the really brilliant stuff bubbles up from its constant thoughts, ideas, commentaries, analyses, and extrapolations.
To be honest, I've often wished it would shut the hell up and give me some peace, but only sleep deprivation without any form of stimulant can really shut down enough of its lines of thought (nope, no idea how many its got going at any given time, enough to make an awful racket though) to make it reasonably quiet in my head, and that's hard to do these days on purpose and not much fun or even relaxing since I'm so tired the whole time & have to concentrate just to stay awake.
Otherwise, it just chatters away 24/7, often to itself, sometimes about all sorts of things I'd rather not know, understand or have to think about, often about inane stuff, sometimes about important stuf, and every once in a while it throws me a bone & lets me in on a bit of understanding or a connection its made about something it's been mulling over for a long time.
Yes I'm sane, in case you were wondering.
I've asked multiple psychologists & psychiatrists over the years, just to be certain.
If you got through that little essay, kudos, and thanks for taking the time to read my ridiculously long(-winded) reply to your seemingly simple inquiry.
How would you describe how you learn things?
sliqua-jcooter
Veteran
Joined: 25 Jan 2010
Age: 37
Gender: Male
Posts: 1,488
Location: Burke, Virginia, USA
Sometimes the best way to understand the "why" behind something is to run head-first into a wall that you unknowingly built yourself. If someone tells you not to build a boat with a hole in the bottom, you might not built a boat with a hole in the bottom - but you won't really understand what happens when you launch a boat on the water and it starts sinking.
I've re-written nearly every "major" app I've ever written in the first place because something fundamental didn't work right, didn't scale, wasn't secure, or wasn't positioned to solve later business requirements. You can't look at it like you're re-working something to fix mistakes - rather you're making progress on improving your existing code base. You're still moving forward the same way you are when you code new features.
Versioning is a necessity. I'm doing much the same type of dev work you are (PHP stuff with a framework - but I'm using CI instead of Laravel) - and I use Coda 2 (mac only app) with git for versioning. It's saved me numerous times when I decide to rewrite a core API at 2am on a Sunday and later realize that my changes should be in a completely different place. Also, the branching feature lets me switch what I'm working on at any given time without having to get one component in a "good enough" state to switch to work on something else - which is very useful.
_________________
Nothing posted here should be construed as the opinion or position of my company, or an official position of WrongPlanet in any way, unless specifically mentioned.
Yep, that first bit describes exactly what I did, coded myself into a corner, ran right into a brick wall of lots of clever seeming stuff which wouldn't work no matter how much code or tricks I threw at it, which eventually led me to deep structural issues and a few really important bits of knowledge about PHP & Laravel I was missing & worse to some extent for the Laravel stuff I didn't really understand & spent hours researching the why behind it before I finally started to understand it.
I guess it's sort of silly since I knew it was the correct solution, to spend so much time understanding why it was, but without that understanding I refused to even consider implementing it.
Without the why, it's difficult for me to accept things my mind knows to be true, and without it the utility of the fix would have been extremely limited anyhow.
Thanks for the encouragement & sharing of a common experience, I figured I couldn't be the only one & this couldn't be the only time that's happened. The fact that it happens a lot is extremely heartening. I sort of guessed as much, but this is the first time I've really had the experience so I really couldn't be sure.
That's a great way to look at it, thanks for the perspective shift, I'll try to realign my general perceptions of 'stuff that goes wrong while coding' to focus more on that aspect of it, the constant improvement of the code. The fact that my own inexperience & ignorance caused & required it is unimportant given the fact that I figured it out and that the fix will make my code and thus the client's app that much better. A bit of extra time & money now which will save both down the road is totally worth it anyhow and likely always is when stuff like this happens.
Attitude adjusted, bruised ego soothed.
CI is very much like Laravel in a lot of ways, especially if you add a templating package to it, and I'm familiar with it a bit, if not particularly intimately or in-depth.
I know I should get into versioning.
It's the aversiveness of having every update viewable that keeps me from using it.
I hate seeing evidence of my mistakes & failures
It really, really, really bothers me and makes any activity where that's likely (leaving myself notes, making lists of tasks, etc.) extremely aversive on a visceral level.
I'll talk to myself about trying not to look at versioning that way anymore, but without a viable alternative way to look at it, I don't hold out much hope of convincing myself.
I really appeciate your support, anecdotes, and advice!
sliqua-jcooter
Veteran
Joined: 25 Jan 2010
Age: 37
Gender: Male
Posts: 1,488
Location: Burke, Virginia, USA
From what I've seen, my answer would be "no, but the good ones do".
I think it's more about the mindset than anything. The mindset of a hacker is "lets take this apart and try to figure out how it works and if I can do something cool with it". That mindset leads to a greater understanding of how things actually work, instead of just accepting the fact that they do work. The deeper your understanding of how things work, the better/more optimized/more scalable/faster your code will end up being.
_________________
Nothing posted here should be construed as the opinion or position of my company, or an official position of WrongPlanet in any way, unless specifically mentioned.
sliqua-jcooter
Veteran
Joined: 25 Jan 2010
Age: 37
Gender: Male
Posts: 1,488
Location: Burke, Virginia, USA
Yeah - I've worked with both. Laravel is a much broader framework - it does a lot more for you. However, most of the stuff I write uses very odd authentication frameworks and session management, so I find CI easier to work with.
I hate seeing evidence of my mistakes & failures
It really, really, really bothers me and makes any activity where that's likely (leaving myself notes, making lists of tasks, etc.) extremely aversive on a visceral level.
I'll talk to myself about trying not to look at versioning that way anymore, but without a viable alternative way to look at it, I don't hold out much hope of convincing myself.
Well, one way to look at it is that as soon as you start doing dev work with more than one person, it's essentially required.
But, I understand where you're coming from - when you're not confident in your abilities it's hard to put stuff out there for others to see/critique. I guess the most helpful thing I can say in that regard is that no matter how bad your code is, I guarantee you someone else has written worse code.
Bad code isn't even necessarily a bad thing. While it would be absolutely fantastic to write perfect code the first time around that is 100% secure and absolutely performance optimized - that never happens. Generally when I'm writing something from scratch, I won't even worry about making it the "right" way the first time. Make it do the specific functionality you're looking for the first time, no matter how much of a hack it is. Commit it, then take a look at it again and figure out what you need to do to make it "right". Then commit again.
Hell, most of the time my first commits for a feature aren't even feature-complete, and many times they don't even run. The important part is to get the code stub out there as early as possible, so that if something happens and you get distracted you can come back to that commit and know what you were going to do without having to spend a lot of time retracing your steps. This becomes critically important when you're working in a team, because it allows other people to see your functions/API and code against it before you're even done, and it allows other people to implement parts of your code for you without you having to even ask.
I didn't really get the benefits of versioning until I hired a developer in the Philippines to help me out. The time zones are pretty much exactly opposite, so we didn't have a lot of direct contact with each other. So, I would start working on something, commit whatever I had when I was done for the day (and other commits while I was working too when it made sense), and then he would start coding stuff based on my last commit, then he would commit what he had done and I would take over.
_________________
Nothing posted here should be construed as the opinion or position of my company, or an official position of WrongPlanet in any way, unless specifically mentioned.
If you're asking me, you're asking the wrong person.
I first learned to code in BASIC in 3rd grade 'cause I was too good at math & they were too cheap to bus me to the school with the 4th graders to take it.
So I sat in the basement computer lab during math class, entering programs from the back of the book into an Apple IIe & running them.
This quickly got boring, so I started modifying the programs to see what I could do, and thus I taught myself BASIC at around age 7.
I kept up with it a bit at home on my Apple IIc, but never really made anything spectacular.
My next experience would come when I got on the Internet (11 or 12ish), through a dial-up Unix shell account, long distance to NYC.
To do things like IRC, I had to compile them, and their dependencies, for instance Perl.
In the bad old days, though, the source code was always buggy and the compiler instructions often needed to be tweaked.
So I learned to debug C, C++, and Perl just so I could do stuff on the internet, like browse the fledgling text-based web, or compile a badass script for IRC so I could steal & own channels if need be.
As a teenager, I ran my own WWIV based BBS, got into the pirating community, had any software I wanted, sometimes before it came out in stores, and eventually managed to get a copy of the WWIV source, which I modded to some extent and learned some more practical C & C++ that way.
I also bought some books and did the tutorials to some extent.
At 15 had a job fixing old out of warranty voicemail computers for a small telecommunications comany in NYC, learned a bit about phone & fiberoptic, and fixed a bunch of computers.
Took a Fortran course at the local Community College for credit so I could graduate HS a year early, aced it, drove the Prof nuts 'cause I was always done 5mins into the 2 hour lab.
Eventually I got into hacking as an older teen, mostly for the fun & the culture.
I was always a pretty lazy hacker, only ever broke into places to see if I could & look around, and I never really got that good at it because I didn't have the patience to wade through code, write & implement exploits.
Why bother when there were so many already available, and the SATAN portscanner program I'd compiled on my shell account to locate vulnerable sites?
Went to Defcon in Las Vegas when I was 17, lots of fun, traded hacking software with a Fed (FBI), partied, phone phreaked, messed with the elevators, etc.
Took a year off, lived in SF, haunted the internet & local BBSes, was pretty bored a lot of the time, but didn't really hack anymore except as fun tricks to show friends.
Went to college, majored in Philosophy.
Took a Motorola chip assembly laguage course, got paid to tutor other students in the class while I was taking it (unheard of, generally).
Did an independant study on x86 chip assemply for fun.
Didn't graduate, spent years living in motels, playing online poker & not doing much else.
Eventually got a cosigner & an apartment for a few years, ended up takng ceramics classes at a local CC with a friend. She went pro, I tagged along.
Got hired to help make a giant ceramic sculpture @ CC, longest job I'd ever had, took a year and 4 months to finish.
Was unemployed 14 months, got hired as a telemarketer for a small web marketing company (irony, right?).
After about a year of helping out with tech stuff whenever asked, got moved permanently to help the web designer, soon became their IT department, started learn PHP & doing sysadmin stuff for their dedicated server.
Quit after about a year doing that due to cooworkers & environment. I still do stuff for them sometimes & they pay me, but been mostly freelance coding & web developing for about 9 months now.
I swore over & over & over I'd never code for a living because I always found it incredibly time consuming & frustrating, but I guess the inevitable's finally caught up with me and the harder I tried to fight against it, I was always going to end up doing this.
I guess, if you wanna get all technical, learning BASIC at age 7 by modifying programs from the back of a math book because I'd already mastered the rest of its contents qualifies as 'hacking' in the sense that hacking is just modifying code for your own purposes.
In that context I'd imagine that many people start coding when they end up for whatever reason debugging or hacking a script or some source code to fix it or make it work the way they want to for whatever reason, and get hooked on the control & power it can grant an otherwise geeky teen/young adult over potent computer driven entites.
In addition, the fact that it can gain one acclaim & bring in decent money if you can get the work or sell your code (apps, etc) is pretty cool as well.
However, I doubt that many people go from code-virgins straight to sophisticated computer b&e & such as you seem to be implying, as that generally takes skills & knowledge of code, hardware, software, and OSes which takes time to acquire and then start to use for less than legal means.
If that's what you mean by 'learning to hack first' I'm pretty sure that it almost never happens that way.
No one learns to code by being taught to hack.
In that community, you have to show skills before anyone will teach you any, so it seems really unlikely that anyone who's not related to or sleeping with a black-hat type hacker would ever learn that way.
So when I refer to myself as primarily a hacker, I'm just saying that I've had a lot more experience hacking, or modifying if you prefer, code to suit my purposes than I have actually developing & writing whole programs/apps myself, even using a basis like a framework to start with.
I don't mean to say that I engage in the kind of illegal activities I sometimes dabbled in as a teen or anything like that, I'm just using it as a general term for a coder/tech who's more likely to take something already made & modify it to suit their needs than create anything new themselves.
Anyhow, it seems I took the roundabout route to coding for a living, unlike many others who decide to do so early on in their lives and are likely far better off than I am now.
So here I am, starting my career in my mid 30s, trying to embrace what is apparently what I was meant to do.
I have seen many highly talented individuals rewrite code when they are focused on making it perfect. It can be quite difficult to resist the temptation to rewrite code when it does what it is supposed to do but is less than optimal.
I think that one of the primary goals of achieving expertise in coding is to learn how to do it better the first time so that you don't need to keep rewriting it.
Similar Topics | |
---|---|
Childhood trauma support |
27 Nov 2024, 12:53 pm |
Appreciation for shortfatbalduglyman: Share Some Support |
04 Dec 2024, 12:38 am |
Discussion topics for Asperger / HFA peer support group |
28 Dec 2024, 5:38 pm |