TGViewer
Channel Public Channel
Programming & AI Tips πŸ’‘

Programming & AI Tips πŸ’‘

@programmingtip

Programming & AI:
Tips πŸ’‘
Articles πŸ“•
AI & LLMs πŸ‘Ύ
Design, Architecture, Principles βœ…

πŸ‡³πŸ‡± Contact: @MoienTajik
Subscribers
46.3K
Photos
67
Videos
11
Links
377

Showing posts older than #53 Β· Back to latest

Older Posts 20 shown
Post #51 1.24K
When you can solve the same number of problems as your competitor, it is now down to coding skill and ... typing speed.

Try this typing test at https://10fastfingers.com and follow the instructions there on how to improve your typing skill.

You need to familiarize your fingers with the position of frequently used programming language characters, e.g :
braces {} or () or <>, semicolon β€˜;’, single quote for β€˜char’ and double quotes for β€œstring”, ... .

#competitive_programming
10FastFingers 10FastFingers - Typing Test, Competitions, Practice & Typing Games Free typing test: check your typing speed in WPM, join typing competitions, practice with custom texts and play typing games. Available in over 50 languages.
Post #49 1.18K
Consistent Name Scheme πŸ“

Usually, Languages have their own naming conventions; For example, java uses camelCase.

Naming needs to stay consistent, otherwise, it will very difficult to find things inside the document .

There are two main ways to name things :

1.camelCase : which means that every word of the file name is capitalized except for the first one, for example: nameFilesConsistently

2.Underscores : in this case you write underscores between each word, for example:
name_files_consistently

#NamingConventions
Post #48 1.08K
#Fun The Last TODO πŸ€¦πŸ»β€β™‚οΈ
Post #47 1.15K
Getting software to work and making software clean are two very different activities .πŸ’‘

Most of us have limited room in our heads, so we focus on getting our code to work more than organization and cleanliness.

The problem is that too many of us think that we are done once the program works. ❌

We fail to switch to the other concern of organization and cleanliness.

#Cleancode
Post #45 1.13K
Classes Should Be Small ❗️

The first rule of classes is that they should be small .

The second rule of classes is that they should be smaller than that .

Our immediate question is always β€œHow small❓ ”

With functions we measured size by counting physical lines .

With classes we use a different measure .

We count responsibilities .

#Cleancode #Class
Post #44 1.11K
Class definition πŸ“

The name of a class should describe what responsibilities it does .

In fact, naming is probably the first way of helping determine class size.

If we cannot derive a concise name for a class, then it’s likely too large.

The more ambiguous the class name, the more likely it has too many responsibilities.

#CleanCode #Class
Post #43 1.05K
#Fun Fails again πŸ˜‚πŸ€¦πŸ»β€β™‚οΈ
Post #42 1.11K
What makes a clean test❓

Three things : Readability, readability, and readability.

Read-ability is perhaps even more important in unit tests than it is in production code .

What makes tests readable ❔

The same thing that makes all code readable :
clarity, simplicity & density of expression .

#CleanCode #UnitTest
Post #41 1.14K
Test code is just as important as production code❗️

It is not a second-class citizen .

It requires thought, design, and care .

It must be kept as clean as production code .

#CleanCode #UnitTest
Post #40 1.39K
β€œ Any fool can write code that a computer can understand, Good programmers write code that humans can understand .” πŸ‘ŒπŸ»

βž–Martin Fowler
Post #39 1.18K
#Fun Unit Tests Fails πŸ˜…πŸ€¦πŸ»β€β™‚οΈ
Post #38 1.16K
πŸ’‘ Consider the following three laws before writing Unit Test :

1- You may not write production code until you have written a failing unit test.

2- You may not write more of a unit test than is sufficient to fail, and not com-piling is failing.

3- You may not write more production code than is sufficient to pass the currently failing test.

#CleanCode #UnitTest #TDD
Post #37 1.36K
Don't Pass & Return Null ❌

Returning null from methods is bad, but passing null into methods is worse.

Unless you are working with an API which expects you to pass null, you should avoid passing null in
your code whenever possible.

#CleanCode #Exception #Null
Post #36 1.21K
Try Catch Finally πŸ”„

Try blocks are like transactions.

Your catch has to leave your program in a consistent state, no matter what happens in the try.

For this reason it is good practice to start with a try-catch-finally statement when you are writing code that could throw exceptions.

This helps you define what the user of that code should expect, no matter what goes wrong with the code that is executed in the try .

#CleanCode #Exceptions
Post #33 1.2K
#Fun #Namings πŸ˜„
Post #32 1.22K
Dependent Functions ↕️

If one function calls another, they should be vertically close,
and the caller should be above the callee .

#CleanCode
Post #31 1.23K
Variable Declarations πŸ”

Variables should be declared as close to their usage as possible, Because our functions are very short, local variables should appear a the top of each function .

#CleanCode #Variables
Post #30 1.68K
How your classes should be ? πŸ’­

Think of a well-written newspaper article, You read it vertically.

At the top you expect a headline that will tell you what the story is about and allows you to decide whether it is
something you want to read. The first paragraph gives you a synopsis of the whole story.

As you continue down-ward, the details increase until you have all the dates, names, quotes, claims, and other
minutia.

We would like a source file to be like a newspaper article. πŸ“œ

The name should be simple but explanatory.

The name, by itself, should be sufficient to tell us whether we are in the right module or not.

The topmost parts of the source file should provide the high-level concepts and algorithms.

Detail should increase as we move downward, until at the end we find the lowest level functions and details in the source file.

A newspaper is composed of many articles; most are very small, Some are a bit larger, Very few contain as much text as a page can hold.

This makes the newspaper usable. If the newspaper were just one long story containing a disorganized agglomeration of facts, dates, and names, then we simply would not read it !

#CleanCode #NewsPaper #Metaphor
Post #29 1.6K
#Fun πŸ˜…πŸ€¦πŸ»β€β™‚οΈ
Older posts β†’
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook β†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 β†’