Hacker Newsnew | past | comments | ask | show | jobs | submit | bithub's commentslogin

Shorter yes, but reversing the whole string and comparing it with the input value is actually slower/less efficent than the algorithm shown in the article. Sorry for my nitpicking ;)


Clean, easy, maintainable. To me that is more valuable than an increase in performance. I would be very surprised to find a palindrome checker as the bottle nek in a system.


One of the interviewee questions could be "Based on the profiler output, how many times would this code execute in a typical day, to the nearest power of 10? What code will it replace?"

string.reverse() and string.equals() is plenty good enough for smaller magnitudes or all-new functionality. Premature optimization just means you think you can outguess the profiler.

So first you code the simplest thing that works. Then you start optimizing in the most heavily used sections. If you have to go past the pointer-based solution in C to assembly that employs hardware-specific performance tweaks, it's time to just end the interview and go pet your taco cat.


OK, ask the people who get their annoying ads popping up on screen.


Bots tend to fill in every input field they encounter. So you could add an empty hidden input field to your form and check if the field has been populated. Another way is to look how long it took to open the page which contains the form and the form got submitted by injecting a timestamp. Bots are way faster than humans.



That's the same kind of work I used to do when I was about 15, creating websites including some PHP. Retrospectively I have to say, that I lacked alot of experience and guidance. So I pity the guy who has to maintain my spaghetti code today.


At a quick glimpse at the framework code, I found several no gos for me: 1) First file i opened contained Methods with > 600 lines of code with mixed variable naming (camelcase and underscore). I don't want to debug that stuff, if I run into a framework bug. 2) Several classes/interfaces in a single file. What if I ie want to write my own adapters by using the given interfaces?

On the other side the code is very well commented (not all but most of it), which is a very huge plus.


Thanks for the feedback, but are you looking at the right framework? I am hard pressed to imagine how you could encounter either 1) or 2) in it, let alone both in a single file. As for your question, PIE is designed to let you write any adapters you want. For example it currently supports only MySQL, but you are free to add support for e.g. Postgres, SQLite or even NoSQL databases.

I'm just a bit surprised by your comments because they describe the exact opposite of how most of PIE is designed, and the philosophy behind it. Although I take your point with mixed variable naming. There is lots of room for standardizing the internal codebase more than it is.


framework/classes/pie.php 1082 lines long

Methods existing in the file: microtime, exceptionHandler, includeFile, autoload, var_dump, do_dump.

It's the first file I opened, and I see exactly what this guy saw immediately as well.


Right ... but I thought he said there were methods with > 600 lines of code, and files with multiple classes/interfaces all over the place. That's why I took issue with it. But yeah, the Pie class has all the core functions.


echo md5('USCYBERCOM plans, coordinates, integrates, synchronizes and conducts activities to: direct the operations and defense of specified Department of Defense information networks and; prepare to, and when directed, conduct full spectrum military cyberspace operations in order to enable actions in all domains, ensure US/Allied freedom of action in cyberspace and deny the same to our adversaries.');

results in

9ec4c12949a4f31474f299058ce2b22a


Lame.


I mean... it's the MD5 of a snippet of content off their website? That really tells you all you need to know about "Cyber Command", doesn't it?


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: