Welcome Guest ( Log In | Register )

5 Pages < 1 2 3 4 > » Bottom

Outline · [ Standard ] · Linear+

 Newbie, junior, senior programmer, Simple POS system

views
     
SUSifourtos
post Feb 24 2023, 01:50 PM

Look at all my stars!!
*******
Senior Member
2,256 posts

Joined: Feb 2012




A senior would not plan coding in 1st Place.
never.


You need to design a relational database 1st.
then you build you logic


The most complicated part would be

= Product
= Ordered Item then Order
= Receipt


Product DB = available time? Avalbility? Linked Modifer Item, Linked Add On Item, Price, Desc, Linked Package

Linked Package = Linked Product, Set Name, ( and its price modifier )
Linked Modifier = example, less sweet, no onion etc ( and its price modifier )
Linked Addon = Add telur ( and its price modifier )

-----

Ordered Item DB = Linked Product, modifier, quantity, takeaway?, addon, discount?, order status, order time, user id, linked Menu/store (if franchise)
Order = Linked Ordered Item, Subtotal, discount, tax, service charges, table ....

-----

Receipt = Linked Order, payment type, store, staff received payment, discount......



Logic is entry level, it just a presentation/manipulation of Database.

A Lightweight, query optimized, scalable, insightful Database Design is the Key of any Mass Production Level Software.

silverhawk
post Feb 24 2023, 02:14 PM

Eyes on Target
Group Icon
Elite
4,956 posts

Joined: Jan 2003


QUOTE(WongGei @ Feb 24 2023, 01:29 PM)
That inspire me to create a thread and discuss about this.

So far I haven't see any "codemaster" that can come out with the algorithm  to do that.
*
Errr... its not that hard.

I've built backends that do stuff like that. I had a "promotion module" which basically allowed the company to create promotion rules. Like if you wanted to create a set (bundle). You would say if got X and Y item, then the price is $Z, or can set it is a fixed deduction, or even percentage off or even another item.

The promotions have to be weighted, so that some promotions take precendence over others. Then have to handle things which promotions can be used together and which can't. Like ordering bundles and get free shipping over $A amount is typically allowed. But using coupons on discounted items isn't.

QUOTE(WongGei @ Feb 24 2023, 01:39 PM)
To further answer your consideration, may be a POS system doesn't care if it is charged as a la cart or set. But the same algorithm can be used by a courier company or ship cargo. Imagine the price is a volume that require to fit an item (alacarte). There are only certain type of boxes (set). How many boxes are needed how to maximized the space utilization. The shipment company will pay you tons of money to come out with a program that can do that.
*
Courier companies already have stuff like that. Its a solved problem. Google for it, you'll find solutions.

QUOTE(ifourtos @ Feb 24 2023, 01:50 PM)
A senior would not plan coding in 1st Place.
never.
You need to design a relational database 1st.
then you build you logic
*
That's not true.

If you have to build your database first, then you have already very tightly coupled your database design to your code. Ideally, your code should not care how the database is design, it just needs to receive the correct inputs.

What data is required can be mocked first. This allows you to iterate through your code faster and find flaws in your assumptions. Then you decide where you want to store the data and how. Could be as simple as a CSV, relational DB like MySQL or NoSQL like mongoDB. Regardless, the core logic of your code should not change and ideally all you have to do to is write the adapters for the DB you plan to use.
angch
post Feb 24 2023, 08:03 PM

On my way
****
Junior Member
636 posts

Joined: Jul 2006
QUOTE(silverhawk @ Feb 24 2023, 02:14 PM)
Errr... its not that hard.

I've built backends that do stuff like that. I had a "promotion module" which basically allowed the company to create promotion rules. Like if you wanted to create a set (bundle). You would say if got X and Y item, then the price is $Z, or can set it is a fixed deduction, or even percentage off or even another item.

The promotions have to be weighted, so that some promotions take precendence over others. Then have to handle things which promotions can be used together and which can't. Like ordering bundles and get free shipping over $A amount is typically allowed. But using coupons on discounted items isn't.
Courier companies already have stuff like that. Its a solved problem. Google for it, you'll find solutions.
That's not true.

If you have to build your database first, then you have already very tightly coupled your database design to your code. Ideally, your code should not care how the database is design, it just needs to receive the correct inputs.

What data is required can be mocked first. This allows you to iterate through your code faster and find flaws in your assumptions. Then you decide where you want to store the data and how. Could be as simple as a CSV, relational DB like MySQL or NoSQL like mongoDB. Regardless, the core logic of your code should not change and ideally all you have to do to is write the adapters for the DB you plan to use.
*
Heh, some business requirements may be counter intuitive. e.g.

1. Burger RM8
2. Fries RM3
3. Drink RM3
Set A: Burger+Fries+Drink = RM10

Someone who just order burger and drink is actually better off getting set A, which contained fries they don't want.

So, should the optimizer auto add a Fries to the person's order to get Set A? Or should the system leave it to the cashier?

Or can the system handle a Set with optional components? e.g. Order Set A, minus Fries?

Anyone tried ordering kopi-o kosong tanpa kopi before? Might be cheaper than their mineral water...


This post has been edited by angch: Feb 24 2023, 08:08 PM
silverhawk
post Feb 24 2023, 11:53 PM

Eyes on Target
Group Icon
Elite
4,956 posts

Joined: Jan 2003


QUOTE(angch @ Feb 24 2023, 08:03 PM)
Heh, some business requirements may be counter intuitive. e.g.

1. Burger RM8
2. Fries RM3
3. Drink RM3
Set A: Burger+Fries+Drink = RM10

Someone who just order burger and drink is actually better off getting set A, which contained fries they don't want.

So, should the optimizer auto add a Fries to the person's order to get Set A? Or should the system leave it to the cashier?

Or can the system handle a Set with optional components? e.g. Order Set A, minus Fries?

Anyone tried ordering kopi-o kosong tanpa kopi before? Might be cheaper than their mineral water...
*
The rules are not that weird actually.

If you consider kitchen operation and inventory you would actually save money if more people bought sets, even though your profit margin might seem higher if they bought ala-carte separately.

The thing is, the pricing engine is not an optimizer. Its purpose is not to give you the cheapest thing, its purpose is for the company to push their promotions to you. What we did was detect if a bundle condition is met, we prompt the user with an option to convert to bundle to save $x dollars. The service was purely online based, so no cashier, but the same interface could be implemented on cashier front if done as POS.


TSWongGei
post Feb 25 2023, 10:53 AM

Regular
******
Senior Member
1,206 posts

Joined: Dec 2007
From: Kuala Lumpur
QUOTE(angch @ Feb 24 2023, 08:03 PM)
Heh, some business requirements may be counter intuitive. e.g.

1. Burger RM8
2. Fries RM3
3. Drink RM3
Set A: Burger+Fries+Drink = RM10

Someone who just order burger and drink is actually better off getting set A, which contained fries they don't want.

So, should the optimizer auto add a Fries to the person's order to get Set A? Or should the system leave it to the cashier?

Or can the system handle a Set with optional components? e.g. Order Set A, minus Fries?

Anyone tried ordering kopi-o kosong tanpa kopi before? Might be cheaper than their mineral water...
*
Nice feature to have.

Let consider how people reaction.

1.) Junior Programmer :- ha? Like this also can ah ...how to do ah?
2.) Senior Programmer :- Wah lau Eh ... siao meh ... who is going to use it ... ok lah ....not that hard.
3.) Project Manager :- Em ... nice feather, but how long to implement and probably noone will use it
4.) System Architect :- Em ... we should build the framework to enable this
5.) IT firm boss :- This one may be we need it. But not at this moment
6.) Client :- Oh ...interesting. I can use it
7.) Environmentalist :- It's a waste of resource, let boycott the shop.

So, which level are you in?

This post has been edited by WongGei: Feb 25 2023, 10:56 AM
flashang
post Feb 26 2023, 12:29 AM

Casual
***
Junior Member
355 posts

Joined: Aug 2021


QUOTE(ifourtos @ Feb 24 2023, 01:50 PM)
A senior would not plan coding in 1st Place.
never.
You need to design a relational database 1st.
then you build you logic
The most complicated part would be

  = Product
  = Ordered Item then Order
  = Receipt
Product DB = available time? Avalbility? Linked Modifer Item, Linked Add On Item, Price, Desc, Linked Package

Linked Package = Linked Product, Set Name,  ( and its price modifier )
Linked Modifier = example, less sweet, no onion etc ( and its price modifier )
Linked Addon = Add telur  ( and its price modifier )

-----

Ordered Item DB = Linked Product, modifier, quantity, takeaway?, addon, discount?, order status, order time, user id, linked Menu/store (if franchise)
Order = Linked Ordered Item, Subtotal, discount, tax, service charges, table ....

-----

Receipt = Linked Order, payment type, store, staff received payment, discount......
Logic is entry level, it just a presentation/manipulation of Database.

A Lightweight, query optimized, scalable, insightful Database Design is the Key of any Mass Production Level Software.
*
Although it's old school, sdlc still valid when develop a system.
You should do planning and analysis before design.

smile.gif


kingkingyyk
post Feb 26 2023, 06:05 PM

10k Club
Group Icon
Elite
15,694 posts

Joined: Mar 2008
It is quite subjective whether to implement the optimizer or not.

- Customer might be ordering for few person and going to split the bill later on.
- Company decided to go evil to earn more money by hiding the promotion, so even the customer ordered the item as found in the set, it still charge as single item. brows.gif

The requirements definitely need some static testing.

This post has been edited by kingkingyyk: Feb 26 2023, 06:05 PM
TSWongGei
post Feb 27 2023, 10:41 AM

Regular
******
Senior Member
1,206 posts

Joined: Dec 2007
From: Kuala Lumpur
QUOTE(kingkingyyk @ Feb 26 2023, 06:05 PM)
It is quite subjective whether to implement the optimizer or not.

- Customer might be ordering for few person and going to split the bill later on.
- Company decided to go evil to earn more money by hiding the promotion, so even the customer ordered the item as found in the set, it still charge as single item. brows.gif

The requirements definitely need some static testing.
*
This are true statement and often wrongly interpreted, either by cashier or staff on the ground.
First of all, noone forced to have a promotion except the owner of the business. So, the owner already make the calculation and find that it is worth, then only the promotion is being launched.
Client will definitely welcome the promotion because they can pay less for more.
The only person that doesn't like the promotion might be the middle and lower management of the business, because they are not the direct beneficial of the campaign.

As a programmer, we should always/try to enable the business owner to earn more income.

How often we go to the bank or other business and we are forced to do things in wired way. Just like the credit/debit card terminal in GSC, that need to tap two times to make payment. Anyone notice that?

For me, the optimizer is not a must, but good to have feather.

As a programmer, no matter this feather will be in/out from the current project, it is good to know that there are something out there that need to be done, either by yourself or someone who will take over your position. If you have time, do make some planning or create a program that can be modified to have that.


FlierMate4
post Feb 27 2023, 04:38 PM

Getting Started
**
Validating
90 posts

Joined: Jan 2023
QUOTE(WongGei @ Feb 23 2023, 04:46 PM)
After study for some time, a newbie learn how to separates data with algorithm and make the program more easy to change.

Still, need to recompile and deploy program every time changes involved.
*
Unlike your newbie.cpp, the junior.cpp cannot run by Dev-C++, it reported errors:
CODE
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"1", "3", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"2", "3", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"4", "3", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"1", "3", "6", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"2", "3", "6", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"4", "3", "6", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'


However, it runs successfully using Visual Studio.
So it must be something to do with configuration in Dev-C++.


angch
post Feb 27 2023, 05:41 PM

On my way
****
Junior Member
636 posts

Joined: Jul 2006
QUOTE(FlierMate4 @ Feb 27 2023, 04:38 PM)
Unlike your newbie.cpp, the junior.cpp cannot run by Dev-C++, it reported errors:
CODE
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"1", "3", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"2", "3", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"4", "3", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"1", "3", "6", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"2", "3", "6", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"4", "3", "6", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'


However, it runs successfully using Visual Studio.
So it must be something to do with configuration in Dev-C++.
*
You need to use C++11. e.g. using GCC,
CODE
g++ -std=c++11 junior.cpp


This post has been edited by angch: Feb 27 2023, 05:43 PM
TSWongGei
post Feb 27 2023, 05:46 PM

Regular
******
Senior Member
1,206 posts

Joined: Dec 2007
From: Kuala Lumpur
QUOTE(FlierMate4 @ Feb 27 2023, 04:38 PM)
Unlike your newbie.cpp, the junior.cpp cannot run by Dev-C++, it reported errors:
CODE
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"1", "3", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"2", "3", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"4", "3", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"1", "3", "6", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"2", "3", "6", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'
106 1 C:\Users\~User~\Downloads\junior.cpp [Error] could not convert '{"4", "3", "6", "7"}' from '<brace-enclosed initializer list>' to 'std::vector<std::basic_string<char> >'


However, it runs successfully using Visual Studio.
So it must be something to do with configuration in Dev-C++.
*
compiler too old. Need C++11 or newer compiler. Try to set the option of your compiler to -std=c++11

P.S. C++11 is a C++ standard that is released at 2011, which is 12 years ago. The latest standard is C++20

user posted image
FlierMate4
post Feb 27 2023, 06:09 PM

Getting Started
**
Validating
90 posts

Joined: Jan 2023
QUOTE(angch @ Feb 27 2023, 05:41 PM)
You need to use C++11. e.g. using GCC,
CODE
g++ -std=c++11 junior.cpp

*
QUOTE(WongGei @ Feb 27 2023, 05:46 PM)
compiler too old. Need C++11 or newer compiler. Try to set the option of your compiler to -std=c++11

P.S. C++11 is a C++ standard that is released at 2011, which is 12 years ago. The latest standard is C++20
*
Yes, the Dev-C++ is working now after adding "-std=c++11" in compiler option.

Thanks.
TSWongGei
post Feb 28 2023, 09:58 PM

Regular
******
Senior Member
1,206 posts

Joined: Dec 2007
From: Kuala Lumpur
Finally, refreshed my c++ skill to current c++ standard.
Amazed with the ever revolving c++ standard rclxms.gif




Attached File(s)
Attached File  senior.gz ( 10k ) Number of downloads: 8
TSWongGei
post Mar 1 2023, 01:11 PM

Regular
******
Senior Member
1,206 posts

Joined: Dec 2007
From: Kuala Lumpur
QUOTE(WongGei @ Feb 28 2023, 09:58 PM)
Finally, refreshed my c++ skill to current c++ standard.
Amazed with the ever revolving c++ standard rclxms.gif
*
I classify it as a work of senior programmer based on the following criteria

1.) menu and order are read in from file instead of key in manually, this make the program easy to process big amount of data.
2.) Separating static data (menu) storage with program binary make the program much more easy to adopt changes. Changes in menu, that can happen time to time doesn't require re-compile of binary files.
silverhawk
post Mar 1 2023, 09:45 PM

Eyes on Target
Group Icon
Elite
4,956 posts

Joined: Jan 2003


QUOTE(WongGei @ Mar 1 2023, 01:11 PM)
I classify it as a work of senior programmer based on the following criteria

1.)  menu and order are read in from file instead of key in manually, this make the program easy to process big amount of data.
2.)  Separating static data (menu) storage with program binary make the program much more easy to adopt changes. Changes in menu, that can happen time to time doesn't require re-compile of binary files.
*
To me that is still junior laugh.gif

You cannot do that level, you're still a student.
flashang
post Mar 1 2023, 10:27 PM

Casual
***
Junior Member
355 posts

Joined: Aug 2021


QUOTE(WongGei @ Mar 1 2023, 01:11 PM)
I classify it as a work of senior programmer based on the following criteria

1.)  menu and order are read in from file instead of key in manually, this make the program easy to process big amount of data.
2.)  Separating static data (menu) storage with program binary make the program much more easy to adopt changes. Changes in menu, that can happen time to time doesn't require re-compile of binary files.
*
IMHO,
The menu.csv file do not have row header, which make changes confuse.

A complete project might include presentation or demonstrate how it work and what are the expected results.

By the way, does anyone test the program to see if the program running with a "user understand" way ?
Will you create some user manual to let people know how to use the senior version ?

smile.gif


TSWongGei
post Mar 2 2023, 09:31 AM

Regular
******
Senior Member
1,206 posts

Joined: Dec 2007
From: Kuala Lumpur
QUOTE(flashang @ Mar 1 2023, 10:27 PM)
IMHO,
The menu.csv file do not have row header, which make changes confuse.

A complete project might include presentation or demonstrate how it work and what are the expected results.

By the way, does anyone test the program to see if the program running with a "user understand" way ?
Will you create some user manual to let people know how to use the senior version ?

smile.gif
*
laugh.gif Its hard for a guys like you to understand. .....

1.) The menu.csv wont be edited by human. Even though it can be done easily.
2.) This is a demo program to showcase programming skill, not project management , presentation skill
3.) I test it and it works. Can't you compile the source? If you are unable to compile the program, learn how to compile and run it first, like @FlierMate4
4.) Nope unless you pay me for that. The source is already open. Its an open source version not spoon feeding version.

This post has been edited by WongGei: Mar 2 2023, 09:32 AM
TSWongGei
post Mar 2 2023, 09:35 AM

Regular
******
Senior Member
1,206 posts

Joined: Dec 2007
From: Kuala Lumpur
QUOTE(silverhawk @ Mar 1 2023, 09:45 PM)
To me that is still junior laugh.gif

You cannot do that level, you're still a student.
*
Indeed, a lot of our FYP student code is much worse than that.
FlierMate4
post Mar 2 2023, 01:43 PM

Getting Started
**
Validating
90 posts

Joined: Jan 2023
QUOTE(flashang @ Mar 1 2023, 10:27 PM)
By the way, does anyone test the program to see if the program running with a "user understand" way ?
*
Below is the output running using the default order.txt.
user posted image

The predefined order is A1, D:
A1:
CODE
A1,Set A - Butterfly Bun + Porridge,3.2,1,7


CODE
1,Butterfly Bun,1.0,1
7,Dry Scallop Porridge,2.5,7


D:
CODE
D,Set D - Tao Foo Far + Soya Bean,3.9,3,6


CODE
3,Soya Bean,2.0,3
6,Tao Foo Far,2.2,6


The total price should be RM 7.10, but I see RM 6.90.... The C++ code crafted by WongGei is beyond my level, since junior.cpp, I am not able to fully understand his C++ code, as my level is newbie.cpp. brows.gif


FlierMate4
post Mar 2 2023, 01:45 PM

Getting Started
**
Validating
90 posts

Joined: Jan 2023
I run senior.cpp with Visual Studio 2022, no problem.

But again, not able to compile and run senior.cpp using Dev-C++, it complains:

CODE
3755 14 C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\bits\stl_algo.h [Error] invalid use of 'auto'


And point to file in 'std_algo.h'.

user posted image

I use the same compiler option for c++11.

Thanks for any help.



This post has been edited by FlierMate4: Mar 2 2023, 01:47 PM

5 Pages < 1 2 3 4 > » Top
 

Change to:
| Lo-Fi Version
0.0314sec    0.41    6 queries    GZIP Disabled
Time is now: 24th December 2025 - 06:53 AM