7 votes

Securing PHP shopping cart

In chronological order: session.php: If you're into ternaries, you could always change it to: ...
user avatar
  • 11.8k
7 votes

Shopping Cart design interview task

I won't add to @mtj's comment (I totally agree that an array defined as a means to exchange information is a code smell). I agree with @RobAu that you should stay far a away from those magic numbers ...
user avatar
  • 1,158
5 votes
Accepted

Securing PHP shopping cart (Paytrail integration) - follow-up

As one of your previous answer-ers, I can say this has definitely improved! I'll work through by the type this time. Variables: Your beginning (block) variables are defined like ...
user avatar
  • 11.8k
5 votes
Accepted

Securing PHP shopping cart

Security Questions Should I make sessions somehow secure, if there's no authenticated login and sessions are deleted when browser closes? or is session_start() enough in this case? The default ...
user avatar
  • 24.9k
5 votes

Updating the presentation of a credit card field as the card type becomes known

Create a map from card.type to what class it should be: ...
user avatar
5 votes

Shopping Cart design interview task

Three points which immediately strike out to me: Mutable double array in the interface. Yuck! This is unclear, hard to read and generally leaves a bad feeling. As you only use it to calculate a ...
user avatar
  • 4,682
5 votes
Accepted

Credit card validator code in Python

You are having a lot of code duplication in the second part, for all the different card vendors. Use the different if blocks just to determine the vendor and store ...
user avatar
  • 1,704
4 votes
Accepted

Shopping Cart Handler Class

There are a few things: Comments like this one: parent::__construct(); // to run the constructor of parent provide no real value; they just repeat what the ...
user avatar
  • 3,112
4 votes

Shopping cart logic for authenticated users and guests

There are two primary concerns I have. First, rather than accessing [[UserManager sharedManager]isUserLoggedIn] twice, let's access it just once: ...
user avatar
  • 25.2k
4 votes

RFID financial transaction

I see a number of things that may help you improve your code. Break up the code into smaller functions The addPoints() function is quite long and does a series of ...
user avatar
  • 64.1k
4 votes

Updating the presentation of a credit card field as the card type becomes known

It seems the value you're trying to replace for is really just the event.card.type prefixed by e-, so just string concatenate ...
user avatar
  • 11.8k
4 votes

UPenn CIS 194 Homework 1: Validating credit card numbers

You're on the right track, I think. If I had to pick one general criticism, it would be to watch out for redundant special cases. In my opinion, the exercise guides you towards making an unnecessary ...
user avatar
4 votes
Accepted

eCommerce project using the Repository pattern

First I'd like to start off by saying that if that code suits you, then it's not a bad idea to stick with it. It's fairly clean and pretty neat. I'm just going to point out a few things that may ...
user avatar
4 votes
Accepted

Sales tax calculator with branching based on postal address

I think you can refactor the sources as ITaxRateSource like this: ...
user avatar
  • 43.8k
4 votes
Accepted

pyvdp - Python library for Visa Developer Program

The code overall looks clean, there will always be debates on writing classes or not (both approaches have great reasoning behind them, of course): Stop Writing Classes (PyCon 2012) Start Writing ...
user avatar
  • 17k
4 votes

Shopping Cart design interview task

To add to mjt's answer: You never introduce the very sensible object Product (or SKU if you like). Instead, you use ...
user avatar
4 votes

Selenium-based link checker for a shopping site

Your LinkCheck.py can be greatly simplified: ...
user avatar
  • 40.5k
4 votes

Selenium-based link checker for a shopping site

Adding to the Graipher's excellent answer, here are some selenium specific points: you are not closing the browser instances started by the webdriver using a CSS selector to get all the elements ...
user avatar
  • 17k
4 votes
Accepted

Apple receipt validator

Instead of returning false 10+ times, just return false at the end since the only case you'll return true is if the case is 0. Also, you could reduce some repetition by putting the message in a string ...
user avatar
  • 453
4 votes

eCommerce Mockup App in JS

I am by no means a javascript/html/css developer, just somethings I noticed, and some things I would recommend as a customer. I invite someone who is more ...
user avatar
  • 9,456
4 votes
Accepted

eCommerce Mockup App in JS

General feedback Overall this code isn’t bad but could be simplified quite a bit. The biggest thing I noticed is that jQuery is used for a few things but could be used a lot more - e.g. selecting DOM ...
user avatar
3 votes

Rails controller method to create a customer with credit card info

Personally, I wouldn't want to see this in a model either (at least not an ActiveRecord model). I'd probably go with something more like this: app/controllers/customers_controller.rb ...
user avatar
3 votes

RFID financial transaction

Remove hardcoded lengths and magic numbers Currently, you have a block of code with lots of hardcoded lengths and magic numbers that looks like this: ...
user avatar
  • 28.4k
3 votes
Accepted

Shopping cart application in Spring MVC

I think you need different approach to this. It's good practice when you don't have much of business logic in your controller. Maybe you should try creating a different class that will fill pages with ...
user avatar
3 votes

Shopping cart simulator

Don't have time for a full review but hopefully this will give you some food for thought. Why add an extra variable show? Angular is more than capable of binding ...
user avatar
  • 16.6k
3 votes

Mini eCommerce application and message/warning/error-handling

I would agree that what you have now is cleaner and more testable (in comparison to the code you said you might have written before). I don't know C++ but I'm familiar with validation, so I'll stick ...
user avatar
  • 5,687
3 votes

A Java Web App with Servlets, JSP and Session: shopping cart example

You need to be concerned about thread safety in web applications, HashMap is not thread safe so you can use the Concurrent version. ...
user avatar
3 votes
Accepted

UPenn CIS 194 Homework 1: Validating credit card numbers

toDigitsRev You can combine these two cases: toDigitsRev 0 = [] toDigitsRev n | n < 0 = [] I think having one case makes the code clearer: ...
user avatar
  • 1,885
3 votes

Card payment strategies

Your friend is suggesting you have a class that does the common work, and then subclasses to handle specialized work. This is really core OOP. For example, your base class (say, ...
user avatar
  • 457

Only top scored, non community-wiki answers of a minimum length are eligible