22

So our class had this assignment in python where we had to code up a simple web scraper that extracts data of the best seller books on Amazon. My code was ~100 lines long( for a complete newbie in python guess the amount of sweat it took) and was able to handle most error scenarios like random HTML 503 errors and different methods to extract the same piece of data from different id's of divs. The code was decently fast.
All wss fine until I came to know the average number of lines it took for the rest of the class was ~60 lines. None of the others have implemented things that I have implemented like error handling and extracting from different places in the DOM. Now I'm confused if I have complicated my code or have I made it kind of "fail proof".

Thoughts?

Comments
  • 17
    I would think on the real world you would want error handling. I personally hate using an app or script that doesn't handle errors well
  • 4
    U have done a great work compared to others!
    Less number of lines != Efficient code

    Handling errors are major!
    Because ur app won't crash frequently
  • 3
    @steaksauce @Nawap Thank you for your respective views. Yes I know less lines != Efficient code. I was worried if my efforts in writing error handling didn't go wasted...
  • 3
    More lines + more features == ok

    More lines w/o more features == not as ok lol
  • 9
    Real software is complex and involves dozens of components integrated with one another, passing data, and working in tandem.

    Not handling errors properly in one place can set ogf a cascade of bugs that hides the actual problem and adds HOURS to debugging time.

    ~20 lines is nothing compared to the time proper error handling will save in the long run!
  • 4
    Good job! Error handling is awesome and I find using apps that do it well are the best ones!
  • 2
    Not exactly the same, but similar experience.

    In the first project due for my Intro to CS class we had to include error handling for some of the inputs involved
Add Comment