Welcome Guest ( Log In | Register )

5 Pages < 1 2 3 4 5 >Bottom

Outline · [ Standard ] · Linear+

 Newbie, junior, senior programmer, Simple POS system

views
     
TSWongGei
post Mar 2 2023, 01:55 PM

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

Joined: Dec 2007
From: Kuala Lumpur
QUOTE(FlierMate4 @ Mar 2 2023, 01:45 PM)
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.
*
try -std=c++20
FlierMate4
post Mar 2 2023, 02:00 PM

Getting Started
**
Validating
90 posts

Joined: Jan 2023
QUOTE(FlierMate4 @ Mar 2 2023, 01:43 PM)
The total price should be RM 7.10, but I see RM 6.90....
*
Found it, this:
CODE
E1,Set E - Butterfly Bun + Porridge + Tao Foo Far + Soya Bean,6.9,1,3,6,7

FlierMate4
post Mar 2 2023, 02:02 PM

Getting Started
**
Validating
90 posts

Joined: Jan 2023
QUOTE(WongGei @ Mar 2 2023, 01:55 PM)
try -std=c++20
*
Maybe I will just stick to Visual Studio 2022, as Dev-C++ returns an error:
CODE
C:\Users\~User~\Downloads\g++.exe [Error] unrecognized command line option '-std=c++20'

TSWongGei
post Mar 2 2023, 02:04 PM

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

Joined: Dec 2007
From: Kuala Lumpur
QUOTE(FlierMate4 @ Mar 2 2023, 01:43 PM)
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
*
Updated the output to make it easier to understand how the sum being calculated.

Price of A1 + D = 3.2 + 3.9 = 7.1
But 1,7,3,6 can form a set E1, which the price is 6.9

user posted image

This post has been edited by WongGei: Mar 2 2023, 02:07 PM


Attached File(s)
Attached File  senior.gz ( 1.95k ) Number of downloads: 4
flashang
post Mar 2 2023, 07:23 PM

Casual
***
Junior Member
355 posts

Joined: Aug 2021


QUOTE(WongGei @ Mar 2 2023, 09:31 AM)
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.
*
It might be too harsh if speak directly.
don't take it too serious as this is only personal opinion.

smile.gif

This are what tested :

CODE

Case 1 : menu.csv and order.txt exists :

A1
D
====
7
1
6
3
====
6.9



Case 2 : only order.txt exists :

A1
D
====
Error in order file, please check
0



Case 3 : only menu.cs exist :
Case 4 : both menu.cs & order.txt missing :

====
====
0





The "senior" version read data from menu.csv & order.txt, do some matching and display total amount.

What was missing ?

QUOTE
Requirement,
Create a simple POS system that take in customer order and calculates the total amount of the order.
* it does not "take in customer order" -- which was done in "newbie" & "junior" version.
* it only shows numbers and code, no product name -- which was done in "newbie" & "junior" version.
* the error message "Error in order file, please check" misleading user to search for wrong direction. it should be "menu.csv error or not found"

If "The menu.csv wont be edited by human",
are the "order.txt" should be edit by user ?
because this do not accept user to key in order.

smile.gif


iammyself
post Mar 2 2023, 08:49 PM

Getting Started
**
Junior Member
238 posts

Joined: May 2011
I've been watching this thread for a while. This is satirical right?

All the discussion about "hey if I do it this way I'm a senior" etc. is just unproductive and honestly a little bit childish.

At the end of the day, it's about project requirements.

If your requirement is introductory university level, no senior or staff or coding ninja will set up a POS application with 100% test coverage, backed by a cluster of database instances etc.

Go ahead if you just want to have fun building a toy POS system that uses the terminal for input. But stop with the labeling nonsense please, it's childish.
angch
post Mar 2 2023, 08:54 PM

On my way
****
Junior Member
636 posts

Joined: Jul 2006
QUOTE(iammyself @ Mar 2 2023, 08:49 PM)
I've been watching this thread for a while. This is satirical right?

All the discussion about "hey if I do it this way I'm a senior" etc. is just unproductive and honestly a little bit childish.

At the end of the day, it's about project requirements.

If your requirement is introductory university level, no senior or staff or coding ninja will set up a POS application with 100% test coverage, backed by a cluster of database instances etc.

Go ahead if you just want to have fun building a toy POS system that uses the terminal for input. But stop with the labeling nonsense please, it's childish.
*
smile.gif Let them^Wus have their^Wour fun. Let's not gate keep, this group is quiet enough already. At least there's code being written, shared and discussed.

This post has been edited by angch: Mar 2 2023, 08:54 PM
15cm
post Mar 2 2023, 11:43 PM

Casual
***
Junior Member
423 posts

Joined: Apr 2022
can i join the fun? my c is pretty shitty
silverhawk
post Mar 3 2023, 12:04 AM

Eyes on Target
Group Icon
Elite
4,956 posts

Joined: Jan 2003


QUOTE(iammyself @ Mar 2 2023, 08:49 PM)
I've been watching this thread for a while. This is satirical right?

All the discussion about "hey if I do it this way I'm a senior" etc. is just unproductive and honestly a little bit childish.

At the end of the day, it's about project requirements.

If your requirement is introductory university level, no senior or staff or coding ninja will set up a POS application with 100% test coverage, backed by a cluster of database instances etc.

Go ahead if you just want to have fun building a toy POS system that uses the terminal for input. But stop with the labeling nonsense please, it's childish.
*
He's just having fun creating different levels of complexity.

Yes the labelling is inane, but like angch said code is being written, people are having fun.
silverhawk
post Mar 3 2023, 12:05 AM

Eyes on Target
Group Icon
Elite
4,956 posts

Joined: Jan 2003


QUOTE(15cm @ Mar 2 2023, 11:43 PM)
can i join the fun? my c is pretty shitty
*
From you I'd expect it to be in a JS framework laugh.gif
TSWongGei
post Mar 3 2023, 11:09 AM

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

Joined: Dec 2007
From: Kuala Lumpur
QUOTE(flashang @ Mar 2 2023, 07:23 PM)
It might be too harsh if speak directly.
don't take it too serious as this is only personal opinion.

smile.gif 

This are what tested :

CODE

Case 1 : menu.csv and order.txt exists :

A1
D
====
7
1
6
3
====
6.9
Case 2 : only order.txt exists :

A1
D
====
Error in order file, please check
0
Case 3 : only menu.cs exist :
Case 4 : both menu.cs & order.txt missing :

====
====
0


The "senior" version read data from menu.csv & order.txt, do some matching and display total amount.

What was missing ?
* it does not "take in customer order" -- which was done in "newbie" & "junior" version.
* it only shows numbers and code, no product name -- which was done in "newbie" & "junior" version.
* the error message "Error in order file, please check" misleading user to search for wrong direction. it should be "menu.csv error or not found"

If "The menu.csv wont be edited by human",
are the "order.txt" should be edit by user ?
because this do not accept user to key in order.

smile.gif
*
As I said, you will never undestand the work of programmer. Why reinvent the wheel?
If there is a front-end to write the input / output work for you. Why do you need to duplicates the work?
A junior can write the program to generate orders.txt and update the menu.csv accordingly. A senior will write a program to do the calculation. Don't waste a senior time to do things that can be done by a junior.
Another reason why it has been done this way is I can ask ChatGPT to create a program to take in order and save it into the order.txt file format for me. Then I just have to write a program to do the calculation.



This post has been edited by WongGei: Mar 3 2023, 03:34 PM
TSWongGei
post Mar 3 2023, 11:11 AM

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

Joined: Dec 2007
From: Kuala Lumpur
QUOTE(15cm @ Mar 2 2023, 11:43 PM)
can i join the fun? my c is pretty shitty
*
You are most welcomed. I purposely leave out the language category so that more programmer with different language skill can showcase their work.

This post has been edited by WongGei: Mar 3 2023, 11:28 AM
TSWongGei
post Mar 3 2023, 11:27 AM

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

Joined: Dec 2007
From: Kuala Lumpur
QUOTE(iammyself @ Mar 2 2023, 08:49 PM)
I've been watching this thread for a while. This is satirical right?

All the discussion about "hey if I do it this way I'm a senior" etc. is just unproductive and honestly a little bit childish.

At the end of the day, it's about project requirements.

If your requirement is introductory university level, no senior or staff or coding ninja will set up a POS application with 100% test coverage, backed by a cluster of database instances etc.

Go ahead if you just want to have fun building a toy POS system that uses the terminal for input. But stop with the labeling nonsense please, it's childish.
*
Sorry for the childish act.
A senior programmer can always code like a junior programmer depends on the requirement. But its hard for a junior / newbie programmer to code like a senior.

Yes, in real world, program is all about budget and company constraint instead of the programmer skill.
With 1 day budget, I will write like a junior cause no point invest in something more than what you can get. At the end of the day, we still need to eat like others.
But as a programmer, I will always try to figure out a better way to improve the same piece of code/program to improve my skill.

As mentioned earlier, I started this thread is because I was impressed and would like to see how long to implement the optimization for price calculation. Take the opportunity to brush up my C++ skill to the recent standard.

Since the "Codemaster" is very quite recently, its good to know that many are still following the forum.

I encounter numerous situation where system can be done better and it is not. At the end, end user (client, business user) is the one who need to do extra works because the system are not designed to adopt the changes fast enough.

This post has been edited by WongGei: Mar 3 2023, 11:43 AM
TSWongGei
post Mar 3 2023, 01:07 PM

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

Joined: Dec 2007
From: Kuala Lumpur
QUOTE(WongGei @ Mar 2 2023, 02:04 PM)
Updated the output to make it easier to understand how the sum being calculated.

Price of A1 + D = 3.2 + 3.9 = 7.1
But 1,7,3,6 can form a set E1, which the price is 6.9

user posted image
*
As a programmer, my though won't stop after I delivered the code.
There's always room to grow. -Scott
After I wrote the program and menu.csv, which it fulfill the purpose of the program and ordering system.
What if there are more types of campaign that the shop like to do?

Its a simple requirement and we can see that in everydays life.

Buy 4 You Tiao free 1 or Buy 5 You Tiao get 20% discount.

If you are the company that support the program, what would you do?

First, You will tell the business owner, easy ja, just add new code into the menu that have 2,2,2,2,2 .....
Then the business owner will says , "OK, what about Butterfly Bun and Friend Red Bean Bun?" .......
Then you will answer "No problem, add another 1,1,1,1,1 and 4,4,4,4,4 into the menu.csv ..."
OK. Still cool, right ....

So, what is the potential problem here?

This post has been edited by WongGei: Mar 3 2023, 01:08 PM
flashang
post Mar 3 2023, 10:59 PM

Casual
***
Junior Member
355 posts

Joined: Aug 2021


QUOTE(WongGei @ Mar 3 2023, 11:09 AM)
As I said, you will never undestand the work of programmer. Why reinvent the wheel?
If there is a front-end to write the input / output work for you. Why do you need to duplicates the work?
A junior can write the program to generate orders.txt and update the menu.csv accordingly. A senior will write a program to do the calculation. Don't waste a senior time to do things that can be done by a junior.
Another reason why it has been done this way is I can ask ChatGPT to create a program to take in order and save it into the order.txt file format for me. Then I just have to write a program to do the calculation.
*
Some people might think a good programmer is to write some show off technique codes.

Some other people believe this :
QUOTE
“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”

― Martin Fowler
A good code should be clear to read and easy to understand,
even for junior programmer (for handover),
or you can just recall within a seconds after many years later to upgrade the software.

Of course comments could helps,
but a good design structure, format make less effort to understand.

For someone who do not have enough basic skill / knowledge,
Copy paste the code from internet does not means they can make a working software or improve it.

smile.gif

A note for everyone : You may forgive those people who don't know you. biggrin.gif tongue.gif


TSWongGei
post Mar 4 2023, 04:37 PM

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

Joined: Dec 2007
From: Kuala Lumpur
QUOTE(WongGei @ Mar 3 2023, 01:07 PM)
As a programmer, my though won't stop after I delivered the code.
There's always room to grow. -Scott
After I wrote the program and menu.csv, which it fulfill the purpose of the program and ordering system.
What if there are more types of campaign that the shop like to do?

Its a simple requirement and we can see that in everydays life.

Buy 4 You Tiao free 1 or Buy 5 You Tiao get 20% discount.

If you are the company that support the program, what would you do?

First,  You will tell the business owner, easy ja, just add new code into the menu that have 2,2,2,2,2  .....
Then the business owner will says , "OK, what about Butterfly Bun and Friend Red Bean Bun?" .......
Then you will answer "No problem, add another 1,1,1,1,1 and 4,4,4,4,4 into the menu.csv ..."
OK. Still cool, right ....

So, what is the potential problem here?
*
A senior programmer might not be a good programmer and a junior programmer might not be a bad programmer.
As we see in Big Bang Theory, high IQ != high EQ. Some programmers have the ego that writing code to get the job done and don't border to let other people understand their code, while this kind of attitude is not welcomed by business who is looking for extend-ability and readability. Same as other skilled professionals such as carpenter, they are good in their skill but not good as a team player. They can produce fine work as an individual but they can't build the whole house which require the skill of other professional such as electrician and plumber.

Lets look at a program and see if it is able to fulfill it job and how it can be extended without bring in company politics.

For the above mentioned source, it can handle the new business requirement.
The potential problem here is even with the updated menu.csv file, they are definitely some nasty clients who put the following orders.

Since You Tiao is the same price as Butterfly Bun and Friend Red Bean Bun and they are exchangeable, is it possible to order 2 You Tiao , 2 Butterfly Bun and 1 Friend Red Bean Bun, and pay the same price as 5 You Tiao?

If you are the business owner, what will you say?
If you are the cashier, how will you enter the order to get the discount price?
If you are the technician who asked to maintain the system, what will you do?
If you are the programmer who asked to change the program / system, what will you do?
flashang
post Mar 4 2023, 09:54 PM

Casual
***
Junior Member
355 posts

Joined: Aug 2021


QUOTE(WongGei @ Mar 4 2023, 04:37 PM)
A senior programmer might not be a good programmer and a junior programmer might not be a bad programmer.
As we see in Big Bang Theory, high IQ != high EQ. Some programmers have the ego that writing code to get the job done and don't border to let other people understand their code, while this kind of attitude is not welcomed by business who is looking for extend-ability and readability. Same as other skilled professionals such as carpenter, they are good in their skill but not good as a team player. They can produce fine work as an individual but they can't  build the whole house which require the skill of other professional such as electrician and plumber.

Lets look at a program and see if it is able to fulfill it job and how it can be extended without bring in company politics.

For the above mentioned source, it can handle the new business requirement.
The potential problem here is even with the updated menu.csv file, they are definitely some nasty clients who put the following orders.

Since  You Tiao is the same price as Butterfly Bun and  Friend Red Bean Bun and they are exchangeable, is it possible to order 2 You Tiao , 2 Butterfly Bun and 1 Friend Red Bean Bun, and pay the same price as 5 You Tiao?

If you are the business owner, what will you say?
If you are the cashier, how will you enter the order to get the discount price?
If you are the technician who asked to maintain the system, what will you do?
If you are the programmer who asked to change the program / system, what will you do?
*
There might have cases when the order have been made with discount price,
some product is out of stock.
Could the staff replacement products with same original price to the customer ?

Software could help staff to prevent human error. (e.g. auto convert alacarte to set, auto discount)

But, management should prepare some SOP when the system cannot handle some cases.
(e.g. When can replace same / higher price item to customer)

smile.gif


FlierMate4
post Mar 5 2023, 03:17 PM

Getting Started
**
Validating
90 posts

Joined: Jan 2023
"Youtiao" may not be familiar to other language speakers, I look up the Internet, "fried dough sticks" maybe more an ideal name. laugh.gif


TSWongGei
post Mar 5 2023, 10:48 PM

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

Joined: Dec 2007
From: Kuala Lumpur
QUOTE(FlierMate4 @ Mar 5 2023, 03:17 PM)
"Youtiao" may not be familiar to other language speakers, I look up the Internet, "fried dough sticks" maybe more an ideal name.  laugh.gif
*
It's the business owner decision and not mine.

TSWongGei
post Mar 6 2023, 11:06 AM

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

Joined: Dec 2007
From: Kuala Lumpur
QUOTE(WongGei @ Mar 4 2023, 04:37 PM)
A senior programmer might not be a good programmer and a junior programmer might not be a bad programmer.
As we see in Big Bang Theory, high IQ != high EQ. Some programmers have the ego that writing code to get the job done and don't border to let other people understand their code, while this kind of attitude is not welcomed by business who is looking for extend-ability and readability. Same as other skilled professionals such as carpenter, they are good in their skill but not good as a team player. They can produce fine work as an individual but they can't  build the whole house which require the skill of other professional such as electrician and plumber.

Lets look at a program and see if it is able to fulfill it job and how it can be extended without bring in company politics.

For the above mentioned source, it can handle the new business requirement.
The potential problem here is even with the updated menu.csv file, they are definitely some nasty clients who put the following orders.

Since  You Tiao is the same price as Butterfly Bun and  Friend Red Bean Bun and they are exchangeable, is it possible to order 2 You Tiao , 2 Butterfly Bun and 1 Friend Red Bean Bun, and pay the same price as 5 You Tiao?

If you are the business owner, what will you say?
If you are the cashier, how will you enter the order to get the discount price?
If you are the technician who asked to maintain the system, what will you do?
If you are the programmer who asked to change the program / system, what will you do?
*
Lets look at the menu.csv file after 3 new lines being added for 5 * you Tiao / Butterfly Bun / Friend Red Bean Bun = 20% discount

...
E1,5 You Tiao,4,2,2,2,2,2
E2,5 Butterfly Bun,4,1,1,1,1,1
E3,5 Friend Red Bean Bun,4,4,4,4,4,4

This should be the improved version of the menu.csv
Then with the nasty client request , the owner agree that 2 You Tiao , 2 Butterfly Bun and 1 Friend Red Bean Bun also entitle the same discount.
Luckily, the program is designed to handle this without changes, just update the menu.csv to handle that

E4,20 discount 1,4,2,2,1,1,4
E5,20 discount 2,4,2,2,1,1,2
E6,20 discount 3,4,2,2,1,1,1
.....
And the list goes on.

The programmer was brought in and he just inform the technician that this can be done and the technician manully added all the possible combination into the menu.csv.
So, how long you think the technician will take to update 21 lines (all possible combinations of 3 items)

After 15 minutes, the technician happily update the menu.csv and handover to the business owner, and the cashier happily put up the 20% discount.

Isn't this sounds familiar with our daily life as a programmer and technician?

What is the possible bad thing that you can foresee here?

user posted image

This post has been edited by WongGei: Mar 6 2023, 06:06 PM

5 Pages < 1 2 3 4 5 >Top
 

Change to:
| Lo-Fi Version
0.0249sec    1.18    6 queries    GZIP Disabled
Time is now: 24th December 2025 - 10:59 AM