Newbie, junior, senior programmer, Simple POS system
Newbie, junior, senior programmer, Simple POS system
|
|
Feb 24 2023, 01:50 PM
|
![]() ![]() ![]() ![]() ![]() ![]() ![]()
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. |
|
|
|
|
|
Feb 24 2023, 02:14 PM
|
|
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. Errr... its not that hard. So far I haven't see any "codemaster" that can come out with the algorithm to do that. 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. That's not true. never. You need to design a relational database 1st. then you build you logic 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. |
|
|
Feb 24 2023, 08:03 PM
|
![]() ![]() ![]() ![]()
Junior Member
636 posts Joined: Jul 2006 |
QUOTE(silverhawk @ Feb 24 2023, 02:14 PM) Errr... its not that hard. Heh, some business requirements may be counter intuitive. e.g.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. 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 WongGei liked this post
|
|
|
Feb 24 2023, 11:53 PM
|
|
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. The rules are not that weird actually. 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... 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. WongGei liked this post
|
|
|
Feb 25 2023, 10:53 AM
Show posts by this member only | IPv6 | Post
#25
|
![]() ![]() ![]() ![]() ![]() ![]()
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. Nice feature to have.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... 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 |
|
|
Feb 26 2023, 12:29 AM
|
![]() ![]() ![]()
Junior Member
355 posts Joined: Aug 2021 |
QUOTE(ifourtos @ Feb 24 2023, 01:50 PM) A senior would not plan coding in 1st Place. Although it's old school, sdlc still valid when develop a system.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. You should do planning and analysis before design. |
|
|
|
|
|
Feb 26 2023, 06:05 PM
Show posts by this member only | IPv6 | Post
#27
|
|
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. The requirements definitely need some static testing. This post has been edited by kingkingyyk: Feb 26 2023, 06:05 PM |
|
|
Feb 27 2023, 10:41 AM
Show posts by this member only | IPv6 | Post
#28
|
![]() ![]() ![]() ![]() ![]() ![]()
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. This are true statement and often wrongly interpreted, either by cashier or staff on the ground.- 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. The requirements definitely need some static testing. 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. |
|
|
Feb 27 2023, 04:38 PM
Show posts by this member only | IPv6 | Post
#29
|
![]() ![]()
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. Unlike your newbie.cpp, the junior.cpp cannot run by Dev-C++, it reported errors:Still, need to recompile and deploy program every time changes involved. 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++. |
|
|
Feb 27 2023, 05:41 PM
|
![]() ![]() ![]() ![]()
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: You need to use C++11. e.g. using GCC, 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++. CODE g++ -std=c++11 junior.cpp This post has been edited by angch: Feb 27 2023, 05:43 PM FlierMate4 liked this post
|
|
|
Feb 27 2023, 05:46 PM
Show posts by this member only | IPv6 | Post
#31
|
![]() ![]() ![]() ![]() ![]() ![]()
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: compiler too old. Need C++11 or newer compiler. Try to set the option of your compiler to -std=c++11CODE 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++. P.S. C++11 is a C++ standard that is released at 2011, which is 12 years ago. The latest standard is C++20 ![]() FlierMate4 liked this post
|
|
|
Feb 27 2023, 06:09 PM
Show posts by this member only | IPv6 | Post
#32
|
![]() ![]()
Validating
90 posts Joined: Jan 2023 |
QUOTE(angch @ Feb 27 2023, 05:41 PM) 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 Yes, the Dev-C++ is working now after adding "-std=c++11" in compiler option.P.S. C++11 is a C++ standard that is released at 2011, which is 12 years ago. The latest standard is C++20 Thanks. |
|
|
Feb 28 2023, 09:58 PM
Show posts by this member only | IPv6 | Post
#33
|
![]() ![]() ![]() ![]() ![]() ![]()
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 Attached File(s)
senior.gz ( 10k )
Number of downloads: 8 |
|
|
|
|
|
Mar 1 2023, 01:11 PM
Show posts by this member only | IPv6 | Post
#34
|
![]() ![]() ![]() ![]() ![]() ![]()
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
QUOTE(WongGei @ Feb 28 2023, 09:58 PM) I classify it as a work of senior programmer based on the following criteria1.) 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. FlierMate4 liked this post
|
|
|
Mar 1 2023, 09:45 PM
|
|
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 To me that is still junior 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. You cannot do that level, you're still a student. WongGei liked this post
|
|
|
Mar 1 2023, 10:27 PM
|
![]() ![]() ![]()
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 IMHO, 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. 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 ? |
|
|
Mar 2 2023, 09:31 AM
Show posts by this member only | IPv6 | Post
#37
|
![]() ![]() ![]() ![]() ![]() ![]()
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 ? 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 |
|
|
Mar 2 2023, 09:35 AM
Show posts by this member only | IPv6 | Post
#38
|
![]() ![]() ![]() ![]() ![]() ![]()
Senior Member
1,206 posts Joined: Dec 2007 From: Kuala Lumpur |
|
|
|
Mar 2 2023, 01:43 PM
Show posts by this member only | IPv6 | Post
#39
|
![]() ![]()
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.![]() 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. |
|
|
Mar 2 2023, 01:45 PM
Show posts by this member only | IPv6 | Post
#40
|
![]() ![]()
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'. ![]() 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 |
| Change to: | 0.0314sec
0.41
6 queries
GZIP Disabled
Time is now: 24th December 2025 - 06:53 AM |