From: matt d. <mm_...@ya...> - 2009-07-03 22:42:55
|
Coding styles! Rich topic... I don't comment code much- I expect it to be explicit enough with the var names and such and commenting DOES take a lot of time (although you can argue not commenting takes others more time). I sorta think- (unless there's math involved) your code should be understandable on it's own. That said- here are my legacy code/new developer peeves: Referencing a variable or function that's included somewhere not apparent and not commenting where it's defined. Having variables not clearly delineated in the code like "some html<?=$junk?>that rambles" Similarly- clear spacing between any variables or statements. for(i=1;1<$garbage;$1+=) is not acceptable! Variables that are not descriptive or conform to the code base's standard: $company - is an object. $companyRow or $arr_company - is an array from db. (I'm guilty of mixing camel case and underscores so I can't complain here) And Alec's lament double trued- code repition. Has this been done before? Could it be moved into a class? This happens a billion times over with javascript which, is the buggiest anyway so it's triple bad. That one will make me pop off. Confess- I love ternary! -Rant Off- I do one thing though I don't see a lot elsewhere- When I have specific code blocks for one 'domain' (if you will) in a work file, I use centered comments because it's easier to scan mulitple blocks that way. //-------------------------------------------------------------------------- this be special code block for ar holds -------------------------------------------------------------------->> Matt ________________________________ From: Anacreo <an...@gm...> To: Chicago PHP User Group <chi...@li...> Sent: Friday, July 3, 2009 3:58:51 PM Subject: Re: [chiPHPug-discuss] Anyone up for code sample maturity mentoring? I couldn't agree with Matt's response more... if they just said the code was not mature enough, they probably didn't think the example was appropriate. Did they give you a few example problems and ask for you to resolve them or did you just provide some code samples out of a portfolio? Do you want to provide one or two of your examples and maybe we could give you some examples of how to solve the problem? Some things that drive me nuts when hiring: * "Young" programmers who think they're so cool because they've mastered the ternary operator, : ?, and use it to illegibility -- honestly don't bother using it at all... * Mixed variable and formatting styles within your code, shows a lot of cut and paste action... * No variable style at all -- Pick a standard and use it... * Skipping language constructs, don't skip ;'s {}'s ()'s or []'s... * Code repetition -- if you're repeating the same code chances are you shouldn't be... And finally code commenting... Every procedure, variable, and definition should be clearly commented with EXACTLY what it does. At the end of the day OOP vs non-OOP doesn't matter so much to ME as much as some other people stress it, if you write clear fundamentally good code, you'll get the job over someone who doesn't have OOP examples or not... Also is there ingenuity in the code... The one thing that drives me batty is hard coded code... if you can make it extensible do it... Drawing a table?, make it as dynamic, robust and extensible as possible so it can be the foundation of future work... If you have something that goes beyond just standard work that defines your abilities you may try something like that (even in a somewhat raw state). Alec On Fri, Jul 3, 2009 at 3:01 PM, matt donohue <mm_...@ya...> wrote: > Hey Bryan, > > Excellent question. > > I would bet the vacations days (I don't get to take) that they never got > too far into your code. > Just my opinion- but, when people ask for code samples they want original > examples exclusively. > I think less is always more when it comes to code samples (offer more > later!) and (again) I would ONLY show original code and specifically > examples of solving real world problems (not conceptual applications). > Small code chunks (3 or 4 max) of larger classes, modules or utility > classes that demonstrate your coding methods or philosophy dealing with > actual problems. > (I mix my samples with utility functions, class methods and even > Javascript, AJAX and JSON.) > Generally you would tailor the samples you choose based on the job > description and you would describe why you chose the examples > and how they fit into the the position you are applying for. > Think of the hiring questions they would be asking? Can he work with a > large existing code base. Is he good working with a database? > Is he more of a back-end developer or does he know CSS, AJAX and > Javascript? Can he work on his own or does he need supervision? > Do you: borrow code, use frameworks extensively, have your developed your > own framework/class base? > The real question you should answer for them is how will YOU solve their > problems. > If you don't have a long work history this is difficult and could be the > reason they would mention maturity. > I would say offhand, your example is asking a lot from the prospective > employee. Not that it doesn't demonstrate a thorough understanding of PHP > concepts. > It's more thorough than I code. > I (personally) would never dig through a code sample like that to hire > someone. > You don't mention your work experience but, if it is minimal I would say > the odds of getting a job requiring code samples is limited. > That's not a mentoring position which, is what I believe you would want? No > one is going to hire someone who can 'conceptually' do the job for something > more front-line. So, in that vein I'm thinking your in-between a bubble of > not being an intern/trainee but, without enough 'real' experience to cement > a Jr Dev position. > Generally- code samples are a sanity check, and not why you are actually > hired. > Even with years of experience you'll find you are under qualified for some > positions and over qualified for others so, I wouldn't dwell on it much and > keep trying. > > I can send you an old example of a cover letter and code samples for > reference- email me. I'm sure they are embarassing. > > Matt > > > > > ________________________________ > From: Bryan Fagan <bry...@gm...> > To: chi...@li... > Sent: Friday, July 3, 2009 12:44:58 PM > Subject: [chiPHPug-discuss] Anyone up for code sample maturity mentoring? > > Hello, All. > > A recruiter recently told me that one of her clients--who was specifically > looking for a PHP developer--said that my code sample didn't show the level > of "maturity" that the client was looking for. Hmmm, ok. Can anyone help me > on my path to maturity with some constructive criticism of my code sample? > > I thought my code through and imagined it to be pretty good stuff, but > evidently I've got some growing to do. I certainly cannot claim to be a PHP > expert, but experience and reading have brought me through enough levels of > bad and immature code hell to imagine that I am well into the intermediate > range. I originally considered providing classes from my portfolio website, > which is a Zend Framework-based MVC setup with an XML database, but decided > instead to write a small command-line application from scratch so that a > potential employer could run it with as few setup hassles and snags as > possible. I set out to make sure that I included the following elements, > which generally constitute what I believe to be indicative of mature PHP > code: > > * standard OOP principles, including high decoupling and good > encapsulation, > inheritance, polymorphism, composition, and aggregation > * most PHP 5 OOP features, including interfaces, abstract classes, and > exception handling > * use of design patterns > * use of SPL and an external code library (Zend Framework, in this case) > * file, stream, and XML handling > * Zend coding standard > * E_STRICT cleanliness > > That's a pretty good checklist, right? And almost all of it made it in. So > is the problem in the execution? Is it that I didn't do it "test first" and > include the unit tests (that's a skill I'm still working on)? Questions, > comments, concerns? > > I'd appreciate as much insight as anyone has to offer. I'm not asking so > much for help with a re-write as for help understanding what is immature > about the code or the project as a whole--and what I need to understand and > learn to do to have any recruiter think, "Damn, this guy's good! Bring him > in." > > If you're interested in this mentoring task--or just want to point and > laugh--you can download the zipped-up code from my professional website at > the address http://bryanfagan.info/documents/Bryan_Fagan_Code_Sample.zipand > open it with the password "super good password". > > Bryan Fagan > > P.S. I am woefully unemployed, so if you see my stuff and know of someone > looking for a LAMP developer who might think anything even close to "this > guy's good," I would be eternally grateful if you'd pass on my contact > information or send me a link as appropriate. > > ------------------------------------------------------------------------------ > _______________________________________________ > chiPHPug-discuss mailing list > chi...@li... > https://lists.sourceforge.net/lists/listinfo/chiphpug-discuss > > ------------------------------------------------------------------------------ > _______________________________________________ > chiPHPug-discuss mailing list > chi...@li... > https://lists.sourceforge.net/lists/listinfo/chiphpug-discuss > ------------------------------------------------------------------------------ _______________________________________________ chiPHPug-discuss mailing list chi...@li... https://lists.sourceforge.net/lists/listinfo/chiphpug-discuss |